Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
world.h
1 #pragma once
2 
3 #include <memory>
4 #include <unordered_set>
5 
6 
7 class EventPoller;
8 class FactionMatrix;
9 class God;
10 class MissionSystem;
11 class Player;
12 class Ship;
13 class Skybox;
14 class ScriptEngine;
16 class WorldObject;
17 class WorldLogic;
18 class WorldTree;
19 
20 class World {
21 public:
22  World();
23  virtual ~World();
24 
25  Player& player();
26  Skybox& skybox();
27  WorldLogic& worldLogic();
28  God& god();
29  WorldTree& worldTree();
30  ScriptEngine& scriptEngine();
31  VoxelParticleEngine& particleEngine();
32  FactionMatrix& factionMatrix();
33  EventPoller& eventPoller();
34  MissionSystem& missionSystem();
35 
36  std::unordered_set<WorldObject*>& worldObjects();
37  std::unordered_set<Ship*>& ships();
38 
39  void printStatus();
40 
41  void update(float deltaSecs);
42 
43  float deltaSec() const;
44 
45  static World* instance();
46  static void reset(bool showWarning=true);
47 
48 
49 protected:
50  friend class God;
51 
52  void addWorldObject(WorldObject* worldObject);
53  void removeWorldObject(WorldObject* worldObject);
54 
55 protected:
56  static World* s_instance;
57 
58  float m_deltaSec;
59 
60  std::unique_ptr<Player> m_player;
61  std::unique_ptr<ScriptEngine> m_scriptEngine;
62  std::unique_ptr<Skybox> m_skybox;
63  std::unique_ptr<WorldTree> m_worldTree;
64  std::unique_ptr<WorldLogic> m_worldLogic;
65  std::unique_ptr<God> m_god;
66  std::unique_ptr<VoxelParticleEngine> m_particleEngine;
67  std::unique_ptr<FactionMatrix> m_factionMatrix;
68  std::unique_ptr<EventPoller> m_eventPoller;
69  std::unique_ptr<MissionSystem> m_missionSystem;
70 
71  std::unordered_set<WorldObject*> m_worldObjects;
72  std::unordered_set<Ship*> m_ships;
73 };
74 
Definition: worldobject.h:43
Definition: voxelparticleengine.h:23
Definition: world.h:20
Definition: skybox.h:16
Definition: eventpoller.h:9
Definition: worldlogic.h:19
Definition: missionsystem.h:9
Definition: god.h:19
Definition: factionmatrix.h:14
Definition: player.h:22
Definition: scriptengine.h:17
Definition: ship.h:23
Definition: worldtree.h:13