uxn/examples/gui.shapes.usm

59 lines
1.5 KiB
Plaintext
Raw Normal View History

2021-02-21 01:14:36 +00:00
( draw routines )
&Screen { width 2 height 2 pad 4 y 2 x 2 color 1 red 1 green 1 blue 1 }
2021-02-21 01:14:36 +00:00
2021-02-21 21:23:36 +00:00
;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2
2021-02-21 01:14:36 +00:00
|0100 @RESET
2021-02-21 21:23:36 +00:00
#01 =color
2021-02-22 00:52:51 +00:00
#0010 #0020 #0040 #0060 ,fill-rect JSR
2021-02-21 21:23:36 +00:00
#02 =color
2021-02-22 00:52:51 +00:00
#0020 #0030 #0050 #0070 ,fill-rect JSR
2021-02-21 21:23:36 +00:00
#03 =color
2021-02-22 00:52:51 +00:00
#0030 #0040 #0060 #0080 ,fill-rect JSR
2021-02-21 21:23:36 +00:00
#01 =color
2021-02-22 00:52:51 +00:00
#0070 #0020 #00a0 #0060 ,line-rect JSR
2021-02-21 21:23:36 +00:00
#02 =color
2021-02-22 00:52:51 +00:00
#0080 #0030 #00b0 #0070 ,line-rect JSR
2021-02-21 21:23:36 +00:00
#03 =color
2021-02-22 00:52:51 +00:00
#0090 #0040 #00c0 #0080 ,line-rect JSR
2021-02-21 21:23:36 +00:00
2021-02-21 01:14:36 +00:00
BRK
2021-02-21 21:23:36 +00:00
@line-rect ( x1 y1 x2 y2 )
=y2 =x2 ( stash x1 y1 ) DUP2 WSR2 =y1 DUP2 WSR2 =x1
@line-rect-hor
( draw ) ~x1 ~y1 =dev/screen.y =dev/screen.x ~color =dev/screen.color
( draw ) ~x1 ~y2 =dev/screen.y =dev/screen.x ~color =dev/screen.color
2021-02-21 21:23:36 +00:00
( incr ) ~x1 #0001 ADD2 DUP2 =x1
~x2 #0001 ADD2 LTH2 ,line-rect-hor ROT JMP? POP2
( restore x1 y1 ) RSW2 =x1 RSW2 =y1
@line-rect-ver
( incr ) ~y1 #0001 ADD2 DUP2 =y1
( draw ) ~x1 ~y1 =dev/screen.y =dev/screen.x ~color =dev/screen.color
( draw ) ~x2 ~y1 =dev/screen.y =dev/screen.x ~color =dev/screen.color
2021-02-21 21:23:36 +00:00
~y2 #0001 SUB2 LTH2 ,line-rect-ver ROT JMP? POP2
RTS
@fill-rect ( x1 y1 x2 y2 )
=y2 =x2 ( stash x1 y1 ) =y1 DUP2 WSR2 =x1
@fill-rect-ver
RSW2 DUP2 =x1 WSR2
@fill-rect-hor
( draw ) ~x1 ~y1 =dev/screen.y =dev/screen.x ~color =dev/screen.color
2021-02-21 21:23:36 +00:00
( incr ) ~x1 #0001 ADD2 DUP2 =x1
~x2 LTH2 ,fill-rect-hor ROT JMP? POP2
~y1 #0001 ADD2 DUP2 =y1
~y2 LTH2 ,fill-rect-ver ROT JMP? POP2
RSW2 POP2
RTS
2021-02-21 01:14:36 +00:00
|c000 @FRAME BRK
|d000 @ERROR BRK
|FF10 ;dev/screen Screen
2021-02-22 00:52:51 +00:00
|FFF0 [ 0f0f 0fff 0ff0 ] ( palette )
2021-02-21 01:14:36 +00:00
|FFFA .RESET .FRAME .ERROR ( vectors )