start preperation for multiple screens

This commit is contained in:
Nico 2021-03-30 13:55:59 +01:00
parent 2f2aae1c52
commit bf3ee866c9
1 changed files with 15 additions and 3 deletions

18
main.fs
View File

@ -47,6 +47,12 @@ create constructcost 0 , 0
variable constructcount
\ count-messages-shown contains the amount of device count milestone messages that have been shown.
variable count-messages-shown
\ the variable screen contains the current screen number.
\ 0 = devices
\ 1 = garden
\ the rest are TBA
variable screen
0 screen !
\ message contains a string message which is printed on the screen.
\ because forth is weird, strings can be stored in variables but it's easier to just store them someplace else and then store that address and the string's length in the variable (this is what S" " does and what "type" expects)
create message 0 , 0 , 0 ,
@ -174,12 +180,18 @@ S" you feel like throwing some stuff into the pool." set-message
\ END DEBUGGING STUFF
\ the word devices-input contains the input cases specifically for the device counter screen.
: devices-input
case
[char] h of hire-chat-member endof
[char] b of build-construct endof
endcase ;
\ the word handle-input handles input every time around the game loop.
: handle-input
key? if key case
key? if key dup case
screen @ 0= if devices-input then
[char] q of exit-game endof
[char] h of hire-chat-member endof
[char] b of build-construct endof
[char] D of debug-console endof
endcase then ;