-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuBox.h
37 lines (28 loc) · 800 Bytes
/
MenuBox.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
#ifndef GUARD_MENUBOX_H
#define GUARD_MENUBOX_H
#include "GameObject.h"
#include <vector>
typedef void(*CallBack)();
class MenuBox: public GameObject
{
public:
MenuBox():m_keyPressCounter(0),
m_keyPressSpeed(8){}
virtual void load(const LoaderParams* pParams);
virtual void update();
virtual void draw();
virtual void clean();
virtual std::string type(){return "MenuBox";}
std::vector<CallBack>* getCallback() {return &m_callbacks;}
void setSelectedValue(int selectedValue){m_selectedValue = selectedValue;}
int selectedValue() const {return m_selectedValue;}
private:
// adjust keypress speed
int m_keyPressCounter;
int m_keyPressSpeed;
// ---------------------
int m_selectedValue;
// handle callback base on selected value
std::vector<CallBack> m_callbacks;
};
#endif