forked from hminoura/factory
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.h
40 lines (34 loc) · 914 Bytes
/
App.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
#include <SFML/Graphics.hpp>
class MouseListener {
public:
virtual void onClick(sf::Event::MouseButtonEvent mouse)=0;
virtual void offClick(sf::Event::MouseButtonEvent mouse)=0;
virtual void onMouseMoved(sf::Event::MouseMoveEvent mouse)=0;
};
class KeyboardListener {
public:
virtual void onKeyDown(sf::Keyboard::Key key)=0;
};
class App {
protected:
KeyboardListener* keyListener;
MouseListener* mouseListener;
sf::Clock clock;
sf::Clock rap;
public:
static unsigned w_width;
static unsigned w_height;
static sf::RenderWindow window;
static const sf::Time sync;
App();
virtual ~App();
void setKeyboardListener(KeyboardListener *keyListener);
void setMouseListener(MouseListener *mouseListener);
virtual void init();
virtual bool isActive();
virtual void draw();
virtual void update() = 0;
virtual void event();
virtual void waitSync();
virtual void clean();
};