~rabbits/oekaki

8540faff4d330845b0e28be679ea790c90d1ed2e — neauoire 6 months ago 71cb3be
Relative positions for all tools
1 files changed, 28 insertions(+), 15 deletions(-)

M src/oekaki.tal
M src/oekaki.tal => src/oekaki.tal +28 -15
@@ 131,7 131,7 @@

@<toggle-menu> ( -- )
	.menu/hide LDZk #00 EQU SWP STZ
	!<draw-menu>
	!<redraw-all>

@<toggle-blend> ( -- )
	.brush/blend LDZ #00 EQU !<set-blend>


@@ 155,20 155,21 @@
		JMP2r
	&down ( -- )
		.Controller/button DEI #04 AND ?&down-shift
		.Mouse/x DEI2 #0003 SUB2 ,&last-x STR2
		.Mouse/y DEI2 #0003 SUB2 ,&last-y STR2
		get-touch-x #0003 SUB2 ,&last-x STR2
		get-touch-y #0003 SUB2 ,&last-y STR2
		JMP2r
	&down-shift ( -- )
		( ) ,&last-x LDR2 ,&last-y LDR2
		( ) .Mouse/x DEI2 #0003 SUB2 .Mouse/y DEI2 #0003 SUB2 ;<paint-dot> <do-line>
		( ) get-touch-x #0003 SUB2
		( ) get-touch-y #0003 SUB2 ;<paint-dot> <do-line>
		<release-mouse>
		JMP2r
	&up ( -- )
		JMP2r
	&drag ( -- )
		[ LIT2 &last-x $2 ] [ LIT2 &last-y $2 ]
		( ) .Mouse/x DEI2 #0003 SUB2 DUP2 ,&last-x STR2
		( ) .Mouse/y DEI2 #0003 SUB2 DUP2 ,&last-y STR2
		( ) get-touch-x #0003 SUB2 DUP2 ,&last-x STR2
		( ) get-touch-y #0003 SUB2 DUP2 ,&last-y STR2
		( ) ;<paint-dot> <do-line>
		JMP2r



@@ 178,11 179,14 @@
	&down ( -- )
		.Mouse/x DEI2 ,&x STR2
		.Mouse/y DEI2 ,&y STR2
		get-touch-x #0003 SUB2 ,&real-x STR2
		get-touch-y #0003 SUB2 ,&real-y STR2
		JMP2r
	&up ( -- )
		<clear-guide>
		( ) ,&x LDR2 #0003 SUB2 ,&y LDR2 #0003 SUB2
		( ) .Mouse/x DEI2 #0003 SUB2 .Mouse/y DEI2 #0003 SUB2 ;<paint-dot> !<do-line>
		( ) [ LIT2 &real-x $2 ] [ LIT2 &real-y $2 ]
		( ) get-touch-x #0003 SUB2
		( ) get-touch-y #0003 SUB2 ;<paint-dot> !<do-line>
	&drag ( -- )
		<clear-guide>
		( ) [ LIT2 &x $2 ] [ LIT2 &y $2 ]


@@ 195,11 199,13 @@
	&down ( -- )
		.Mouse/x DEI2 ,&x STR2
		.Mouse/y DEI2 ,&y STR2
		get-touch-x ,&real-x STR2
		get-touch-y ,&real-y STR2
		JMP2r
	&up ( -- )
		<clear-guide>
		( ) ,&x LDR2 ,&y LDR2
		( ) .Mouse/x DEI2 .Mouse/y DEI2 !<paint-rect>
		( ) [ LIT2 &real-x $2 ] [ LIT2 &real-y $2 ]
		( ) get-touch-x get-touch-y !<paint-rect>
	&drag ( -- )
		<clear-guide>
		( ) [ LIT2 &x $2 ] [ LIT2 &y $2 ]


@@ 223,10 229,16 @@
		( ) DUP2 [ LIT2 &y $2 ] SUB2 .canvas/y LDZ2 ADD2 .canvas/y STZ2
		( ) ,&y STR2
		!<redraw-all>

	
(
@|brush )

@get-touch-x ( -- x* )
	.Mouse/x DEI2 .canvas/x LDZ2 SUB2 JMP2r

@get-touch-y ( -- y* )
	.Mouse/y DEI2 .canvas/y LDZ2 SUB2 JMP2r

@get-brush-shape ( -- addr* )
	;shapes-icns [ LIT2 00 -brush/shape ] LDZ #30 SFT2 ADD2 JMP2r



@@ 317,7 329,7 @@
	JMP2r
	&outside ( `color* -- )
		POP2r JMP2r

	
(
@|filters )



@@ 536,7 548,8 @@
	( >> )

@<redraw-all> ( -- )
	#0000 DUP2 .Screen/y DEO2 .Screen/x DEO2
	#0000 DUP2 .Screen/y DEO2
	.Screen/x DEO2
	#83 .Screen/pixel DEO
	.canvas/x LDZ2 .canvas/y LDZ2
	( >> )


@@ 601,8 614,8 @@
		OVR2 #0010 GTH2 ?{ <hide-menu> }
		}
	get-tile-addr .Screen/addr DEO2
	#33 SFT2 .Screen/y DEO2
	#33 SFT2 .Screen/x DEO2
	#33 SFT2 .canvas/y LDZ2 ADD2 .Screen/y DEO2
	#33 SFT2 .canvas/x LDZ2 ADD2 .Screen/x DEO2
	[ LIT2 81 -Screen/sprite ] DEO
	JMP2r