From 7006d8fc7514ae16d7d382805a04fd240c6145c8 Mon Sep 17 00:00:00 2001 From: neauoire Date: Fri, 19 Mar 2021 11:29:46 -0700 Subject: [PATCH] Added zoom --- projects/font.bit | Bin 0 -> 1984 bytes projects/picture.bit | Bin 0 -> 4096 bytes projects/software/noodle.usm | 111 ++++++++++++++++++++++++++++++----- 3 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 projects/font.bit create mode 100644 projects/picture.bit diff --git a/projects/font.bit b/projects/font.bit new file mode 100644 index 0000000000000000000000000000000000000000..f5ba743ef2c872a86b0d4e3d929782d41ee9a611 GIT binary patch literal 1984 zcmYjSe~1)S9RKd_a64SO0GP_r3S| ze!rjZ_kG{IL@J$C&1y^06-b4gpu@215mhpZ(H1zAGe#GpOol=~Y!hRn8){GB)X>K@bH20VIB8jQGAkVo-A-2!e$sMZO>Ue)L%T)K~H^2P1ui zRhR{22pWn(`8I?@oM7Qb1EU*l)81!eUfCRU1f||G%=Bs zbfSnsB9bGeXP~B#6&4^hVj&*joPsAwvPN!HtI5!zBqXFlR47QW_oa)HEH^MOv!22P zSy6w%vifLZqCY9gW!O8Oz~veYku;i{n}a{h$AL>^S(Xh0lI2L2F>jNQP{etc^#tH4 z$;LHC2rA30L`<%E5OUqnbzRg83&J1qV$Dku@Qh7QPm6iE$Qd;{N;#_MNoL&gCMxhV z(8GEzQpiKjd5(D4-QB}E*@zAf!cP2_7{ITnhRB~4i^ZX#V~Fc|UJdyQ79Mb(2Lh-A zJTKKjL^=$$)-U*a}*PM^I) zRP!b#W-Sz`83)kGX1w?*bsyly@a!n@?t8DiQaeMu$wC>05eai9ljofS(HZcO$#N^$ zSlJPULn5wMD`VsJ0UZezu%iQ(A-skh+G-41?q{FEpJjUz2pJcWNhA=#u_&CiQL}^} zYq8)RJC!3k?ztyU949tEbnVpXL9%WR_YYnhL|!|mXJ>bipmFTfF{&4)P{1;AMO%5~ z(wFhZN!Yk^0El(bc;%T7sJwEeb87Af;(x9y&CWWpU*X4U6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R4jw#}UhbWK zno$lVe?$@Q#YVOEZs*<3I^ud0eN5Q>S`YXu3Ty=1$TeJbcS-OAev_;+ z_H>hX(G$63R)%j8mTbTOm1;Fh_kLEs<{#O5#4l>>q9Nb&Z~R&R+cf)*I>G1^SMy0e z$2t9{{pn;nn|qve2A-LYQ~C_Ku9II;lj^5EIwbT*qUkejGZu)CW9;kUI~AmL21HQwT7W^G*E_rJYUZc66#Mt-gQ^Q-fP zG&sKxru)+=?3|4QyYVco5o6R(^F?%wzk&vV4ru1k`YAfZM18czJ4IEBru&>ksjZiVf@rS)Z z1EX!e^gANSAdX5xRbiF^Yg3MHIis%#^EsMlRYfX1|CYsti4K;n16a0wgj-Bv2P z&t=S|G0L|@{cIjbu0XzkFO2B)3s8j%zif02)U&8p!o_@!e}(vt{S#DFRL>tCpCbN& z+95elH)qocD$(|`CPFeu0+TTX-iZ$BIR4wDyCu|(-$wC~I7!{Np$$an!^h7bJb&=? z9~Uuy?m5Xj!5IHt`1|amPNx>w@XyJ?q{kCn7x3dua#>jiZaV9@$uEpS2X2yQmfHE- zKW^W=vz6ulZ5#aUe!~93eKJCnql>>R;G!WM19Q|(8RE;7(4#%gJ^dB+j8!NePEU65 T=Q(^IH;){|JpLTA@r-^4yxzqN literal 0 HcmV?d00001 diff --git a/projects/software/noodle.usm b/projects/software/noodle.usm index a9b2e9c..e50eb3f 100644 --- a/projects/software/noodle.usm +++ b/projects/software/noodle.usm @@ -8,12 +8,12 @@ - Only draw-canvas target tile - Resize buttons - Zoom - - Erase + - Clear all button - Toggle guides - - Set eye option - Complete save/load - Limit size - Draw point inbetween + - Pixel cleanup brush ) %RTN { JMP2r } @@ -27,6 +27,7 @@ ;center { x 2 y 2 } ;toolbar { x1 2 y1 2 x2 2 y2 2 } ;cursor { x 2 y 2 x0 2 y0 2 size 1 patt 1 drag 1 zoom 1 } +;zoom { x 2 y 2 } ;rect { x1 2 y1 2 x2 2 y2 2 } ;color { byte 1 } ;pos { x 2 y 2 } @@ -36,7 +37,7 @@ |0100 @RESET ( load file ) - ( ,filepath ,load-file JSR2 ) + ,filepath ,load-file JSR2 ( find screen center ) ~Screen.width #0002 DIV2 =center.x @@ -46,7 +47,7 @@ ( default brush ) #04 =cursor.size - #0026 =canvas.w #001a =canvas.h ( 380x260 ) + #0020 =canvas.w #0010 =canvas.h ( 380x260 ) ( center canvas ) ~center.x ~canvas.w 8* 2/ SUB2 =canvas.x1 @@ -54,7 +55,7 @@ ,draw-background JSR2 ,fit-canvas JSR2 - + ( fit toolbar ) ~toolbar.x1 #0010 ADD2 =toolbar.x2 ~toolbar.y1 #0040 ADD2 =toolbar.y2 @@ -137,6 +138,24 @@ BRK $no-touch + ,$no-ctrl ~Controller #00 EQU JMP2? + + ,$no-ctrl-up ~Controller #10 EQU JMP2? + ~zoom.y ++ =zoom.y + $no-ctrl-up + ,$no-ctrl-down ~Controller #20 EQU JMP2? + ~zoom.y -- =zoom.y + $no-ctrl-down + ,$no-ctrl-left ~Controller #40 EQU JMP2? + ~zoom.x ++ =zoom.x + $no-ctrl-left + ,$no-ctrl-right ~Controller #80 EQU JMP2? + ~zoom.x -- =zoom.x + $no-ctrl-right + ,draw-canvas JSR2 + + $no-ctrl + ~Mouse.x =cursor.x0 ~Mouse.y =cursor.y0 @@ -148,12 +167,33 @@ BRK RTN +@fit-canvas + + ~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2 + ~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2 + ~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2 + ,draw-canvas JSR2 + +RTN + @paint ( x y ) ,erase ~Mouse.state #10 EQU JMP2? #0003 SUB2 =pos.y #0003 SUB2 =pos.x ( cursor offset ) + ( trim if zoomed ) + ,$no-zoom ~cursor.zoom #01 NEQ JMP2? + ~pos.x 8/ ~zoom.x ADD2 #0003 SUB2 =pos.x + ~pos.y 8/ ~zoom.y ADD2 #0003 SUB2 =pos.y + $no-zoom + + ( center zoom on paint ) + ,$no-follow ~cursor.zoom JMP2? + ~pos.x ~canvas.w 2/ SUB2 #0003 ADD2 =zoom.x + ~pos.y ~canvas.h 2/ SUB2 #0003 ADD2 =zoom.y + $no-follow + #00 =px.x #00 =px.y $ver #00 =px.x @@ -178,6 +218,18 @@ RTN #0003 SUB2 =pos.y #0003 SUB2 =pos.x ( cursor offset ) + ( trim if zoomed ) + ,$no-zoom ~cursor.zoom #01 NEQ JMP2? + ~pos.x 8/ ~zoom.x ADD2 #0003 SUB2 =pos.x + ~pos.y 8/ ~zoom.y ADD2 #0003 SUB2 =pos.y + $no-zoom + + ( center zoom on paint ) + ,$no-follow ~cursor.zoom JMP2? + ~pos.x ~canvas.w 2/ SUB2 #0003 ADD2 =zoom.x + ~pos.y ~canvas.h 2/ SUB2 #0003 ADD2 =zoom.y + $no-follow + #00 =px.x #00 =px.y $ver #00 =px.x @@ -246,6 +298,16 @@ RTN RTN +@get-pixel ( x y ) + + SWP POP #07 AND =px.y + SWP POP #07 AND =px.x + ( get tile ) ~pix.x 8/ ~pix.y 8/ ~canvas.w MUL2 ADD2 8* + ( add addr ) ,data ADD2 + #00 ~px.y ADD2 LDR #07 ~px.x SUB SHR #01 AND + +RTN + @add-pixel ( x y ) =pix.y =pix.x @@ -278,6 +340,8 @@ RTN @draw-canvas + ,draw-canvas-zoom ~cursor.zoom #01 EQU JMP2? + ~canvas.y1 =Sprite.y ,data =Sprite.addr $ver @@ -292,6 +356,26 @@ RTN RTN +@draw-canvas-zoom + + ~zoom.y =pix.y + ~canvas.y1 =Sprite.y + ,data =Sprite.addr + $ver + ~canvas.x1 =Sprite.x + ~zoom.x =pix.x + $hor + ( incr ) ,bigpixel_icn #0008 #00 ~pix.x ~pix.y ,get-pixel JSR2 MUL2 ADD2 =Sprite.addr + ( draw ) #09 =Sprite.color + ( incr ) ~Sprite.x 8+ =Sprite.x + ( incr ) ~pix.x ++ =pix.x + ,$hor ~Sprite.x ~canvas.x2 NEQ2 JMP2? + ( incr ) ~Sprite.y 8+ =Sprite.y + ( incr ) ~pix.y ++ =pix.y + ,$ver ~Sprite.y ~canvas.y2 NEQ2 JMP2? + +RTN + @draw-cursor ~cursor.x ~Mouse.x NEQU2 @@ -415,6 +499,8 @@ RTN RTN +( Generics ) + @line-rect ( x1 y1 x2 y2 color ) ( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 @@ -446,15 +532,6 @@ RTN RTN -@fit-canvas - - ~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2 - ~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2 - ~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2 - ,draw-canvas JSR2 - -RTN - @size_icn [ 0000 0010 0000 0000 ] [ 0000 1038 1000 0000 ] @@ -490,6 +567,10 @@ RTN [ 3048 8484 4834 0200 ] [ 3245 8284 4834 0200 ] +@bigpixel_icn + [ 5580 0080 0080 0080 ] + [ 55ff 7fff 7fff 7fff ] + @brush_pointer [ 80c0 e0f0 f8e0 1000 ] @brush_hand [ 4040 4070 f8f8 f870 ] @@ -500,7 +581,7 @@ RTN @save_icn [ fe82 8282 848a f400 ] @blank_icn [ 0000 0000 0000 0000 ] -@filepath [ noodle-io.bit 00 ] +@filepath [ projects/picture.bit 00 ] @font_hex [