Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private compass1, compass2, compass3 As CompassView
Dim ps As PhoneOrientation
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("main")
compass1.Initialize("")
compass2.Initialize("")
compass3.Initialize("")
Activity.AddView(compass1, 10%x, 10%y, 50%x, 20%y)
Activity.AddView(compass2, 25%x, 40%y, 50%x, 20%y)
Activity.AddView(compass3, 40%x, 70%y, 50%x, 20%y)
compass1.CompassLineColor = Colors.Green
compass1.CompassBackgroundColor = Colors.DarkGray
compass1.CompassMarkerColor = Colors.Cyan
compass1.CompassRangeDegrees = 360
compass1.CompassShowMarker = True
compass1.CompassTextColor = Colors.Yellow
compass1.CompassTextSize = 15
compass2.CompassLineColor = Colors.Cyan
compass2.CompassBackgroundColor = Colors.LightGray
compass2.CompassMarkerColor = Colors.Green
compass2.CompassRangeDegrees = 360
compass2.CompassShowMarker = True
compass2.CompassTextColor = Colors.Blue
compass2.CompassTextSize = 20
compass3.CompassLineColor = Colors.Black
compass3.CompassBackgroundColor = Colors.ARGB(100,255,255,255)
compass3.CompassMarkerColor = Colors.Red
compass3.CompassRangeDegrees = 360
compass3.CompassShowMarker = True
compass3.CompassTextColor = Colors.Yellow
compass3.CompassTextSize = 25
End Sub
Sub Activity_Resume
ps.StartListening("ps")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
ps.StopListening
End Sub
Sub ps_OrientationChanged (Azimuth As Float, Pitch As Float, Roll As Float)
compass1.CompassDegrees = Azimuth
compass2.CompassDegrees = Azimuth
compass3.CompassDegrees = Azimuth
End Sub