]> git.lizzy.rs Git - nothing.git/blob - src/ui/list_selector.h
Remove metadata usage from LevelPicker
[nothing.git] / src / ui / list_selector.h
1 #ifndef LIST_SELECTOR_H_
2 #define LIST_SELECTOR_H_
3
4 #include "game/camera.h"
5 #include "dynarray.h"
6
7 typedef struct {
8     Dynarray items;
9     size_t cursor;
10     int selected_item;
11     Vec2f position;
12     Vec2f font_scale;
13     float padding_bottom;
14 } ListSelector;
15
16 int list_selector_render(const Camera *camera,
17                          const ListSelector *list_selector);
18 Vec2f list_selector_size(const ListSelector *list_selector,
19                          Vec2f font_scale,
20                          float padding_bottom);
21 int list_selector_event(ListSelector *list_selector, const SDL_Event *event);
22
23 static inline
24 void list_selector_clean_selection(ListSelector *list_selector)
25 {
26     trace_assert(list_selector);
27     list_selector->selected_item = -1;
28 }
29
30 #endif  // LIST_SELECTOR_H_