This repository has been archived on 2021-04-27. You can view files and clone it, but cannot push or open issues or pull requests.
javapool/main.fs

30 lines
752 B
Forth
Raw Normal View History

2021-03-17 11:56:45 +00:00
\ JAVAPOOL incremental game
\ this code likely sucks, because I'm bad at forth and figuring stuff out as I go.
\ initialise some variables that encode game state.
\ the variable "counter" holds the count of the current tick. It always starts at 0.
variable counter
2021-03-17 12:01:30 +00:00
\ the word tick waits a game tick. Pretty much 1/60th of a second.
2021-03-17 11:56:45 +00:00
: tick 16 ms ;
2021-03-17 12:01:30 +00:00
\ the word tick-up ticks the counter up
: tick-up tick 1 counter +! ;
2021-03-17 11:56:45 +00:00
\ TODO cleanup, saving
2021-03-17 12:01:30 +00:00
: exit-game bye ;
2021-03-17 11:56:45 +00:00
: handle-input
key? if key case
[char] q of exit-game endof
endcase then ;
\ TODO this is a stub
2021-03-17 12:01:30 +00:00
: draw-screen counter @ . ;
2021-03-17 11:56:45 +00:00
\ main game loop
2021-03-17 12:01:30 +00:00
: game-loop begin tick-up handle-input draw-screen 0 until ;
2021-03-17 11:56:45 +00:00
\ clear the screen and start the game
page game-loop