(lander) Circle drawing

This commit is contained in:
Devine Lu Linvega 2023-06-10 09:56:32 -07:00
parent 91f6a509b0
commit fe8da50ca7
1 changed files with 47 additions and 15 deletions

View File

@ -10,8 +10,8 @@
|0100 ( -> )
( theme )
#0f0f .System/r DEO2
#0f0f .System/g DEO2
#0f00 .System/r DEO2
#0fff .System/g DEO2
#0f0f .System/b DEO2
( resize )
#0190 .Screen/width DEO2
@ -27,7 +27,15 @@ BRK
@on-control ( -> )
.Controller/button DEI phex/b #0a18 DEO
.Controller/button DEI
DUP #10 NEQ ?&no-u
redraw
&no-u
DUP #20 NEQ ?&no-d
redraw
&no-d
POP
BRK
@ -40,23 +48,47 @@ BRK
DUP2 .Screen/x DEO2
.Screen/y DEO2
#80 .Screen/pixel DEO
draw-lander
[ LIT &o $1 ] draw-lander
JMP2r
@draw-lander ( -- )
@draw-lander ( orientation -- )
#4000
POP
#0010 #0000
&l
#00 OVR ;sin32 ADD2 LDA2
#00 SWP #01 SFT2 .Screen/y DEO2
#00 SWP #01 SFT2 .Screen/x DEO2
#01 .Screen/pixel DEO
INC INC GTHk ?&l
DUP2 draw-circle
INC2 GTH2k ?&l
POP2 POP2
JMP2r
@draw-circle ( radius* -- )
;get-point/radius STA2
#2000
&l
STHk
INCk get-point
STHr get-point
#01 draw-line
INC GTHk ?&l
POP2
JMP2r
@get-point ( id -- x* y* )
[ LIT2r &radius $2 ]
#1f AND DUP ADD
#00 SWP ;circle-tbl ADD2 LDA2
#00 SWP STH2kr MUL2 #04 SFT2
ROT
#00 SWP STH2r MUL2 #04 SFT2
SWP2
JMP2r
@draw-line ( x1* y1* x2* y2* color -- )
,&color STR
@ -101,7 +133,7 @@ JMP2r
&c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
JMP2r
@sin32 [
@circle-tbl [
8000 9802 b009 c715 da25 ea38 f64f fd67
ff80 fd98 f6b0 eac7 dada c7ea b0f6 98fd
80ff 67fd 4ff6 38ea 25da 15c7 09b0 0298