summaryrefslogtreecommitdiff
path: root/src/menu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu.h')
-rw-r--r--src/menu.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/menu.h b/src/menu.h
new file mode 100644
index 0000000..1c6cbd1
--- /dev/null
+++ b/src/menu.h
@@ -0,0 +1,26 @@
+#ifndef MENU_H
+#define MENU_H
+
+#include <SDL3/SDL.h>
+#include <stdbool.h>
+
+typedef struct menu_entry {
+ char name[64];
+ void (*action)(void *data);
+ void *data;
+} menu_entry;
+
+typedef struct menu {
+ SDL_Window *window;
+ SDL_Renderer *renderer;
+ menu_entry *entries;
+ SDL_Texture **textures;
+ int count;
+} menu;
+
+menu *create_menu(menu_entry *entries, int count, int x, int y);
+bool menu_handle_event(menu *m, SDL_Event e);
+void menu_render(menu *m);
+void close_menu(menu *m);
+
+#endif