initial commit, in a prototyping stage

This commit is contained in:
Nico 2021-03-17 11:56:45 +00:00
commit bb945d1039
1 changed files with 28 additions and 0 deletions

28
main.fs Normal file
View File

@ -0,0 +1,28 @@
\ 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
\ game tick. Pretty much 1/60th of a second.
: tick 16 ms ;
: tick-up tick 1 counter +! ; \ tick the counter up
\ TODO cleanup, saving
: exit-game bye ;
: handle-input
key? if key case
[char] q of exit-game endof
endcase then ;
\ TODO this is a stub
: draw-screen counter @ . ;
\ main game loop
: game-loop begin tick-up handle-input draw-screen 0 until ;
\ clear the screen and start the game
page game-loop