~rabbits/nasu

0ab2dd651c1354e382f7523c8dc9063e059251b5 — neauoire 1 year, 1 month ago 3b1e10f
Changed UX for zoom tool
2 files changed, 32 insertions(+), 41 deletions(-)

M src/assets.tal
M src/main.tal
M src/assets.tal => src/assets.tal +1 -0
@@ 1,5 1,6 @@
@tool-brush    e0d0 8844 2212 0c00
@tool-selector 80c0 e0f0 f8e0 1000
@tool-zoom     3048 8484 4834 0200
@pixel-icn     7cfe fefe fefe 7c00
@bigpixel-icn  f0f0 f0f0 0000 0000
@halftone-icn  aa55 aa55 aa55 aa55

M src/main.tal => src/main.tal +31 -41
@@ 222,6 222,7 @@ BRK
		[ LIT '4 ] !~ ,&no-4 JCN #03 ;set-color JSR2 &no-4
		[ LIT 'q ] !~ ,&no-tool0 JCN #00 ;set-tool JSR2 &no-tool0
		[ LIT 'w ] !~ ,&no-tool1 JCN #01 ;set-tool JSR2 &no-tool1
		[ LIT 'e ] !~ ,&no-tool2 JCN #02 ;set-tool JSR2 &no-tool2
		[ #08 ] !~ ,&no-delete JCN ;op-erase ;run-selection JSR2 SET-STATE ;redraw JSR2 &no-delete
		[ #20 ] !~ ,&no-zoom JCN ;toggle-zoom JSR2 &no-zoom
		[ #1b ] !~ ,&no-escape JCN RESET-SELECTION ;redraw JSR2 &no-escape


@@ 283,39 284,39 @@ BRK

@on-touch-tileview ( -> )

	.settings/tool LDZ #02 = ;&zoom JCN2
	.settings/zoom LDZ #01 = ;&zoomed JCN2
	.settings/tool LDZ #01 = ;&select JCN2

	( paint )
	.Mouse/x DEI2 .tileview/x1 LDZ2 --
	.Mouse/y DEI2 .tileview/y1 LDZ2 --
	.settings/color LDZ .Mouse/state DEI #01 = * 
		;put-pixel JSR2
	SET-STATE
	;redraw JSR2

	.settings/tool LDZ .Mouse/state DEI
	DUP2 #0001 !! ,&no-brush-mouse1 JCN ( brush default )
		POP2
		.settings/color LDZ ;put-pixel JSR2
		SET-STATE
		;redraw JSR2
		BRK &no-brush-mouse1
	DUP2 #0010 !! ,&no-brush-mouse2 JCN ( brush erase )
		POP2
		#00 ;put-pixel JSR2
		SET-STATE
		;redraw JSR2
		BRK &no-brush-mouse2
	DUP2 #0101 !! ,&no-select-mouse1 JCN ( select default )
		POP2
		;set-focus JSR2
	BRK

	&zoom ( -> )

		.Mouse/x DEI2 .tileview/x1 LDZ2 -- 8// NIP
		.Mouse/y DEI2 .tileview/y1 LDZ2 -- 8// NIP
			;set-focus JSR2
		;toggle-zoom JSR2
		;redraw JSR2
		BRK &no-select-mouse1
	DUP2 #0110 !! ,&no-select-mouse2 JCN ( select copy )
		POP2
		;get-tile-addr JSR2 .settings/focus LDZ2 SWP2 ;copy-tile JSR2
		RELEASE-MOUSE

	BRK

	&zoomed ( -> )

		.Mouse/x DEI2 .tileview/x1 LDZ2 -- 8//
		.Mouse/y DEI2 .tileview/y1 LDZ2 -- 8//
		GET-POSITION ADD-POSITIONS
		.settings/color LDZ .Mouse/state DEI #01 = * ;put-pixel JSR2
		SET-STATE
		;redraw JSR2
		BRK &no-select-mouse2
	POP2

	POP2 POP2

	BRK



@@ 337,17 338,6 @@ BRK
		POP2
		.cursor/last STZ

	BRK

	&zoomed ( -> )

		.Mouse/x DEI2 .tileview/x1 LDZ2 -- 8//
		.Mouse/y DEI2 .tileview/y1 LDZ2 -- 8//
		GET-POSITION ADD-POSITIONS
		.settings/color LDZ .Mouse/state DEI #01 = * ;put-pixel JSR2
		SET-STATE
		;redraw JSR2

BRK

@on-touch-nametable ( -> )


@@ 378,9 368,9 @@ BRK
	[ #1f ] !~ ,&no-save JCN ;save-file JSR2 POP BRK &no-save
	[ #1d ] !~ ,&no-load JCN ;load-file JSR2 POP BRK &no-load
	[ #1c ] !~ ,&no-name JCN ;new-file JSR2 POP BRK &no-name
	[ #04 ] !~ ,&no-brush JCN #00 ;set-tool JSR2 POP BRK &no-brush
	[ #05 ] !~ ,&no-selector JCN #01 ;set-tool JSR2 POP BRK &no-selector
	[ #06 ] !~ ,&no-zoom JCN ;toggle-zoom JSR2 &no-zoom
	[ #04 ] !~ ,&no-tool0 JCN #00 ;set-tool JSR2 POP BRK &no-tool0
	[ #05 ] !~ ,&no-tool1 JCN #01 ;set-tool JSR2 POP BRK &no-tool1
	[ #06 ] !~ ,&no-tool2 JCN #02 ;set-tool JSR2 &no-tool2
	INCk .settings/color LDZ ! ,&no-eraser JCN #00 ;set-color JSR2 POP BRK &no-eraser
	[ #02 ] >~ ,&no-color JCN INCk ;set-color JSR2 POP BRK &no-color
	[ #08 ] <~ ,&no-rename JCN ;trap JSR2 POP BRK &no-rename


@@ 1072,13 1062,13 @@ RTN
	( tools )
	STH2kr #0020 ++ .Screen/x DEO2
	;tool-brush .Screen/addr DEO2
	#01 .settings/tool LDZ #00 = + .Screen/sprite DEO
	#01 [ .settings/tool LDZ #00 = ] + .Screen/sprite DEO
	STH2kr #0029 ++ .Screen/x DEO2
	;tool-selector .Screen/addr DEO2
	#01 .settings/tool LDZ #01 = + .Screen/sprite DEO
	#01 [ .settings/tool LDZ #01 = ] + .Screen/sprite DEO
	STH2r #0030 ++ .Screen/x DEO2
	;zoom-icns [ .settings/zoom LDZ TOS 8** ++ ] .Screen/addr DEO2
	#01 .settings/zoom LDZ + .Screen/sprite DEO
	#01 [ .settings/tool LDZ #02 = ] + .Screen/sprite DEO
	( file i/o )
	;draw-state JSR2
	.toolview/x2 LDZ2 STH2k #0018 -- .Screen/x DEO2