(sliderule) Controls

This commit is contained in:
Devine Lu Linvega 2023-07-05 15:49:28 -07:00
parent 919d9937d1
commit bafd434554
3 changed files with 215 additions and 73 deletions

133
gui/sliderule/assets.tal Normal file
View File

@ -0,0 +1,133 @@
@pointer-icn
[ 80c0 e0f0 f8e0 1000 ]
@num-icn
[
3c66 6e76 6666 3c00 1838 1818 1818 7e00
3c66 060c 1830 7e00 7e0c 180c 0666 3c00
0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00
3c60 607c 6666 3c00 7e06 0c18 3030 3000
3c66 663c 6666 3c00 3c66 663e 060c 3800 ]
@cursor-chr [
0000 0000 037f 7f7f 0000 0003 7fff ffff
0000 0000 ffff ffff 0000 00ff ffff ffff
0000 0000 ffff ffff 0000 00ff ffff ffff
0000 0000 ffff ffff 0000 00ff ffff ffff
0000 0000 ffff ffff 0000 00ff ffff ffff
0000 0000 ffff ffff 0000 00ff ffff ffff
0000 0000 fcff ffff 0000 00fc ffff ffff
0000 0000 00e0 e0e0 0000 0000 e0f0 f0f0
7f60 4040 4040 4040 ffff e0e0 e0e0 e0e0
ff00 0000 0000 0000 ffff 0000 0000 0000
ff00 0000 0000 0000 ffff 0000 0000 0000
ff04 0004 0004 0004 ffff 0400 0000 0000
ff00 0000 0000 0000 ffff 0000 0000 0000
ff00 0000 0000 0000 ffff 0000 0000 0000
ff00 0000 0000 0000 ffff 0000 0000 0000
e060 2020 2020 2020 f0f0 7070 7070 7070
4040 4040 4040 4040 e0e0 e0e0 e0e0 e0e0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0004 0004 0004 0004 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
2020 2020 2020 2020 7070 7070 7070 7070
4040 4040 4040 4040 e0e0 e0e0 e0e0 e0e0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0004 0004 0004 0004 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
2020 2020 2020 2020 7070 7070 7070 7070
4040 4040 4040 4040 e0e0 e0e0 e0e0 e0e0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0004 0004 0004 0004 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
2020 2020 2020 2020 7070 7070 7070 7070
4040 4040 4040 4040 e0e0 e0e0 e0e0 e0e0
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0004 0004 0004 0004 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
2020 2020 2020 2020 7070 7070 7070 7070
4040 4040 4060 7f7f e0e0 e0e0 e0ff ffff
0000 0000 0000 ffff 0000 0000 00ff ffff
0000 0000 0000 ffff 0000 0000 00ff ffff
0004 0004 0004 ffff 0000 0000 04ff ffff
0000 0000 0000 ffff 0000 0000 00ff ffff
0000 0000 0000 ffff 0000 0000 00ff ffff
0000 0000 0000 ffff 0000 0000 00ff ffff
2020 2020 2060 e0e0 7070 7070 70f0 f0f0
7f7f 0300 0000 0000 ffff 7f03 0000 0000
ffff ff00 0000 0000 ffff ffff 0000 0000
ffff ff00 0000 0000 ffff ffff 0000 0000
ffff ff00 0000 0000 ffff ffff 0000 0000
ffff ff00 0000 0000 ffff ffff 0000 0000
ffff ff00 0000 0000 ffff ffff 0000 0000
ffff fc00 0000 0000 ffff fffc 0000 0000
e0e0 0000 0000 0000 f0f0 e000 0000 0000
]
@bg-chr
[
00ff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff ]
@bg-rev-chr
[
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ff00 ffff ffff ffff ffff ]
@cap-chr
[
003f 7f7f 7f7f 7f7f 3f7f ffff ffff ffff
7f7f 7f7f 7f7f 7f7f ffff ffff ffff ffff
7f7f 7f7f 7f7f 3f00 ffff ffff ffff 7f3f ]
@rule-chr
[
7f7f 7f7f 6d6d ff00 ffff ffff ffff ffff
ffff fefe b6b6 ff00 ffff ffff ffff ffff
ffff ffff dbdb ff00 ffff ffff ffff ffff
fdfd fdfd 6d6d ff00 ffff ffff ffff ffff
ffff ffff b6b6 ff00 ffff ffff ffff ffff
ffff fbfb dbdb ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
efef efef adad ff00 ffff ffff ffff ffff
ffff ffff b6b6 ff00 ffff ffff ffff ffff
ffff dfdf dbdb ff00 ffff ffff ffff ffff
fefe fefe 6a6a ff00 ffff ffff ffff ffff
ffff ffff dbdb ff00 ffff ffff ffff ffff
ffff fdfd 6d6d ff00 ffff ffff ffff ffff
ffff ffff b5b5 ff00 ffff ffff ffff ffff
dfdf dfdf 5b5b ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
ffff bfbf b5b5 ff00 ffff ffff ffff ffff
f7f7 f7f7 5656 ff00 ffff ffff ffff ffff
ffff ffff dbdb ff00 ffff ffff ffff ffff
ffff efef 6a6a ff00 ffff ffff ffff ffff
fbfb fbfb abab ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
ffff efef aaaa ff00 ffff ffff ffff ffff
fbfb fbfb abab ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
ffff dfdf 5555 ff00 ffff ffff ffff ffff
f7f7 f7f7 5656 ff00 ffff ffff ffff ffff
ffff ffff d5d5 ff00 ffff ffff ffff ffff
ffff 7f7f 5555 ff00 ffff ffff ffff ffff
dfdf dfdf 5a5a ff00 ffff ffff ffff ffff
ffff fbfb aaaa ff00 ffff ffff ffff ffff
fefe fefe aaaa ff00 ffff ffff ffff ffff
ffff ffff aaaa ff00 ffff ffff ffff ffff
ffff bfbf aaaa ff00 ffff ffff ffff ffff
e0e0 e0e0 a0a0 f000 f0f0 f0f0 f0f0 f0f0 ]

View File

@ -9,16 +9,15 @@
|0000
@cursor &x $2 &y $2
@rods $a $1
@state &c $2 &d $2 &cursor $2
|0100
@on-reset ( -> )
( | theme )
#a10f .System/r DEO2
#a00f .System/g DEO2
#a00f .System/b DEO2
#af0f .System/r DEO2
#a20f .System/g DEO2
#a20f .System/b DEO2
load-theme
( | size )
#0148 .Screen/width DEO2
@ -32,7 +31,34 @@
@|vectors )
@on-mouse ( -> )
BRK
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;pointer-icn <update-pointer>
[ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR
DUP2 #0001 EQU2 ?&down
DUP2 #0101 EQU2 ?&drag
POP2 BRK
&down ( states* -> )
POP2 .Mouse/x DEI2 ,&from STR2
BRK
&drag ( states* -> )
POP2 [ LIT2 &from $2 ] .Mouse/x DEI2 DUP2 ,&from STR2
SWP2 SUB2
@on-drag ( offset* -> )
.Mouse/y DEI2 DUP2 #0020 LTH2 ?&cursor
DUP2 #0038 LTH2 ?&c
DUP2 #0060 LTH2 ?&d
&cursor ( offset* y* -> )
POP2 .state/cursor LDZ2 ADD2 .state/cursor STZ2
<redraw>
BRK
&c ( offset* y* -> )
POP2 .state/c LDZ2 ADD2 .state/c STZ2
<redraw>
BRK
&d ( offset* y* -> )
POP2 .state/d LDZ2 ADD2 .state/d STZ2
<redraw>
BRK
(
@|core )
@ -41,12 +67,27 @@
@|drawing )
@<redraw> ( -- )
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
#80 .Screen/pixel DEO
<draw-c>
<draw-d>
<draw-cursor>
JMP2r
@<draw-cursor> ( -- )
#0050 .state/cursor LDZ2 ADD2 .Screen/x DEO2
#0018 .Screen/y DEO2
#76 .Screen/auto DEO
;cursor-chr .Screen/addr DEO2
#0800
&l ( -- )
#85 .Screen/sprite DEO
INC GTHk ?&l
POP2 JMP2r
@<draw-c> ( -- )
#0020 .Screen/x DEO2
#0020 .state/c LDZ2 ADD2 .Screen/x DEO2
#0020 .Screen/y DEO2
( | cap )
#25 .Screen/auto DEO
@ -55,16 +96,27 @@
<draw-rule>
<draw-rule>
<draw-rule>
( | numbers )
#0024 .state/c LDZ2 ADD2 .Screen/x DEO2
#0028 .Screen/y DEO2
#00 <draw-num>
JMP2r
@<draw-num> ( num -- )
#00 SWP #30 SFT2 ;num-icn ADD2 .Screen/addr DEO2
#0a .Screen/sprite DEO
JMP2r
@<draw-d> ( -- )
#0030 .Screen/x DEO2
#0030 .state/d LDZ2 ADD2 .Screen/x DEO2
#0037 .Screen/y DEO2
( | cap )
#25 .Screen/auto DEO
;cap-chr .Screen/addr DEO2
#85 .Screen/sprite DEO
<draw-rule-rev>
<draw-rule-rev>
<draw-rule-rev>
JMP2r
@<draw-rule> ( -- )
@ -102,6 +154,27 @@
( adjust ) .Screen/x DEI2k #0005 SUB2 ROT DEO2
JMP2r
@<update-pointer> ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
#40 <draw-pointer>
.Mouse/x DEI2 ,<draw-pointer>/x STR2
.Mouse/y DEI2 ,<draw-pointer>/y STR2
.Screen/addr DEO2
@<draw-pointer> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
@<phex> ( short* -- )
SWP <phex>/b
&b ( -- )
DUP #04 SFT <phex>/c
&c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD #18 DEO
JMP2r
(
@|utils )
@ -124,69 +197,5 @@
(
@|spritesheet )
@cursor-icn
[ 80c0 e0f0 f8e0 1000 ]
@num-icn
[
3c66 6e76 6666 3c00 1838 1818 1818 7e00
3c66 060c 1830 7e00 7e0c 180c 0666 3c00
0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00
3c60 607c 6666 3c00 7e06 0c18 3030 3000
3c66 663c 6666 3c00 3c66 663e 060c 3800 ]
@bg-chr
[
00ff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff ffff ffff ffff ffff ]
@bg-rev-chr
[
ffff ffff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ff00 ffff ffff ffff ffff ]
@cap-chr
[
003f 7f7f 7f7f 7f7f 3f7f ffff ffff ffff
7f7f 7f7f 7f7f 7f7f ffff ffff ffff ffff
7f7f 7f7f 7f7f 3f00 ffff ffff ffff 7f3f ]
@rule-chr
[
7f7f 7f7f 6d6d ff00 ffff ffff ffff ffff
ffff fefe b6b6 ff00 ffff ffff ffff ffff
ffff ffff dbdb ff00 ffff ffff ffff ffff
fdfd fdfd 6d6d ff00 ffff ffff ffff ffff
ffff ffff b6b6 ff00 ffff ffff ffff ffff
ffff fbfb dbdb ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
efef efef adad ff00 ffff ffff ffff ffff
ffff ffff b6b6 ff00 ffff ffff ffff ffff
ffff dfdf dbdb ff00 ffff ffff ffff ffff
fefe fefe 6a6a ff00 ffff ffff ffff ffff
ffff ffff dbdb ff00 ffff ffff ffff ffff
ffff fdfd 6d6d ff00 ffff ffff ffff ffff
ffff ffff b5b5 ff00 ffff ffff ffff ffff
dfdf dfdf 5b5b ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
ffff bfbf b5b5 ff00 ffff ffff ffff ffff
f7f7 f7f7 5656 ff00 ffff ffff ffff ffff
ffff ffff dbdb ff00 ffff ffff ffff ffff
ffff efef 6a6a ff00 ffff ffff ffff ffff
fbfb fbfb abab ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
ffff efef aaaa ff00 ffff ffff ffff ffff
fbfb fbfb abab ff00 ffff ffff ffff ffff
ffff ffff 6d6d ff00 ffff ffff ffff ffff
ffff dfdf 5555 ff00 ffff ffff ffff ffff
f7f7 f7f7 5656 ff00 ffff ffff ffff ffff
ffff ffff d5d5 ff00 ffff ffff ffff ffff
ffff 7f7f 5555 ff00 ffff ffff ffff ffff
dfdf dfdf 5a5a ff00 ffff ffff ffff ffff
ffff fbfb aaaa ff00 ffff ffff ffff ffff
fefe fefe aaaa ff00 ffff ffff ffff ffff
ffff ffff aaaa ff00 ffff ffff ffff ffff
ffff bfbf aaaa ff00 ffff ffff ffff ffff
e0e0 e0e0 a0a0 f000 f0f0 f0f0 f0f0 f0f0 ]
~assets.tal

Binary file not shown.