detect screen sizes; relative drawing
This commit is contained in:
parent
a345a43ab6
commit
8db2f9d4ac
21
cards.tal
21
cards.tal
|
@ -42,17 +42,18 @@
|
|||
,set-sprite/layer LDR ORA .Screen/sprite DEOk DEOk DEO JMP2r
|
||||
|
||||
@draw-background ( -> )
|
||||
#f2 .Screen/auto DEO
|
||||
;tiles #0200 ADD2 .Screen/addr DEO2
|
||||
#0080 .Screen/x DEO2
|
||||
draw-background/twice
|
||||
#0000 .Screen/x DEO2
|
||||
&twice
|
||||
#01 .Screen/auto DEO
|
||||
#0000 .Screen/y DEO2
|
||||
#81 .Screen/sprite
|
||||
DEOk DEOk DEOk DEOk DEOk DEOk DEOk DEOk
|
||||
DEOk DEOk DEOk DEOk DEOk DEOk DEOk DEOk
|
||||
DEOk DEOk DEOk DEOk DEOk DEOk DEOk DEO JMP2r
|
||||
;tiles #0200 ADD2 .Screen/addr DEO2
|
||||
.height LDZ2 #03 SFT2 #0000 &yloop
|
||||
#0000 .Screen/x DEO2
|
||||
.width LDZ2 #03 SFT2 #0000 &xloop
|
||||
#81 .Screen/sprite DEO
|
||||
INC2 GTH2k ?&xloop
|
||||
POP2 POP2
|
||||
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
|
||||
INC2 GTH2k ?&yloop
|
||||
POP2 POP2 JMP2r
|
||||
|
||||
@draw-spot-down ( -> )
|
||||
#16 .Screen/auto DEO ( ; draw 2 tiles, increment x and addr )
|
||||
|
|
BIN
kodiak.rom
BIN
kodiak.rom
Binary file not shown.
45
kodiak.tal
45
kodiak.tal
|
@ -61,6 +61,8 @@
|
|||
@audio [ $1 ( is audio enabled? )
|
||||
&pos $2 ] ( position in music )
|
||||
@easy $1 ( true: draw 1 card false: draw 3 cards )
|
||||
@width $2
|
||||
@height $2
|
||||
|
||||
|0100
|
||||
( metadata )
|
||||
|
@ -71,9 +73,7 @@
|
|||
#8d12 .System/g DEO2
|
||||
#4d12 .System/b DEO2
|
||||
|
||||
( 256x192 )
|
||||
#0100 .Screen/w DEO2
|
||||
#00c0 .Screen/h DEO2
|
||||
init-screen
|
||||
|
||||
( set up vectors )
|
||||
;on-mouse .Mouse/vect DEO2
|
||||
|
@ -133,6 +133,16 @@
|
|||
.about LDZ ?draw-about
|
||||
draw !auto-move
|
||||
|
||||
@init-screen ( -> )
|
||||
( try to set 256x192; detect platforms that can't resize )
|
||||
#0100 .Screen/w DEO2
|
||||
#00c0 .Screen/h DEO2
|
||||
|
||||
( save whatever size we get back )
|
||||
.Screen/w DEI2 .width STZ2
|
||||
.Screen/h DEI2 .height STZ2
|
||||
JMP2r
|
||||
|
||||
@clear-fg ( -> )
|
||||
#0000 .Screen/x DEO2
|
||||
#0000 .Screen/y DEO2
|
||||
|
@ -412,17 +422,18 @@
|
|||
&easy ;easy-button JMP2r
|
||||
|
||||
@draw-buttons ( -> )
|
||||
#0008 #00b4 restart-button-addr draw-button
|
||||
#0030 #00b4 ;quit-button draw-button
|
||||
#0058 #00b4 audio-button-addr draw-button
|
||||
#0080 #00b4 ;about-button draw-button
|
||||
#00a8 #00b4 difficulty-button-addr !draw-button
|
||||
.height LDZ2 #000c SUB2
|
||||
#0008 OVR2 restart-button-addr draw-button
|
||||
#0030 OVR2 ;quit-button draw-button
|
||||
#0058 OVR2 audio-button-addr draw-button
|
||||
#0080 OVR2 ;about-button draw-button
|
||||
#00a8 SWP2 difficulty-button-addr !draw-button
|
||||
|
||||
@draw-bear-smile ( -> )
|
||||
#00e8 #0098 ;sprites #00c0 ADD2 !draw-mouth
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 ;sprites #00c0 ADD2 !draw-mouth
|
||||
|
||||
@draw-bear-oh ( -> )
|
||||
#00e8 #0098 ;sprites #0100 ADD2 !draw-mouth
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 ;sprites #0100 ADD2 !draw-mouth
|
||||
|
||||
@draw-you-win ( -> )
|
||||
|
||||
|
@ -443,7 +454,7 @@
|
|||
.Screen/sprite DEOk DEO JMP2r
|
||||
|
||||
@draw-decorations ( -> )
|
||||
#00e8 #0098 #80 draw-bear
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 #80 draw-bear
|
||||
is-game-won ?draw-you-win JMP2r
|
||||
|
||||
@draw-stock ( -> )
|
||||
|
@ -684,10 +695,9 @@
|
|||
|
||||
@on-refresh-bear ( -> )
|
||||
.about LDZ ?on-refresh-about-bears
|
||||
( .frame LDZ #00 EQU ?draw-bear-normal )
|
||||
#00 .dragging LDZ EQU ?{ draw-bear-oh }
|
||||
load-bear-frame ORAk ?{ POP2 JMP2r }
|
||||
#00e8 #0098 !draw-bear-eyes
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 !draw-bear-eyes
|
||||
|
||||
@on-mouse ( -> brk )
|
||||
on-move
|
||||
|
@ -700,8 +710,7 @@
|
|||
@on-move ( -> )
|
||||
.Mouse/x DEI2 .prev/mouse-x LDZ2 NEQ2 ?draw-mouse
|
||||
.Mouse/y DEI2 .prev/mouse-y LDZ2 NEQ2 ?draw-mouse
|
||||
[ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR EQU ?{
|
||||
draw-mouse }
|
||||
[ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR EQU ?{ draw-mouse }
|
||||
JMP2r
|
||||
|
||||
@draw-mouse ( -> )
|
||||
|
@ -921,6 +930,7 @@
|
|||
.Mouse/x DEI2 #0008 LTH2 ?&no ( ; x<8 )
|
||||
.Mouse/x DEI2 #0017 GTH2 ?&no ( ; x>=23 )
|
||||
.Mouse/y DEI2 #0020 GTH2 ?&no ( ; y>=32 )
|
||||
.waste LDZ .stock LDZ ORA #00 EQU ?&no
|
||||
deal-from-stock draw #01 JMP2r ( 1^ )
|
||||
&no #00 JMP2r ( 0^ )
|
||||
|
||||
|
@ -952,6 +962,7 @@
|
|||
ROT2 NIP DUP start-drag draw #01 JMP2r
|
||||
|
||||
@maybe-select-waste ( -> bool^ )
|
||||
.waste LDZ #00 EQU ?&no1
|
||||
.Mouse/y DEI2 #0008 LTH2 ?&no1 ( )
|
||||
.Mouse/y DEI2 #0020 GTH2 ?&no1 ( )
|
||||
top-waste STHk #00 EQU ?&no2 ( [t^] )
|
||||
|
@ -1006,8 +1017,8 @@
|
|||
|
||||
@maybe-select-button ( -> bool^ )
|
||||
.Mouse/y DEI2
|
||||
DUP2 #00b4 LTH2 ?&no
|
||||
DUP2 #00bb GTH2 ?&no
|
||||
DUP2 .height LDZ2 #000c SUB2 LTH2 ?&no
|
||||
DUP2 .height LDZ2 #0005 SUB2 GTH2 ?&no
|
||||
POP2 .Mouse/x DEI2
|
||||
DUP2 #0008 LTH2 ?&no
|
||||
DUP2 #0028 LTH2 ?&restart
|
||||
|
|
Loading…
Reference in New Issue