~rabbits/oekaki

71cb3be96d9167ca276dd67f8d68aeed47666df9 — neauoire 8 months ago 8cd5f90
Drag canvas is working, missing brush picking
1 files changed, 19 insertions(+), 8 deletions(-)

M src/oekaki.tal
M src/oekaki.tal => src/oekaki.tal +19 -8
@@ 213,13 213,16 @@
		.Mouse/y DEI2 ,&y STR2
		( set origin ) JMP2r
	&up ( -- )
		( origin )
		( move pixels ) JMP2r
		( x ) .Mouse/x DEI2 ,&x LDR2 SUB2
		( y ) .Mouse/y DEI2 ,&y LDR2 SUB2 !<redraw-all>
	&drag ( -- )
		( x ) .Mouse/x DEI2 [ LIT2 &x $2 ] SUB2
		( y ) .Mouse/y DEI2 [ LIT2 &y $2 ] SUB2
		<draw-pict>
		JMP2r
		.Mouse/x DEI2
		( ) DUP2 [ LIT2 &x $2 ] SUB2 .canvas/x LDZ2 ADD2 .canvas/x STZ2
		( ) ,&x STR2
		.Mouse/y DEI2
		( ) DUP2 [ LIT2 &y $2 ] SUB2 .canvas/y LDZ2 ADD2 .canvas/y STZ2
		( ) ,&y STR2
		!<redraw-all>

(
@|brush )


@@ 413,6 416,9 @@
@<make-file> ( -- )
	;pict .canvas/length LDZ2 mclr !<redraw-all>

@<paste-file> ( -- )
	JMP2r

@<save-file> ( name* -- )
	;dict/save <pstr>
	DUP2 <pstr>


@@ 525,10 531,15 @@
@|drawing )

@<center> ( -- )
	!<redraw-all>
	.canvas/width LDZ2 .Screen/width DEI2 SUB2 .canvas/x STZ2
	.canvas/height LDZ2 .Screen/height DEI2 SUB2 .canvas/y STZ2
	( >> )

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

@<draw-pict> ( x* y* -- )
	.Screen/y DEO2