Voxeloop  0.1.0
Musical Loop Generation in Voxel World
StateMachine.hpp
Go to the documentation of this file.
1 #ifndef CORE_INCLUDE_STATEMACHINE_HPP
2 #define CORE_INCLUDE_STATEMACHINE_HPP
3 
4 #include "CoreEngine.hpp"
5 
6 class StateMachine {
7 public:
8  virtual void init() = 0;
9  virtual void cleanup() = 0;
10 
11  // Not needed in every state, so no need to make pure virtual
12  virtual void pause() = 0;
13  virtual void resume() = 0;
14 
15  virtual void handleEvents(CoreEngine *engine) = 0;
16  virtual void update(CoreEngine *engine) = 0;
17  virtual void draw(CoreEngine *engine) = 0;
18 
19  void changeState(CoreEngine *engine, StateMachine *state) {
20  engine->changeState(state);
21  }
22 
23 protected:
25 };
26 
27 #endif // CORE_INCLUDE_STATEMACHINE_HPP
The underlying engine that handles everything underneath.
Definition: CoreEngine.hpp:14
void changeState(StateMachine *state)
Definition: CoreEngine.cpp:34
Definition: StateMachine.hpp:6
virtual void handleEvents(CoreEngine *engine)=0
void changeState(CoreEngine *engine, StateMachine *state)
Definition: StateMachine.hpp:19
virtual void draw(CoreEngine *engine)=0
StateMachine()
Definition: StateMachine.hpp:24
virtual void pause()=0
virtual void update(CoreEngine *engine)=0
virtual void init()=0
virtual void cleanup()=0
virtual void resume()=0