add cursor
This commit is contained in:
parent
d746ad889d
commit
ddf4abf52e
1 changed files with 40 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
|||
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|
||||
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|
||||
|90 @Mouse/vector $2 &x $2 &y $2 &state $5 &scrolly &scrolly-hb $1 &scrolly-lb $1
|
||||
|
||||
|
||||
|
||||
|58 @canvas-width
|
||||
|
@ -10,16 +12,36 @@
|
|||
(to run debugger: `../uxn/bin/uxnasm one_line_canvas.tal one_line_canvas.rom && ../uxn/bin/uxnemu ../beetbug.rom ./one_line_canvas.rom`)
|
||||
%dbug { #01 .System/debug DEO }
|
||||
%PX { #01 .Screen/pixel DEO }
|
||||
%ADD1 { #01 ADD }
|
||||
|
||||
|0100
|
||||
@on-reset
|
||||
setup-gui
|
||||
#58 #58 #1f draw-h-line
|
||||
#58 #58 #1f #02 MUL draw-h-line
|
||||
#1f #58 #1f draw-v-line
|
||||
#1f #02 #58 MUL #1f draw-v-line
|
||||
( draw canvas bounds )
|
||||
.canvas-width ADD1 .canvas-width ADD1 .canvas-height ADD1 draw-h-line
|
||||
.canvas-width ADD1 .canvas-width ADD1 .canvas-height ADD1 #02 MUL draw-h-line
|
||||
.canvas-height ADD1 .canvas-width ADD1 .canvas-height ADD1 draw-v-line
|
||||
.canvas-height ADD1 .canvas-width ADD1 #02 MUL .canvas-height ADD1 draw-v-line
|
||||
;on-mouse .Mouse/vector DEO2
|
||||
BRK
|
||||
|
||||
@on-mouse ( -> )
|
||||
.Mouse/x DEI2
|
||||
.Mouse/y DEI2
|
||||
draw-cursor
|
||||
BRK
|
||||
|
||||
@draw-cursor ( x* y* )
|
||||
( clear fg )
|
||||
LIT2 0000 .Screen/x DEO2
|
||||
LIT2 0000 .Screen/y DEO2
|
||||
#c0 .Screen/pixel DEO
|
||||
( draw cursor sprite to fg )
|
||||
.Screen/y DEO2 ( x* )
|
||||
.Screen/x DEO2 ( )
|
||||
;cursor-sprite .Screen/addr DEO2
|
||||
#41 .Screen/sprite DEO
|
||||
|
||||
@draw-v-line ( l x y )
|
||||
SWP ( l y x )
|
||||
#00 ( l y x 00 )
|
||||
|
@ -78,3 +100,17 @@
|
|||
#f0d6 .System/g DEO2
|
||||
#f0b2 .System/b DEO2
|
||||
JMP2r
|
||||
|
||||
|
||||
@cursor-sprite
|
||||
20 20 d8 20 20 00 00 00
|
||||
(
|
||||
. . # . . . . . 20
|
||||
. . # . . . . . 20
|
||||
# # . # # . . . d8
|
||||
. . # . . . . . 20
|
||||
. . # . . . . . 20
|
||||
. . . . . . . . 7e
|
||||
. . . . . . . . 3c
|
||||
. . . . . . . . 18
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue