Code: Select all
Screenres 800,600,32,2
Screenset 1.0
Dim As Integer i, frames, fps
Dim As Double t
Dim As Uinteger Ptr Background
Background = Imagecreate (800,600, RGBA (64,128, 250, 255))
Dim As Uinteger xspr = 32, yspr = 250 'coordinates of the initial location of the sprite
Dim As Uinteger xspr2 = 64, yspr2 = 100
Dim As Uinteger Ptr MyImage 'Created a pointer to sprite1
Dim As Uinteger Ptr MyImage2 'Created a pointer to sprite2
MyImage = Imagecreate (64,64, RGBA (255, 0, 255, 0)) 'passed to the pointer the address of the created buffer, the buffer is filled with pink
Circle MyImage, (31, 31), 30, RGB (255, 255, 0),,, 1, f 'placed a yellow circle in the buffer
MyImage2 = Imagecreate (64,128, RGBA (255, 0, 255, 0))
Line MyImage2, (0, 0) -Step (63, 127), RGB (200, 255, 0), BF 'draw a light green rectangle
Do
Put (0,0), Background, Pset
Put (xspr, yspr), MyImage, Trans
xspr = xspr + 3: If (xspr> 735) Then xspr = 0
Put (xspr2, yspr2), MyImage2, Trans
xspr2 = xspr2 + 3: If (xspr2> 671) Then xspr2 = 0
Put (400,450), MyImage2, Pset 'we can place still pictures on the screen
Put (25,450), MyImage, Trans
Locate 1,85
Print "fps:" & fps,
If Int (t) <> Int (Timer) Then
t = Timer
fps = frames
frames = 0
End If
frames + = 1
ScreenSync 'Waiting for vertical sync
Flip 'switch the page
Loop While Inkey = "" 'exit the loop when any key is pressed
While Inkey <> "": Wend 'Flush the Inkey buffer
Imagedestroy (MyImage) 'deleted the buffer we created
Imagedestroy (MyImage2)
Imagedestroy (Background)
sleep
end