-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuButton.h
57 lines (41 loc) · 1.08 KB
/
MenuButton.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// MenuObject.h
// SDL Game Programming Book
//
// Created by shaun mitchell on 10/02/2013.
// Copyright (c) 2013 shaun mitchell. All rights reserved.
//
#ifndef __SDL_Game_Programming_Book__MenuObject__
#define __SDL_Game_Programming_Book__MenuObject__
#include "BoardObject.h"
#include "GameObjectFactory.h"
class MenuButton : public BoardObject
{
public:
MenuButton();
virtual ~MenuButton() {}
virtual void load(std::unique_ptr<LoaderParams> const &pParams);
virtual void draw();
virtual void update();
virtual void clean();
void setCallback(void(*callback)()) { m_callback = callback;}
int getCallbackID() { return m_callbackID; }
private:
enum button_state
{
MOUSE_OUT = 0,
MOUSE_OVER = 1,
CLICKED = 2
};
bool m_bReleased;
int m_callbackID;
void (*m_callback)();
};
class MenuButtonCreator : public BaseCreator
{
GameObject* createGameObject() const
{
return new MenuButton();
}
};
#endif /* defined(__SDL_Game_Programming_Book__MenuObject__) */