Add examples/experimental_sdl/sdl_bounce.claro from Claro v1.17.26 zip
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
# SDL 1.2 demo: bouncing square
|
||||||
|
# Build Claro with -DCLARO_WITH_SDL12=1 and SDL 1.2 libs.
|
||||||
|
|
||||||
|
SDL OPEN 640 480 "Claro SDL1.2 Demo"
|
||||||
|
|
||||||
|
SET x TO 100
|
||||||
|
SET y TO 100
|
||||||
|
SET vx TO 3
|
||||||
|
SET vy TO 2
|
||||||
|
|
||||||
|
SET running TO YES
|
||||||
|
|
||||||
|
FOR frame FROM 1 TO 1000000
|
||||||
|
SDL POLL
|
||||||
|
IF SDLEVENT = "QUIT"
|
||||||
|
SET running TO NO
|
||||||
|
ENDIF
|
||||||
|
IF running = NO
|
||||||
|
RAISE "quit"
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
SET x TO x + vx
|
||||||
|
SET y TO y + vy
|
||||||
|
|
||||||
|
IF (x < 0) OR (x > 600)
|
||||||
|
SET vx TO 0 - vx
|
||||||
|
ENDIF
|
||||||
|
IF (y < 0) OR (y > 440)
|
||||||
|
SET vy TO 0 - vy
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
SDL CLEAR 20 20 30
|
||||||
|
SDL RECT x y 40 40 200 220 255
|
||||||
|
SDL PRESENT
|
||||||
|
SDL DELAY 16
|
||||||
|
DONE
|
||||||
Reference in New Issue
Block a user