diff options
Diffstat (limited to 'src/menu.h')
| -rw-r--r-- | src/menu.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/menu.h b/src/menu.h new file mode 100644 index 0000000..7bd17df --- /dev/null +++ b/src/menu.h @@ -0,0 +1,43 @@ +#ifndef PW_MENU_H +#define PW_MENU_H + +#include <SDL3/SDL_events.h> +#include <SDL3/SDL_render.h> + +#include "cart.h" + +/** + * The cart selection menu state. + */ +struct pw_menu { + struct pw_carts *carts; + struct pw_cart *cart; + struct { + size_t current; + size_t next; + bool selected; + } selection; +}; + +/** + * Allocates and initializes the cart selection menu state. + */ +struct pw_menu *pw_menu_init(SDL_Renderer *renderer, char const *carts); + +/** + * Frees the cart selection menu. + */ +void pw_menu_free(struct pw_menu *menu); + +/** + * Handles SDL events for cart selection. + */ +bool pw_menu_event(struct pw_menu *menu, SDL_Event *event); + +/** + * Iterate a new frame for the cart selection menu. Sets `cart` to non-`NULL` + * if a cart was selected to run in the menu. + */ +bool pw_menu_iterate(struct pw_menu *menu, struct pw_multicart **cart); + +#endif |
