-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.h
39 lines (35 loc) · 849 Bytes
/
game.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>
#include <memory>
#include <mutex>
#include "scene.h"
#ifndef GAME_H
#define GAME_H
class Game : public sf::RenderWindow
{
public:
Game(const char* name, int width, int height, int bpp);
void run();
void setScene(std::shared_ptr<Scene> &s);
void toggleFPS();
bool getShowFPS();
void setShowFPS(const bool &v);
bool isRunning();
bool isRendering();
void quit();
bool hasScene() const;
void sendEventToScene(const sf::Event &e);
protected:
virtual void onUpdate(const sf::Time &time);
virtual void onEvent(const sf::Event &event);
virtual void onQuit();
private:
sf::Clock m_Clock;
sf::Time m_Tick;
sf::Clock m_FPSClock;
std::shared_ptr<Scene> m_Scene;
std::mutex m_Mutex;
bool fps;
bool render;
bool running;
};
#endif // GAME_H