-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRobinsonMenu.h
43 lines (32 loc) · 869 Bytes
/
RobinsonMenu.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 ROBINSONMENU_H
#define ROBINSONMENU_H
#include <string>
#include <map>
#include <vector>
#ifdef WIN32
#include <SDL_ttf.h>
#else
#include <SDL2/SDL_ttf.h>
#endif
namespace SCRANTIC {
class RobinsonMenu
{
private:
std::map<std::string, SDL_Texture *> menuScreen;
std::map<std::string, std::vector<SDL_Rect>> menuRects;
SDL_Renderer *renderer;
int width;
int height;
std::string currentPage;
size_t currentItem;
RobinsonMenu(const RobinsonMenu& C);
public:
RobinsonMenu(SDL_Renderer *renderer, int width, int height);
~RobinsonMenu();
void render();
void initMenu(std::map<std::string, std::vector<std::string>> items, TTF_Font *font);
void setMenuPostion(std::string page, size_t pos);
bool navigateMenu(SDL_Keycode key, std::string &newPage, size_t &newPosition);
};
}
#endif // ROBINSONMENU_H