Thrive
workspace_system.h
1 #pragma once
2 
3 #include "engine/component.h"
4 #include "engine/system.h"
5 #include "engine/touchable.h"
6 
7 #include <memory>
8 
9 namespace luabind {
10  class scope;
11 }
12 
13 namespace Ogre {
14  class CompositorWorkspace;
15  class SceneManager;
16  class RenderTarget;
17 }
18 
19 namespace thrive {
20 
21 class OgreWorkspaceSystem;
22 
28 
29  friend OgreWorkspaceSystem;
30 
31  COMPONENT(OgreWorkspace)
32 
33 public:
34 
38  struct Properties : public Touchable {
39 
46  EntityId cameraEntity = NULL_ENTITY;
47 
54  int position = 0;
55  };
56 
69  static luabind::scope
70  luaBindings();
71 
81  std::string definitionName
82  );
83 
86 
87  void
88  load(
90  ) override;
91 
93  storage() const override;
94 
100  int
101  position() const;
102 
106  Properties
108 
109 
110 private:
111 
115  Ogre::CompositorWorkspace* m_workspace = nullptr;
116 
118  std::string m_name;
119 };
120 
121 
125 class OgreWorkspaceSystem : public System {
126 public:
127 
136  static luabind::scope
137  luaBindings();
138 
143 
148 
149  void
150  activate() override;
151 
152  void
153  deactivate() override;
154 
160  void init(GameState* gameState) override;
161 
165  void shutdown() override;
166 
170  void update(int, int) override;
171 
172 private:
173 
174  struct Implementation;
175  std::unique_ptr<Implementation> m_impl;
176 };
177 
178 }
void load(const StorageContainer &storage) override
Loads the component.
Definition: workspace_system.cpp:77
void activate() override
Called by GameState::activate()
Definition: workspace_system.cpp:293
EntityId cameraEntity
The camera entity to use.
Definition: workspace_system.h:46
Helper class for keeping track of changing data.
Definition: touchable.h:18
void init(GameState *gameState) override
Initializes the system.
Definition: workspace_system.cpp:306
static luabind::scope luaBindings()
Lua bindings.
Definition: workspace_system.cpp:52
int position() const
The workspace's position.
Properties.
Definition: workspace_system.h:38
~OgreWorkspaceSystem()
Destructor.
Definition: workspace_system.cpp:289
OgreWorkspaceSystem()
Constructor.
Definition: workspace_system.cpp:283
Base class for components.
Definition: component.h:31
int position
Defines the order in which workspaces are rendered.
Definition: workspace_system.h:54
A proxy for Ogre::Workspace.
Definition: workspace_system.h:27
A system handles one specific part of the game.
Definition: system.h:23
Creates, updates and removes workspaces.
Definition: workspace_system.h:125
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
Properties m_properties
Properties.
Definition: workspace_system.h:107
void update(int, int) override
Updates the system.
Definition: workspace_system.cpp:324
void deactivate() override
Called by GameState::deactivate()
Definition: workspace_system.cpp:300
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
void shutdown() override
Shuts the system down.
Definition: workspace_system.cpp:316
Definition: debug_drawing.h:8
static luabind::scope luaBindings()
Lua bindings.
Definition: workspace_system.cpp:103
OgreWorkspaceComponent()
dummy constructor for REGISTER_COMPONENT to not error
Definition: workspace_system.cpp:71
StorageContainer storage() const override
Serializes the component.
Definition: workspace_system.cpp:88
A key-value storage for serialization.
Definition: serialization.h:36