Sub Process_Globals
Dim Timer1 As Timer
End Sub
Sub Globals
Dim pnlMain As Panel
Dim cvsMain As Canvas
Dim pthBulb As Path
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlMain.Initialize("pnlMain")
Activity.AddView(pnlMain, 50%x - 100dip, 50dip, 200dip, 300dip)
pnlMain.Color = Colors.White
cvsMain.Initialize(pnlMain)
cvsMain.RemoveClip
Timer1.Initialize("Timer1", 1000)
Timer1.Enabled = True
End Sub
Sub Activity_Resume
DefineBulbPath
DrawBulb(Colors.Red)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Timer1.Enabled = False
End Sub
Sub Timer1_Tick
DrawBulb(Colors.RGB(Rnd(0,256), Rnd(0,256), Rnd(0,256)))
pnlMain.Invalidate
End Sub
Sub DrawBulb(col As Int)
cvsMain.DrawPath(pthBulb, col, True, 1)
End Sub
Sub DefineBulbPath
Dim x0, y0 As Float
x0 = pnlMain.Width / 2
y0 = 20dip
pthBulb.Initialize(x0, y0)
pthBulb.LineTo(x0 + 20dip, y0 + 5dip)
pthBulb.LineTo(x0 + 40dip, y0 + 10dip)
pthBulb.LineTo(x0 + 60dip, y0 + 30dip)
pthBulb.LineTo(x0 + 70dip, y0 + 50dip)
pthBulb.LineTo(x0 + 70dip, y0 + 80dip)
pthBulb.LineTo(x0 + 65dip, y0 + 100dip)
pthBulb.LineTo(x0 + 55dip, y0 + 120dip)
pthBulb.LineTo(x0 + 45dip, y0 + 150dip)
pthBulb.LineTo(x0 + 40dip, y0 + 180dip)
pthBulb.LineTo(x0 + 38dip, y0 + 186dip)
pthBulb.LineTo(x0 + 32dip, y0 + 190dip)
pthBulb.LineTo(x0 - 32dip, y0 + 190dip)
pthBulb.LineTo(x0 - 38dip, y0 + 186dip)
pthBulb.LineTo(x0 - 40dip, y0 + 180dip)
pthBulb.LineTo(x0 - 45dip, y0 + 150dip)
pthBulb.LineTo(x0 - 55dip, y0 + 120dip)
pthBulb.LineTo(x0 - 65dip, y0 + 100dip)
pthBulb.LineTo(x0 - 70dip, y0 + 80dip)
pthBulb.LineTo(x0 - 70dip, y0 + 50dip)
pthBulb.LineTo(x0 - 60dip, y0 + 30dip)
pthBulb.LineTo(x0 - 40dip, y0 + 10dip)
pthBulb.LineTo(x0 - 20dip, y0 + 5dip)
pthBulb.LineTo(x0, y0)
End Sub