Voxeloop  0.1.0
Musical Loop Generation in Voxel World
CoreEngine.hpp
Go to the documentation of this file.
1 #ifndef CORE_INCLUDE_COREENGINE_HPP
2 #define CORE_INCLUDE_COREENGINE_HPP
3 
4 #include "Common.hpp"
5 
6 #include <cstdio>
7 #include <vector>
8 
9 class StateMachine;
10 
14 class CoreEngine {
15 public:
16  void init(const char *title, int width = 640, int height = 480, int bpp = 0,
17  bool fullscreen = false);
18  void cleanup();
19 
20  void changeState(StateMachine *state);
21  void pushState(StateMachine *state);
22  void popState();
23 
24  void handleEvents();
25  void update();
26  void draw();
27 
28  bool isRunning() { return m_isRunning; }
29  void quit() { m_isRunning = false; }
30 
31  static void key_callback(GLFWwindow *window, int key, int scancode,
32  int action, int modes);
33 
34 private:
35  // the stack of states
36  std::vector<StateMachine *> states;
37 
40 
42  GLFWwindow *m_window;
43 };
44 
45 #endif // CORE_INCLUDE_COREENGINE_HPP
std::shared_ptr< GameData > SharedDataRef
Definition: Common.hpp:14
The underlying engine that handles everything underneath.
Definition: CoreEngine.hpp:14
void changeState(StateMachine *state)
Definition: CoreEngine.cpp:34
bool m_fullscreen
Definition: CoreEngine.hpp:39
bool m_isRunning
Definition: CoreEngine.hpp:38
void cleanup()
Definition: CoreEngine.cpp:21
void popState()
Definition: CoreEngine.cpp:57
void handleEvents()
Definition: CoreEngine.cpp:70
GLFWwindow * m_window
Definition: CoreEngine.hpp:42
void init(const char *title, int width=640, int height=480, int bpp=0, bool fullscreen=false)
Definition: CoreEngine.cpp:8
void update()
Definition: CoreEngine.cpp:75
std::vector< StateMachine * > states
Definition: CoreEngine.hpp:36
void quit()
Definition: CoreEngine.hpp:29
void pushState(StateMachine *state)
Definition: CoreEngine.cpp:46
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int modes)
Definition: CoreEngine.cpp:5
bool isRunning()
Definition: CoreEngine.hpp:28
void draw()
Definition: CoreEngine.cpp:80
SharedDataRef m_sharedData
Definition: CoreEngine.hpp:41
Definition: StateMachine.hpp:6