fix title menu

This commit is contained in:
Jeremy Penner 2020-04-08 12:07:40 -04:00
parent 9c91ed8230
commit cdf99a01ce
24 changed files with 19 additions and 14 deletions

BIN
boot.jim

Binary file not shown.

BIN
debug.jim

Binary file not shown.

BIN
defs.jim

Binary file not shown.

View file

@ -75,7 +75,7 @@
>r dup r@ @ <= if >r dup r@ @ <= if
drop 0 r@ ! drop 0 r@ !
else r@ @ 0 < if else r@ @ 0 < if
r@ ! 1 - r@ !
else drop then then rdrop ; else drop then then rdrop ;
: +!cycle ( n var lim -- ) : +!cycle ( n var lim -- )

Binary file not shown.

Binary file not shown.

BIN
game.jim

Binary file not shown.

BIN
input.jim

Binary file not shown.

BIN
jiles.jim

Binary file not shown.

BIN
job.jim

Binary file not shown.

Binary file not shown.

BIN
lev00002.jim Executable file

Binary file not shown.

BIN
lev00003.jim Executable file

Binary file not shown.

BIN
lev00004.jim Executable file

Binary file not shown.

BIN
lev00005.jim Executable file

Binary file not shown.

BIN
level.jim

Binary file not shown.

BIN
map.jim

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
state.jim

Binary file not shown.

View file

@ -357,11 +357,16 @@ void f_textc() { // ( col line c color -- )
} }
void f_rawtextc() { // ( offset c color -- ) void f_rawtextc() { // ( offset c color -- )
unsigned int color = TOP().u;
unsigned int inverse = (~color) & 0x0f;
setWriteMode(0); setWriteMode(0);
setPlaneColor(TOP().u); if (inverse) {
DROP(1); setPlaneColor(inverse);
text_draw_char(ST1().u, TOP().i, 40); text_draw_char(ST2().u, ' ', 40);
DROP(2); }
setPlaneColor(color);
text_draw_char(ST2().u, ST1().i, 40);
DROP(3);
} }
void f_text() { // ( col line s color -- ) void f_text() { // ( col line s color -- )

BIN
timer.jim

Binary file not shown.

BIN
title.jim

Binary file not shown.

View file

@ -16,25 +16,27 @@
: strlen ( s -- n ) 0 swap begin dup b@ while 1 + swap 1 + swap repeat drop ; : strlen ( s -- n ) 0 swap begin dup b@ while 1 + swap 1 + swap repeat drop ;
: titles ( s -- ) begin dup b@ dup while titlec 1 + repeat drop drop ; : titles ( s -- ) begin dup b@ dup while titlec 1 + repeat drop drop ;
: optionbg ( y -- ) texty ! 20 boxmid -8 texty +! ; : optionbg ( c -- ) dup 10 textx ! titlec 27 textx ! titlec ;
: option ( s -- ) dup strlen 1 >> 19 swap - textx ! titles ; : option ( s -- ) dup strlen 1 >> 19 swap - textx ! titles ;
: startgame ( n -- ) s" title" loadscr s" start.jor" loadjor ; : startgame ( n -- ) s" title" loadscr s" start.jor" loadjor ;
: menu-opts : menu-opts
s" New Game" :| 1 startgame |; yield s" New Game" :| 1 startgame |; yield
s" Continue" ' noop yield s" Continue" ' noop yield
s" Register Today!" ' noop yield s" Help" ' noop yield
s" Register" ' noop yield
s" Quit" ' quit yield s" Quit" ' quit yield
done ; done ;
var menu-selected var menu-selected
: menu-y ( i -- y ) 10 * 90 + ; : menu-y ( i -- y ) 12 * 90 + ;
: draw-menu : draw-menu
0 menu-opts each drop 0 menu-opts each drop
over menu-y optionbg over menu-y texty !
over menu-selected @ = if LCYAN else WHITE then text-color ! over menu-selected @ = if LGREEN else WHITE then text-color ! option
option dup menu-selected @ = if 15 else sp then optionbg
1 + 1 +
more drop ; more drop ;
: redraw-menu 21 11 8 72 box draw-menu ;
: exec-selected 0 menu-opts each swap drop : exec-selected 0 menu-opts each swap drop
over menu-selected @ = if execute break else drop then over menu-selected @ = if execute break else drop then
@ -45,9 +47,7 @@ var menu-selected
: menu-select ( di -- ) menu-selected menu-count +!cycle draw-menu ; : menu-select ( di -- ) menu-selected menu-count +!cycle draw-menu ;
:noname :noname
fuck s" title" loadscr fuck s" title" loadscr redraw-menu
20 9 9 72 box
draw-menu
:| ^ENTER key-pressed if exec-selected then :| ^ENTER key-pressed if exec-selected then
^UP key-pressed if -1 menu-select then ^UP key-pressed if -1 menu-select then
^DOWN key-pressed if 1 menu-select then ^DOWN key-pressed if 1 menu-select then