From 2ab411c4b8855d11d48454a93262e8eae3ba7fc7 Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 6 May 2023 09:02:04 +1000 Subject: Menus, game over, dying, etc. --- menu.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 menu.h (limited to 'menu.h') diff --git a/menu.h b/menu.h new file mode 100644 index 0000000..52403f1 --- /dev/null +++ b/menu.h @@ -0,0 +1,35 @@ +#ifndef menu_h +#define menu_h + +#include "config.h" +#include "render.h" + +typedef struct Menu Menu; + +typedef void (*Menu_Event)(Menu* menu); + +typedef struct { + Menu_Event on_select; + int text_len; + char text[20]; +} Menu_Item; + +struct Menu { + Menu_Item els[menu_max_elements]; + int el_count; + int selected; + int y, h; + void* ptr; +}; + +void init_menu(Menu* menu, void* ptr); +void menu_add( + Menu* menu, + const char* text, + Menu_Event on_select, + const BM_Font* font +); +void update_menu(Menu* menu); +void render_menu(Menu* menu, const BM_Font* font); + +#endif -- cgit v1.2.3-54-g00ecf