Croissant Runtime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
crsn/examples/mouse.csn

42 lines
817 B

(
(sc-init 800 600)
(sym x r6)
(sym y r7)
(def BOXSIZE 7)
(:loop)
(sc-poll)
(sc-blit 0)
(sc-mouse x y (ov? (j :next)))
(sc-mbtn _ 1 (nz? (sc-erase) (sc-blit 1)))
(sc-mbtn _ 0 (z? (j :next)))
(call draw_box x y)
(:next)
(uslp 500)
(j :loop)
(proc draw_box x y
(sym vx r0)
(sym vy r1)
(sym endx r2)
(sym endy r3)
(add endx x BOXSIZE)
(add endy y BOXSIZE)
(sub vy y BOXSIZE)
(:nextline)
(cmp vy endy (eq? (ret)))
(sub vx x BOXSIZE)
(:nextpx)
(sc-px vx vy 0xffffff)
(inc vx)
(cmp vx endx
(eq? (inc vy)(j :nextline)))
(j :nextpx)
)
)