Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Type point(x As Float, y As Float)
Private xAxis() As Float = Array As Float(300,510,720,930,1140,1350,1560,1770,1980,2300)
Private yAxis() As Float = Array As Float(708,686,586,486,386,50)' 386,486,586,686,708)
Private scaleFactorX = 0.2, scaleFaxotrY = 0.2 As Float
Private cnv As B4XCanvas
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
cnv.Initialize(MainForm.RootPane)
drawKey(Array As point(Createpoint(1,1),Createpoint(2,3),Createpoint(3,2),Createpoint(4,4),Createpoint(5,4),Createpoint(6,2),Createpoint(7,1),Createpoint(8,3),Createpoint(9,1),Createpoint(10,6)))
End Sub
Sub drawKey(l As List)
cnv.ClearRect(cnv.TargetRect)
Dim zeroLineY As Float = 200
For i = 0 To l.Size-1
Dim p As point = l.Get(i)
cnv.DrawLine(xAxis(p.x-1)*scaleFactorX,0,xAxis(p.x-1)*scaleFactorX,1000,xui.Color_DarkGray,1)
cnv.DrawLine(xAxis(p.x-1)*scaleFactorX,0,xAxis(p.x-1)*scaleFactorX,1000,xui.Color_DarkGray,1)
cnv.DrawLine(0,zeroLineY-((yAxis(p.y-1)/2)*scaleFaxotrY),1000,zeroLineY-((yAxis(p.y-1)/2)*scaleFaxotrY),xui.Color_DarkGray,1)
cnv.DrawLine(0,zeroLineY+((yAxis(p.y-1)/2)*scaleFaxotrY),1000,zeroLineY+((yAxis(p.y-1)/2)*scaleFaxotrY),xui.Color_DarkGray,1)
cnv.DrawCircle(xAxis(p.x-1)*scaleFactorX,zeroLineY-((yAxis(p.y-1)/2)*scaleFaxotrY),3,xui.Color_Red,True,0)
cnv.DrawCircle(xAxis(p.x-1)*scaleFactorX,zeroLineY+((yAxis(p.y-1)/2)*scaleFaxotrY),3,xui.Color_Red,True,0)
If i > 0 Then
Dim champfer As Float = (210*scaleFaxotrY)*0.35
Dim p0 As point = l.Get(i-1)
If i > l.Size-3 Then champfer = ((xAxis(p.x-1)-xAxis(p0.x-1))*scaleFactorX) 'fullchampfer
cnv.DrawLine(xAxis(p0.x-1)*scaleFactorX,zeroLineY-((yAxis(p0.y-1)/2)*scaleFaxotrY),(xAxis(p0.x-1)*scaleFactorX)+champfer,zeroLineY-((yAxis(p.y-1)/2)*scaleFaxotrY),xui.Color_Blue,2)
cnv.DrawLine(xAxis(p0.x-1)*scaleFactorX,zeroLineY+((yAxis(p0.y-1)/2)*scaleFaxotrY),(xAxis(p0.x-1)*scaleFactorX)+champfer,zeroLineY+((yAxis(p.y-1)/2)*scaleFaxotrY),xui.Color_Blue,2)
cnv.DrawLine((xAxis(p0.x-1)*scaleFactorX)+champfer,zeroLineY-((yAxis(p.y-1)/2)*scaleFaxotrY),xAxis(p.x-1)*scaleFactorX,zeroLineY-((yAxis(p.y-1)/2)*scaleFaxotrY),xui.Color_Blue,2)
cnv.DrawLine((xAxis(p0.x-1)*scaleFactorX)+champfer,zeroLineY+((yAxis(p.y-1)/2)*scaleFaxotrY),xAxis(p.x-1)*scaleFactorX,zeroLineY+((yAxis(p.y-1)/2)*scaleFaxotrY),xui.Color_Blue,2)
End If
Next
End Sub
Public Sub Createpoint (x As Float, y As Float) As point
Dim t1 As point
t1.Initialize
t1.x = x
t1.y = y
Return t1
End Sub