Sub Globals
Dim LAYER As Canvas
Dim TIMER1 As Timer
Dim x, y As Float
Dim BALLE_src_rec, BALLE_dst_rec As Rect
Dim PAS As Int
Dim PNG_BALLE As Bitmap
Dim BKGRND As Bitmap
Dim dBKGRND As BitmapDrawable
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
PNG_BALLE.Initialize( File.DirAssets, "balle.png" )
BKGRND.Initialize( File.DirAssets, "fond.jpg" )
dBKGRND.Initialize( BKGRND )
activity.Background = dBKGRND
LAYER.Initialize( activity)
TIMER1.Initialize( "TIMER1", 100 )
TIMER1.Enabled = True
x = 0dip
y = 0dip
PAS = 1dip
End If
BALLE_dst_rec.Initialize( x, y, x+PNG_BALLE.Width, y+PNG_BALLE.Height )
BALLE_src_rec.Initialize( 0, 0, PNG_BALLE.Width, PNG_BALLE.Height )
End Sub
Sub TIMER1_tick
If x < 300dip Then
LAYER.Drawrect( BALLE_dst_rec, Colors.transparent, True, 1dip )
activity.Invalidate2( BALLE_dst_rec )
y = y + 1
BALLE_dst_rec.Initialize( x, y, x+PNG_BALLE.Width, y+PNG_BALLE.Height )
LAYER.DrawBitmap(PNG_BALLE, BALLE_src_rec, BALLE_dst_rec )
Activity.Invalidate2( BALLE_dst_rec )
End If
End Sub