aboutsummaryrefslogtreecommitdiff
path: root/menu.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-06 09:02:04 +1000
committerquou <quou@disroot.org>2023-05-06 09:02:04 +1000
commit2ab411c4b8855d11d48454a93262e8eae3ba7fc7 (patch)
treee608ebd0bea71570be0a3619f9848f975669e5ef /menu.h
parentfb104368dd33b66e0575dcc0327cbae7046a4e1e (diff)
Menus, game over, dying, etc.
Diffstat (limited to 'menu.h')
-rw-r--r--menu.h35
1 files changed, 35 insertions, 0 deletions
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