Thrive
compound.h
1 #pragma once
2 
3 #include <boost/range/adaptor/map.hpp>
4 
5 #include "engine/component.h"
6 #include "engine/system.h"
7 #include "engine/touchable.h"
8 #include "scripting/luabind.h"
9 #include "engine/typedefs.h"
10 
11 #include <luabind/object.hpp>
12 #include <memory>
13 #include <OgreCommon.h>
14 #include <OgreMath.h>
15 #include <OgreVector3.h>
16 #include <unordered_set>
17 
18 namespace luabind {
19 class scope;
20 }
21 
22 
23 namespace thrive {
24 
25 using BoostCompoundMapIterator = boost::range_detail::select_second_mutable_range<std::unordered_map<std::string, CompoundId>>;
26 using BoostAbsorbedMapIterator = boost::range_detail::select_first_range<std::unordered_map<CompoundId, float>>;
27 
28 //static const CompoundId NULL_COMPOUND = 0;
29 
30 CompoundId
31 generateCompoundId();
32 
37 class CompoundComponent : public Component {
38  COMPONENT(Compound)
39 
40 public:
41 
53  static luabind::scope
54  luaBindings();
55 
59  CompoundId m_compoundId;// = NULL_COMPOUND;
60 
64  float m_potency = 0.0f;
65 
69  Ogre::Vector3 m_velocity = Ogre::Vector3::ZERO;
70 
71  void
72  load(
74  ) override;
75 
77  storage() const override;
78 
79 };
80 
81 
86 
87 public:
88 
97  static luabind::scope
98  luaBindings();
99 
104 
109 
114  void init(GameState* gameState) override;
115 
119  void shutdown() override;
120 
124  void update(int, int) override;
125 
126 private:
127 
128  struct Implementation;
129  std::unique_ptr<Implementation> m_impl;
130 };
131 
132 }
static luabind::scope luaBindings()
Lua bindings.
Definition: compound.cpp:32
static luabind::scope luaBindings()
Lua bindings.
Definition: compound.cpp:75
CompoundMovementSystem()
Constructor.
Definition: compound.cpp:92
~CompoundMovementSystem()
Destructor.
Definition: compound.cpp:98
Base class for components.
Definition: component.h:31
A system handles one specific part of the game.
Definition: system.h:23
Moves compound particles around.
Definition: compound.h:85
void load(const StorageContainer &storage) override
Loads the component.
Definition: compound.cpp:50
Definition: bullet_to_ogre_system.h:5
CompoundId m_compoundId
The compound id.
Definition: compound.h:59
Definition: bullet_ogre_conversion.h:6
Ogre::Vector3 m_velocity
The current velocity of the particle.
Definition: compound.h:69
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
void update(int, int) override
Updates the system.
Definition: compound.cpp:118
float m_potency
The potency of this particle.
Definition: compound.h:64
StorageContainer storage() const override
Serializes the component.
Definition: compound.cpp:61
void shutdown() override
Shuts the system down.
Definition: compound.cpp:111
void init(GameState *gameState) override
Initializes the system.
Definition: compound.cpp:102
A key-value storage for serialization.
Definition: serialization.h:36
Component for entities that act as compound particles or agent particles Note that this class is stro...
Definition: compound.h:37