46 lines
865 B
Plaintext
Executable file
46 lines
865 B
Plaintext
Executable file
: blah ' seremit task-emit ! ;
|
|
blah
|
|
|
|
s" game.log" open seekend fdeactivate const LOGFILE
|
|
: emit-log ' fputc LOGFILE withfp ;
|
|
: atexit LOGFILE factivate close ;
|
|
|
|
: start-repl activate blah ' emit-log task-echo !
|
|
s" .:: J O R T H ( jean forth) ::." type cr
|
|
begin receive loadstring s" ok" type cr again ;
|
|
task const REPL
|
|
REPL start-repl
|
|
|
|
intern input.jor
|
|
input.jor loadfile
|
|
|
|
var color
|
|
var spriteindex
|
|
|
|
8 spriteindex !
|
|
2 color !
|
|
|
|
|
|
: refresh
|
|
mousehide spriteindex @ drawfatsprite mouseshow ;
|
|
|
|
: mousepos>sprpos 3 >> swap 3 >> swap ;
|
|
: mousexys mousepos mousepos>sprpos spriteindex @ ;
|
|
: tick
|
|
MOUSEL mousedown if
|
|
mousexys getpixel color @ != if
|
|
color @ mousexys putpixel
|
|
refresh
|
|
then
|
|
then
|
|
MOUSER clicked if
|
|
mousexys getpixel color !
|
|
then
|
|
tick-debounce
|
|
;
|
|
|
|
: draw ;
|
|
|
|
mouseshow
|
|
refresh
|