-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.h
43 lines (38 loc) · 1.02 KB
/
Menu.h
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
#ifndef MENU_H
#define MENU_H
#include <string>
#include <vector>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include "Fontdata.h"
#include "SDLisHard.h"
struct menuItem {
menuItem* parent;
std::vector<menuItem*> children;
std::string key;
SDL_Texture* texture;
bool isVisible;
bool onClick();
bool onHover();
menuItem(menuItem* parent, std::string key) {
this->key = key;
this->parent = parent;
}
};
class Menu {
public:
menuItem *head;
fontData *font;
SDL_Window* win;
SDL_Renderer* rend;
int height;
std::vector<int> bgColor;
void initMenu(std::vector<std::string> keys, menuItem* parent);
menuItem* fetchMenuItem(std::string key, menuItem* head);
void addElement(std::string key, menuItem *head);
void deleteElement(menuItem *dest);
menuItem* renderMenu(menuItem* head);
SDL_Texture* buildChildren(menuItem* parent);
Menu(fontData *font, int height, std::vector<int> bgColor, SDL_Window* win, SDL_Renderer* rend);
};
#endif