start program without spawning thread so screen works on mac. improve mouse demo

This commit is contained in:
2020-10-06 12:28:49 +02:00
parent f4ced467e4
commit 2fa23dbbc3
3 changed files with 27 additions and 24 deletions
+21 -19
View File
@@ -1,18 +1,25 @@
(
(sc-init 640 480)
(sc-init 800 600)
(sym x r6)
(sym y r7)
(def BOXSIZE 10)
(def BOXSIZE 7)
(:loop)
(sc-poll)
(sc-mouse x y
(ov? (j :next)))
(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)))
(sc-mbtn r0 0 (z? (j :next)))
(call draw_box x y)
(:next)
(sleep 500)
(j :loop)
(proc draw_box x y
(sym vx r0)
(sym vy r1)
(sym endx r2)
@@ -20,21 +27,16 @@
(add endx x BOXSIZE)
(add endy y BOXSIZE)
(sub vy y BOXSIZE)
(:nextline)
(cmp vy endy (eq? (j :endbox)))
(sub vx x BOXSIZE)
(:nextpx)
(sc-px vx vy 0xffffff)
(inc vx)
(cmp vx endx
(eq? (inc vy)(j :nextline)))
(j :nextpx)
(:endbox)
(:next)
(sleep 20000)
(j :loop)
(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)
)
)