make the main menu interactive

This commit is contained in:
Lephenixnoir 2020-07-25 12:16:15 +02:00
parent f8a880bc8a
commit 87c9bc3dfe
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 28 additions and 7 deletions

Binary file not shown.

View File

@ -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;
}