fix tab bar

This commit is contained in:
Nico 2021-04-02 16:04:08 +01:00
parent 3553032a05
commit ab77acc264
1 changed files with 21 additions and 3 deletions

24
main.fs
View File

@ -97,6 +97,7 @@ S" you feel like throwing some stuff into the pool." set-message
: unlock-detector
100 devices can-afford? detector-unlocked @ 0= and if
S" Somebody is tinkering with some devices. Says they can build a metal detector. " set-message
-1 detector-unlocked ! then ;
\ the word unlock tests to see if any unlock conditions are matched, and unlocks them if they are.
@ -168,7 +169,8 @@ S" you feel like throwing some stuff into the pool." set-message
\ the word buy-detector buys the metal detector!
: buy-detector
400 devices can-afford? if
1 screens +! then ;
1 screens +! then
page ;
\ DEBUGGING STUFF
@ -193,6 +195,14 @@ S" you feel like throwing some stuff into the pool." set-message
\ END DEBUGGING STUFF
\ move screen moves forward/back x screens.
: move-screen ( x -- )
screen @ + dup dup
0 >= swap screens @ <= and if
page
screen !
else drop then ;
\ the word devices-input contains the input cases specifically for the device counter screen.
: devices-input
case
@ -207,6 +217,8 @@ S" you feel like throwing some stuff into the pool." set-message
screen @ 0= if devices-input then
[char] q of exit-game endof
[char] D of debug-console endof
[char] > of 1 move-screen endof
[char] < of -1 move-screen endof
endcase then ;
\ inc-y increments the y coordinate being drawn at.
@ -307,7 +319,7 @@ S" you feel like throwing some stuff into the pool." set-message
\ draw-screen redraws the devices screen, but only if there's been a change.
\ ( x y -- )
: draw-devices-screen any-change? if draw-message draw-devices draw-blank draw-actions clear-xy clear-all else clear-xy then ;
: draw-devices-screen draw-message draw-devices draw-blank draw-actions ;
\ : draw-screen clear-all ;
\ TODO draw the garden, this is a stub
@ -321,7 +333,13 @@ S" you feel like throwing some stuff into the pool." set-message
endcase ;
\ main game loop
: game-loop begin wait-tick game-tick handle-input 1 1 draw-tab-bar draw-blank draw-screen 0 until ;
: game-loop
begin
wait-tick game-tick handle-input
any-change? if
1 1 draw-tab-bar draw-blank draw-screen clear-xy clear-all
then
0 until ;
\ for use in the debugging shell
: restart page game-loop ;