commit 8ac7568
Devine Lu Linvega
·
2024-12-30 01:11:55 +0000 UTC
parent 6745e96
Added controller support for screen bounds test
1 files changed,
+26,
-1
+26,
-1
1@@ -2,6 +2,7 @@
2
3 |00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
4 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
5+|80 @Controller &vector $2 &button $1 &key $1
6 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
7
8 |100
9@@ -11,6 +12,7 @@
10 #286c .System/g DEO2
11 #2358 .System/b DEO2
12 ;on-mouse .Mouse/vector DEO2
13+ ;on-button .Controller/vector DEO2
14 ( | draw fills )
15 #0080 .Screen/x DEO2
16 #0080 .Screen/y DEO2
17@@ -24,6 +26,29 @@
18 <draw-portraits>
19 BRK
20
21+@on-button ( -> )
22+ ( | clear foreground )
23+ #0000 DUP2 .Screen/x DEO2
24+ .Screen/y DEO2
25+ #c0 .Screen/pixel DEO
26+ <draw-guide>
27+ .Controller/button DEI
28+ ( | handlers )
29+ DUP #10 AND #00 EQU ?{
30+ ,&y LDR2 #0004 SUB2 ,&y STR2 }
31+ DUP #20 AND #00 EQU ?{
32+ ,&y LDR2 #0004 ADD2 ,&y STR2 }
33+ DUP #40 AND #00 EQU ?{
34+ ,&x LDR2 #0004 SUB2 ,&x STR2 }
35+ DUP #80 AND #00 EQU ?{
36+ ,&x LDR2 #0004 ADD2 ,&x STR2 }
37+ POP
38+ ( | draw )
39+ [ LIT2 &x 0040 ] .Screen/x DEO2
40+ [ LIT2 &y 0040 ] .Screen/y DEO2
41+ <draw-portraits>
42+ BRK
43+
44 @on-mouse ( -> )
45 ( | clear foreground )
46 #0000 DUP2 .Screen/x DEO2
47@@ -41,7 +66,7 @@
48
49 @<draw-portraits> ( -- )
50 [ LIT2 36 -Screen/auto ] DEO
51- .Mouse/state DEI ?<draw-box>
52+ .Mouse/state DEI .Controller/button DEI #0f AND ORA ?<draw-box>
53 ( | top-left )
54 .Screen/x DEI2k #0000 ADD2 ROT DEO2
55 .Screen/y DEI2k #0020 SUB2 ROT DEO2