~rabbits/nasu

cebaa6f190014b7a6e76ea3803128192163b1441 — neauoire 1 year, 9 months ago 4efbe19
Progress on toolbar
1 files changed, 74 insertions(+), 26 deletions(-)

M nasu.usm
M nasu.usm => nasu.usm +74 -26
@@ 10,13 10,15 @@
	TODO:
		Copy in 2 bits mode, copies 2 tiles
		Save/load/rename
		Select paint color for 2-bit mode
		Inject a new tile at location
		Delete tile at location
		Tile Modifiers
		Zoom
		Brushes
		Resize buttons
		Move focus with arrows
		Select focus
		Display tile preview view
)

%+  { ADD } %-   { SUB }  %*  { MUL } %/   { DIV }


@@ 85,7 87,8 @@
	&tile $2 
	&ratio $1
	&selection $1
	&tool $1 ]
	&tool $1
	&focus $2 ]

@frame [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &width $2 &height $2 ]



@@ 127,6 130,7 @@
	#01 .settings/depth STZ
	#01 .settings/blending STZ
	#01 .settings/color STZ
	#01 .settings/tool STZ

	.Screen/width DEI2 #0001 SFT2 .frame/width LDZ2 #0001 SFT2 --
	.Screen/height DEI2 #0001 SFT2 .frame/height LDZ2 #0001 SFT2 --


@@ 244,7 248,6 @@ BRK
	.Mouse/y DEI2 DUP2 .toolview/y1 LDZ2 >> ROT ROT .toolview/y2 LDZ2 << #0101 ==
	#0101 == ;on-touch-toolview JCN2


	( dataview )
	.Mouse/x DEI2 DUP2 .dataview/x1 LDZ2 >> ROT ROT .dataview/x2 LDZ2 << #0101 ==
	.Mouse/y DEI2 DUP2 .dataview/y1 LDZ2 >> ROT ROT .dataview/y2 LDZ2 << #0101 ==


@@ 271,20 274,42 @@ BRK
	
	.Mouse/x DEI2 .tileview/x1 LDZ2 -- 
	.Mouse/y DEI2 .tileview/y1 LDZ2 -- 
	.settings/color LDZ
	;put-pixel JSR2
	;draw-tileview JSR2

	.settings/tool LDZ
	DUP #00 ! ,&no-brush JCN
		POP
		.settings/color LDZ
		;put-pixel JSR2
		;draw-tileview JSR2 
		BRK &no-brush
	DUP #01 ! ,&no-selector JCN
		POP
		;get-tile-addr JSR2 .settings/focus STZ2
		;draw-blendview JSR2
		;draw-dataview JSR2
		;draw-preview JSR2 
		BRK &no-selector
	POP
	POP2 POP2

BRK

@on-touch-toolview ( -> )
	
	.Mouse/x DEI2 .toolview/x1 LDZ2 -- #0008 // TOB
	
	DUP #02 > ,&no-color JCN
		DUP #01 + .settings/color STZ
		;draw-toolview JSR2
		#00 .settings/tool STZ
		;draw-toolview JSR2 POP BRK
		&no-color
	DUP #06 > ,&no-tool JCN
		DUP #03 = ,&end JCN
		DUP #04 - .settings/tool STZ
		;draw-toolview JSR2 POP BRK
		&no-tool
	POP
	&end
	( release ) #00 .Mouse/state DEO

BRK


@@ 506,13 531,20 @@ RTN

RTN

@get-tile-addr ( x* y* -- addr* )
	
	STEP8 WIDTH ** #0004 // SWP2
	STEP8 #0002 ** ++
	BANK ++

RTN

