aboutsummaryrefslogtreecommitdiff
path: root/menu.h
blob: 52403f12a95c0dd660e186d19d7e0af213120eec (plain) (blame)
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
#ifndef menu_h
#define menu_h

#include "config.h"
#include "render.h"

typedef struct Menu Menu;

typedef void (*Menu_Event)(Menu* menu);

typedef struct {
	Menu_Event on_select;
	int text_len;
	char text[20];
} Menu_Item;

struct Menu {
	Menu_Item els[menu_max_elements];
	int el_count;
	int selected;
	int y, h;
	void* ptr;
};

void init_menu(Menu* menu, void* ptr);
void menu_add(
	Menu* menu,
	const char* text,
	Menu_Event on_select,
	const BM_Font* font
);
void update_menu(Menu* menu);
void render_menu(Menu* menu, const BM_Font* font);

#endif