pete286/game.jor

38 lines
746 B
Plaintext
Executable file

: blah
' seremit task-emit !
' log-emit task-echo ! ;
: start-repl activate blah
s" .:: J O R T H ( jean forth) ::." type cr
begin receive loadstring again ;
task const REPL
REPL start-repl
task const TEST
1 const ^ESC
28 const ^ENTER
29 const ^CTRL
56 const ^ALT
57 const ^SPACE
72 const ^UP
75 const ^LEFT
77 const ^RIGHT
80 const ^DOWN
: wait-key ( k -- ) begin dup key-pressed not while suspend repeat drop ;
: udelta ( u u -- u )
2dup u> if
swap -1 swap - + 1 +
else
swap -
then ;
: sleep ( count -- )
ticks swap begin over ticks udelta over u< while suspend repeat drop drop ;
: test TEST activate blah
^SPACE wait-key
s" SPACE" type
30 sleep
s" is big" type ;
test