Merge branch 'rethink' of tildegit.org:nihilazo/javapool into rethink

This commit is contained in:
Nico 2021-04-27 19:06:34 +01:00
commit a0a562b962
1 changed files with 15 additions and 7 deletions

22
main.fs
View File

@ -58,6 +58,13 @@ variable screen
\ variable screens contains the highest unlocked screen number.
variable screens
0 screens !
\ variable searchspeed is the speed of going metal detecting (per tick). When it reaches 1000, it's done.
variable searchspeed
10 searchspeed !
\ variable searchprogress is the progress through metal detecting. It has an update flag.
create searchprogress 0 , 0 ,
\ variable searching is true if metal detecting is in progress.
\ 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 ,
@ -73,9 +80,9 @@ S" you feel like throwing some stuff into the pool." set-message
: f+! ( addr -- ) ( F: r -- ) dup f@ f+ f! ;
\ any-change? leaves a -1 on the stack if any value has changed, 0 otherwise
: any-change? ( -- flag ) membercost 1 changed? devices 2 changed? message 2 changed? or or ;
: any-change? ( -- flag ) membercost 1 changed? devices 2 changed? message 2 changed? searchprogress 1 changed? or or or ;
\ clear-all clears the change flag on all values.
: clear-all membercost 1 cleared devices 2 cleared message 2 cleared ;
: clear-all membercost 1 cleared devices 2 cleared message 2 cleared searchprogress 1 cleared ;
\ the word !0= tests if something is non-zero
: !0= ( n -- flag ) 0= 0= ;
\ the word f!0= tests if a floating thing is non-zero
@ -173,6 +180,8 @@ S" you feel like throwing some stuff into the pool." set-message
1 screens +! then
page ;
\ the word metal-detect goes metal detecting!
: metal-detect ; \ TODO stub
\ DEBUGGING STUFF
\ the word debug-console is used for entering debug mode.
@ -215,7 +224,7 @@ S" you feel like throwing some stuff into the pool." set-message
\ the word garden-input contains the input cases specifically for the garden
: garden-input
case
[char] m of S" this is a test" set-message endof
[char] m of metal-detect endof
endcase ; \ TODO stub
\ the word handle-input handles input every time around the game loop.
@ -259,16 +268,15 @@ S" you feel like throwing some stuff into the pool." set-message
\ draw-tab draws a single tab for a screen
: draw-tab ( i -- )
dup screen @ = if
." >" bl drop then draw-screen-name ;
." >" else space then draw-screen-name ;
\ draw-tab-bar draws the tab bar
\ TODO keep side indent thing
\ draw-tab-bar draws the tab bar.
: draw-tab-bar ( x y -- x y )
2dup at-xy
clear-line
screens @ if \ 0 is false in forth, so if the number of screens is zero, don't draw the bar.
screens @ 1+ 0 do
i dup draw-tab
i draw-tab
loop inc-y
draw-tab-keys
draw-tab-devices