-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuScreen.h
More file actions
51 lines (42 loc) · 987 Bytes
/
MenuScreen.h
File metadata and controls
51 lines (42 loc) · 987 Bytes
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
44
45
46
47
48
49
50
51
#pragma once
#include <vector>
#include "SDL.h"
#include "Painter.h"
#include "Text.h"
#include "Singer.h"
class MenuScreen {
public:
MenuScreen(SDL_Renderer *renderer, Painter *painter, Singer *singer);
~MenuScreen();
void draw();
void animate();
void moveUp();
void moveDown();
int enter();
void setTitle(const char *title);
void setMenuItemEnabled(int action, bool active);
void setMenuItemActive(int action);
void setScore(int score);
enum {
ACTION_START,
ACTION_CONTINUE,
ACTION_QUIT
};
private:
void generateBackground();
void drawBackground();
void prepareMenu();
SDL_Renderer *m_renderer;
SDL_Texture *m_background;
Painter *m_painter;
Singer *m_singer;
Text m_txTitle, m_txScore;
struct t_menuItem {
int action;
Text text;
bool enabled;
};
std::vector<t_menuItem> m_menuList;
int m_slidedX;
Uint8 m_activeMenuItem;
};