make the main menu interactive
This commit is contained in:
parent
f8a880bc8a
commit
87c9bc3dfe
BIN
MystNB.g1a
BIN
MystNB.g1a
Binary file not shown.
35
src/main.c
35
src/main.c
|
@ -1,13 +1,10 @@
|
|||
#include <gint/display.h>
|
||||
#include <gint/keyboard.h>
|
||||
|
||||
int main(void)
|
||||
static void draw_menu(int selected)
|
||||
{
|
||||
extern bopti_image_t img_title;
|
||||
extern bopti_image_t img_levels;
|
||||
extern font_t font_mystere;
|
||||
|
||||
dfont(&font_mystere);
|
||||
|
||||
dclear(C_WHITE);
|
||||
dimage(0, 2, &img_title);
|
||||
|
@ -26,10 +23,34 @@ int main(void)
|
|||
{
|
||||
dsubimage(x, y, &img_levels, 11,0,10,10, DIMAGE_NONE);
|
||||
}
|
||||
|
||||
if(i == selected)
|
||||
{
|
||||
drect(x+1, y+1, x+8, y+8, C_INVERT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
extern font_t font_mystere;
|
||||
dfont(&font_mystere);
|
||||
|
||||
int selected = 1;
|
||||
int key = 0;
|
||||
|
||||
while(key != KEY_EXE)
|
||||
{
|
||||
draw_menu(selected);
|
||||
dupdate();
|
||||
|
||||
key = getkey().key;
|
||||
|
||||
if(key == KEY_LEFT && selected > 1)
|
||||
selected--;
|
||||
if(key == KEY_RIGHT && selected < 8)
|
||||
selected++;
|
||||
}
|
||||
|
||||
dupdate();
|
||||
|
||||
getkey();
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue