##Region Project Attributes
#ApplicationLabel: draw
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
Private pnl As Panel
Private lbl As Label
Private old_x,old_y As Int
Private first As Boolean
Private coordx(5) As Int
Private coordy(5) As Int
Private c As Canvas
Private uzunluk As Float
Private xf,yf As Float
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
pnl.Initialize("pnl")
lbl.Initialize("lbl")
Activity.AddView(lbl,0,0,100%x,10%y)
Activity.AddView(pnl,0,0,100%x,100%y)
first=True
c.Initialize(pnl)
'pnl.Color=Colors.White
lbl.Text="X"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub pnl_Touch (Action As Int, X As Float, Y As Float)
xf=X-old_x
yf=Y-old_y
uzunluk=Sqrt(xf*xf+yf*yf)
If uzunluk>=50 Then
lbl.Left=X
lbl.Top=Y
add_to_array(X,Y)
draw_dots
old_x=X
old_y=Y
End If
End Sub
Sub draw_dots
'Dim c As Canvas
c.Initialize(pnl)
For i=1 To 3
c.DrawCircle(coordx(i),coordy(i),5dip,Colors.White,True,1dip)
Next
c.DrawCircle(coordx(4),coordy(4),5dip,Colors.Black,True,1dip)
End Sub
Sub add_to_array(a_x As Int ,a_y As Int)
If first Then
For i=0 To 4
coordx(i)=a_x
coordy(i)=a_y
Next
first=False
Else
coordx(4)=coordx(3)
coordx(3)=coordx(2)
coordx(2)=coordx(1)
coordx(1)=coordx(0)
coordx(0)=a_x
coordy(4)=coordy(3)
coordy(3)=coordy(2)
coordy(2)=coordy(1)
coordy(1)=coordy(0)
coordy(0)=a_y
End If
End Sub