Fixed drag example

This commit is contained in:
neauoire 2021-02-16 21:36:51 -08:00
parent 12e86b20ca
commit ef85f4e8d8
1 changed files with 20 additions and 27 deletions

View File

@ -11,8 +11,9 @@
#05 =dev/r ( set dev/read mouse ) #05 =dev/r ( set dev/read mouse )
#01 =dev/w ( set dev/write to screen ) #01 =dev/w ( set dev/write to screen )
#02 =color #02 =color ( starting color )
#0050 =w #0080 =h ,update JSR #0050 =w #0080 =h ( starting size )
,update JSR
BRK BRK
@ -26,21 +27,18 @@ BRK
@on-touch @on-touch
#01 =down #01 =down
#01 =color #03 =color
#00 IOR2 =touchx #02 IOR2 =touchy #00 IOR2 =touchx #02 IOR2 =touchy
,update JSR ,update JSR
BRK BRK
@on-release @on-release
#00 =down #00 =down
#02 =color #01 =color
,update JSR ,update JSR
BRK BRK
@on-drag @on-drag
( clear last rect )
#00 =color
~x ~y ~w ~h ,fillrect JSR
#00 IOR2 ~touchx SUBS2 ~x ADDS2 =x #00 IOR2 ~touchx SUBS2 ~x ADDS2 =x
#02 IOR2 ~touchy SUBS2 ~y ADDS2 =y #02 IOR2 ~touchy SUBS2 ~y ADDS2 =y
#00 IOR2 =touchx #02 IOR2 =touchy #00 IOR2 =touchx #02 IOR2 =touchy
@ -48,14 +46,9 @@ BRK
BRK BRK
@update @update
( draw ) ~x ~y ~w ~h ,linerect JSR
( draw new rect ) ( draw ) #0000 ,rounds_chr ~x #0010 ADD2 ~y #0010 ADD2 ,drawsprite JSR
#03 =color ( draw ) #0100 ,eyeeye_chr ~x #0040 ADD2 ~y #0020 ADD2 ,drawsprite JSR
~x ~y ~w ~h ,linerect JSR
#0000 ,rounds_chr ~x #0010 ADD2 ~y #0010 ADD2 ,drawsprite JSR
#0100 ,eyeeye_chr ~x #0040 ADD2 ~y #0020 ADD2 ,drawsprite JSR
,redraw JSR ,redraw JSR
BRK BRK
@ -82,18 +75,18 @@ BRK
RTS RTS
@linerect @linerect
,h STR2 ,w STR2 ,y STR2 ,x STR2 =h =w =y =x
,x LDR2 ,drawx STR2 ,y LDR2 ,drawy STR2 ~x =drawx ~y =drawy
@linerectcol @linerectcol
( draw ) ,x LDR2 ,drawy LDR2 ,putpixel JSR ( draw ) ~x ~drawy ,putpixel JSR
( draw ) ,x LDR2 ,w LDR2 ADD2 ,drawy LDR2 ,putpixel JSR ( draw ) ~x ~w ADD2 ~drawy ,putpixel JSR
,drawy LDR2 #0001 ADD2 ,drawy STR2 ~drawy #0001 ADD2 =drawy
,drawy LDR2 ,h LDR2 ,y LDR2 ADD2 LTH2 ,linerectcol ROT JMP? POP2 ~drawy ~h ~y ADD2 LTH2 ,linerectcol ROT JMP? POP2
@linerectrow @linerectrow
( draw ) ,drawx LDR2 ,y LDR2 ,putpixel JSR ( draw ) ~drawx ~y ,putpixel JSR
( draw ) ,drawx LDR2 ,y LDR2 ,h LDR2 ADD2 ,putpixel JSR ( draw ) ~drawx ~y ~h ADD2 ,putpixel JSR
,drawx LDR2 #0001 ADD2 ,drawx STR2 ~drawx #0001 ADD2 =drawx
,drawx LDR2 ,w LDR2 ,x LDR2 ADD2 #0001 ADD2 LTH2 ,linerectrow ROT JMP? POP2 ~drawx ~w ~x ADD2 #0001 ADD2 LTH2 ,linerectrow ROT JMP? POP2
RTS RTS
@getmouse @getmouse