blob: a247a5a26431060b81ed03cc2eaf249a5a497500 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef PW_MENU_H
#define PW_MENU_H
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_render.h>
#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
|