Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim canCanvas As Canvas
Dim mapParts As Map
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")
Dim patheye As Path
Dim pathwings As Path
Dim pathlegs As Path
patheye.Initialize(startX, startY)
patheye.LineTo(nextX, nextY)
patheye.LineTo(nextX, nextY)
pathwings.Initialize(startX, startY)
pathwings.LineTo(nextX, nextY)
pathwings.LineTo(nextX, nextY)
mapParts.Initialize
mapParts.Put(0, patheye)
mapParts.Put(1, pathwings)
mapParts.Put(2, pathlegs)
Dim pnlDraw As Panel
pnlDraw.Initialize("pnlDraw")
Activity.AddView(pnlDraw, 0, 0, 100%x, 100%y)
canCanvas.Initialize(pnlDraw)
End Sub
Sub pnlDraw_Touch (Action As Int, X As Float, Y As Float)
'need to find out which map was clicked
Dim drawThisPart As Int
drawThisPart = whichPartClicked(X,Y)
drawPart(drawThisPart)
End Sub
Sub whichPartClicked(x As Int, y As Int) As Int
For i = 0 To mapParts.Size-1
'loop thru the maps and see if x,y is inside the boundaries
'if so return that part
Next
End Sub
Sub drawPart(index As Int)
'draw the part to the canvas
'add a clippath
canCanvas.ClipPath(mapParts.GetValueAt(index))
'pick a color
Dim thisColor As Int
Select index
Case 0
thisColor = Colors.Green
Case 1
thisColor = Colors.Yellow
Case Else
thisColor = Colors.Yellow
End Select
canCanvas.DrawColor(thisColor)
'remove clippath
canCanvas.RemoveClip
End Sub