@draw-toolview ( -- )
		
	.toolview/y1 LDZ2 .Screen/y DEO2
	.toolview/x1 LDZ2 .Screen/x DEO2

	( colors )

	;circle-icns [ .settings/color LDZ #01 = TOS #0008 ** ] ++ .Screen/addr DEO2
	#21 .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2


@@ 522,15 554,30 @@ RTN
	;circle-icns [ .settings/color LDZ #03 = TOS #0008 ** ] ++ .Screen/addr DEO2
	#23 .Screen/color DEO

	( tools )
	.Screen/x DEI2 #0010 ++ .Screen/x DEO2
	;tool_selector .Screen/addr DEO2
	;brush-icn .Screen/addr DEO2
	#21 .settings/tool LDZ #00 = + .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;tool_hand .Screen/addr DEO2
	;tool_selector .Screen/addr DEO2
	#21 .settings/tool LDZ #01 = + .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;tool_eraser .Screen/addr DEO2
	;tool_hand .Screen/addr DEO2
	#21 .settings/tool LDZ #02 = + .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;tool_eraser .Screen/addr DEO2
	#21 .settings/tool LDZ #03 = + .Screen/color DEO

	( misc )
	.Screen/x DEI2 #0010 ++ .Screen/x DEO2
	;zoom-icns .Screen/addr DEO2
	#23 .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;eye-icns .Screen/addr DEO2
	#23 .Screen/color DEO
	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
	;depth-icns .Screen/addr DEO2
	#23 .Screen/color DEO

	( file i/o )
	.toolview/x2 LDZ2 #0008 -- .Screen/x DEO2


@@ 554,7 601,7 @@ RTN
	( get depth ) .settings/depth LDZ #20 *
	( draw ) #20 + + #21 ;draw-byte JSR2

	BANK .settings/selection LDZ TOS #0010 ** ++ .Screen/addr DEO2
	.settings/focus LDZ2 .Screen/addr DEO2
	#00 #10
	&loop
		OVR #04 MOD #00 SWP #0008 ** .blendview/x1 LDZ2 ++ .Screen/x DEO2


@@ 575,7 622,7 @@ RTN
	.settings/ratio LDZ #22 ;draw-byte JSR2

	( stash address )
	GET-ADDR DUP2 STH2 .Screen/addr DEO2
	.settings/focus LDZ2 STH2k .Screen/addr DEO2
	#00 #04
	&ver
		OVR #08 * TOS .preview/y1 LDZ2 ++ .Screen/y DEO2


@@ 660,16 707,16 @@ RTN
	( position )
	.dataview/x1 LDZ2 .Screen/x DEO2
	.dataview/y2 LDZ2 #0001 ++ .Screen/y DEO2
	.settings/selection LDZ #22 ;draw-byte JSR2
	.settings/focus LDZ2 BANK -- #22 ;draw-short JSR2

	( depth1 )
	#00 #04
	&loop
		.dataview/x1 LDZ2 .Screen/x DEO2
		OVR #08 * TOS .dataview/y1 LDZ2 ++ .Screen/y DEO2
		OVR #02 * TOS GET-ADDR ++ LDA2 #23 ;draw-short JSR2
		OVR #02 * TOS .settings/focus LDZ2 ++ LDA2 #23 ;draw-short JSR2
		.dataview/x1 LDZ2 #0028 ++ .Screen/x DEO2
		OVR #02 * TOS GET-ADDR ++ #0008 ++ LDA2 #23 ;draw-short JSR2
		OVR #02 * TOS .settings/focus LDZ2 ++ #0008 ++ LDA2 #23 ;draw-short JSR2
		INCR
		LTHk ,&loop JCN
	POP2


@@ 690,7 737,7 @@ RTN
	( draw new cursor )
	.mouse/x LDZ2 .Screen/x DEO2
	.mouse/y LDZ2 .Screen/y DEO2
	;tool_selector #00 .settings/tool LDZ #08 * ++ .Screen/addr DEO2
	;brush-icn #00 .settings/tool LDZ #08 * ++ .Screen/addr DEO2
	#32 .Mouse/state DEI #00 ! + .Screen/color DEO

RTN


@@ 727,7 774,7 @@ RTN

@line-rect ( x1* y1* x2* y2* color -- )

	( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
	( load ) .color STZ STH2k .rect/y2 STZ2 .rect/x2 STZ2 STH2k .rect/y1 STZ2 .rect/x1 STZ2
	STH2r STH2r
	&ver
		( save ) OVR2 .Screen/y DEO2


@@ 790,6 837,7 @@ RTN

RTN

@brush-icn     8040 e070 381c 0c00
@tool_selector 80c0 e0f0 f8e0 1000
@tool_hand     2020 20b8 7c7c 3838
@tool_eraser   2050 b87c 3e1c 0800


@@ 797,20 845,20 @@ RTN
@movedown_icn  0010 1010 fe7c 3810
@halftone_icn  aa55 aa55 aa55 aa55

@name-icn  1054 28c6 2854 1000 
@save-icn  fe82 8282 848a f400 
@load-icn  feaa d6aa d4aa f400 
@name-icn      1054 28c6 2854 1000 
@save-icn      fe82 8282 848a f400 
@load-icn      feaa d6aa d4aa f400 

@circle-icns
	3844 8282 8244 3800 ( full )
	387c fefe fe7c 3800 ( line )
@eye_icns
@zoom-icns
	3048 8484 4834 0200 ( in )
	3245 8284 4834 0200 ( out )
@eye-icns
	0038 4492 2810 0000 ( open )
	0000 0082 4438 0000 ( closed )
@blank_icn
	0000 0000 0000 0000
	7cfe fefe fefe 7c00
@depth_icns 
@depth-icns 
	00fe 8282 fe82 82fe
	00fe 9292 fe92 92fe
@font-hex