~rabbits/orca-toy

37ff7df90e12c82ad411e16c82e33158d2589a80 — Devine Lu Linvega a month ago 7ade802
Optimized menu-drawing
3 files changed, 10 insertions(+), 24 deletions(-)

M src/library.tal
M src/manifest.tal
M src/orca.tal
M src/library.tal => src/library.tal +1 -1
@@ 375,7 375,7 @@ JMP2r
	DUP LIT '. EQU ,&idle JCN
	OVR ;chrb36 JSR2 ,&save JCN
	( load )
		NIP ;chrb36 JSR2 .variables ADD LDZ STH2r #00 .grid/width LDZ ADD2 ;set-port-output JSR2 JMP2r
		NIP ;chrb36 JSR2 .variables ADD LDZ STH2r #00 .grid/width LDZ ADD2 ;set-port-output JMP2
	&save
		SWP ;chrb36 JSR2 .variables ADD STZ POP2r JMP2r
	&idle

M src/manifest.tal => src/manifest.tal +3 -13
@@ 11,13 11,7 @@ BRK

@on-mouse-menu ( -> )

	#40 ;draw-cursor JSR2
	( record mouse positions )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2
	( draw new cursor )
	;hand-icn .Screen/addr DEO2
	#42 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO
	#41 .Mouse/state DEI #00 NEQ ADD ;hand-icn ;update-cursor JSR2
	( when touch cat )
	.Mouse/state DEI #00 EQU ,&no-touch-cat JCN
	.Mouse/y DEI2 #0014 GTH2 ,&no-touch-cat JCN


@@ 314,14 308,10 @@ JMP2r

@update-cursor ( color addr* -- )

	#00 .Screen/auto DEO
	#40 ,draw-cursor JSR
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2
	.Mouse/x DEI2 .cursor/x STZ2
	.Mouse/y DEI2 .cursor/y STZ2
	.Screen/addr DEO2
	.Screen/sprite DEO

JMP2r

@draw-cursor ( color -- )


M src/orca.tal => src/orca.tal +6 -10
@@ 311,13 311,10 @@ BRK

	.Mouse/y DEI2 #0014 LTH2 ;trap-menu JCN2

	( clear last cursor )
	#40 ;draw-cursor JSR2
	( draw new cursor )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2
	;cursor-icn .Screen/addr DEO2
	.Mouse/state DEI #00 NEQ DUP ADD #41 ADD .Screen/sprite DEO
	.Mouse/state DEI #00 NEQ DUP ADD #41 ADD ;cursor-icn ;update-cursor JSR2

	( restore auto after cursor drawing )
	#15 .Screen/auto DEO

	( route )
	.Mouse/x DEI2 .Mouse/y DEI2 .grid ;within-rect JSR2 ,on-mouse-grid JCN


@@ 370,8 367,8 @@ BRK
(
@|selection )

@play-decr ( -- ) #ff ;mod-speed JSR2 JMP2r
@play-incr ( -- ) #01 ;mod-speed JSR2 JMP2r
@play-decr ( -- ) #ff ;mod-speed JMP2
@play-incr ( -- ) #01 ;mod-speed JMP2

@mod-sel ( x y mod -- )



@@ 863,7 860,6 @@ JMP2r
@draw-str ( str* -- str* )

	LDAk #00 EQU ,&skip JCN
	#15 .Screen/auto DEO
	&while
		LDAk ,draw-chr JSR
		INC2 LDAk ,&while JCN