Thrive
system.h
1 
2 #pragma once
3 
4 #include <memory>
5 
6 namespace luabind {
7 class scope;
8 }
9 
10 namespace thrive {
11 
12 class Engine;
13 class EntityManager;
14 class GameState;
15 
23 class System {
24 
25 public:
26 
36  static luabind::scope
37  luaBindings();
38 
42  System();
43 
47  virtual ~System() = 0;
48 
55  virtual void
56  activate();
57 
64  virtual void
65  deactivate();
66 
74  bool
75  enabled() const;
76 
84  Engine*
85  engine() const;
86 
94  entityManager() const;
95 
101  GameState*
102  gameState() const;
103 
112  virtual void
113  init(
114  GameState* gameState
115  );
116 
128  virtual void
129  initNamed(
130  std::string name,
131  GameState* gameState
132  );
133 
137  std::string
138  getName();
139 
147  void
148  setEnabled(
149  bool enabled
150  );
151 
159  virtual void
160  shutdown();
161 
178  virtual void
179  update(
180  int renderTime,
181  int logicTime
182  ) = 0;
183 
184 private:
185 
186  struct Implementation;
187  std::unique_ptr<Implementation> m_impl;
188 };
189 
190 }
Engine * engine() const
The system's engine.
Definition: system.cpp:161
std::string getName()
Returns system name.
Definition: system.cpp:207
Manages entities and their components.
Definition: entity_manager.h:23
A system handles one specific part of the game.
Definition: system.h:23
virtual void initNamed(std::string name, GameState *gameState)
Initializes the system and gives it a name.
Definition: system.cpp:197
virtual ~System()=0
Destructor.
Definition: system.cpp:139
EntityManager * entityManager() const
Returns the system's entity manager.
Definition: system.cpp:172
Definition: bullet_to_ogre_system.h:5
Definition: bullet_ogre_conversion.h:6
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
void setEnabled(bool enabled)
Sets the enabled status of this system.
Definition: system.cpp:213
virtual void shutdown()
Shuts the system down.
Definition: system.cpp:222
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
virtual void update(int renderTime, int logicTime)=0
Updates the system.
The heart of the game.
Definition: engine.h:55
bool enabled() const
Whether this system is enabled.
Definition: system.cpp:155
System()
Constructor.
Definition: system.cpp:133
virtual void activate()
Called by GameState::activate()
Definition: system.cpp:143
virtual void deactivate()
Called by GameState::deactivate()
Definition: system.cpp:149
static luabind::scope luaBindings()
Lua bindings.
Definition: system.cpp:106
virtual void init(GameState *gameState)
Initializes the system.
Definition: system.cpp:189