#ifndef PW_MENU_H #define PW_MENU_H #include #include #include "cart.h" #include "scale.h" /** * The cart selection menu state. */ struct pw_menu { struct pw_carts *carts; struct pw_cart_png *png; enum pw_scale_mode mode; struct { size_t current; size_t next; bool valid; bool selected; } selection; }; /** * Allocates and initializes the cart selection menu state. */ struct pw_menu *pw_menu_init(SDL_Renderer *renderer, char const *carts, enum pw_scale_mode mode); /** * 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_cart **cart); /** * Renders the cart selection menu. */ bool pw_menu_render(struct pw_menu *menu); #endif