summaryrefslogtreecommitdiff
path: root/src/menu.h
blob: ddc8e4278e6f8c238145181f3719cfc7aa68c43f (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
#ifndef MENU_H
#define MENU_H

#include <SDL3/SDL.h>
#include <stdbool.h>

typedef struct menu_entry {
	char name[64];
	void (*action)(void *data);
	void *data;
} menu_entry;

typedef struct menu {
	SDL_Window *window;
	SDL_Renderer *renderer;
	menu_entry *entries;
	SDL_Texture **textures;
	int count;
	float height;
	float scroll;
} menu;

menu *create_menu(menu_entry *entries, int count, int x, int y);
bool menu_handle_event(menu *m, SDL_Event e);
void menu_render(menu *m);
void close_menu(menu *m);

#endif