]> git.localhorst.tv Git - blobs.git/blob - src/world/Simulation.hpp
31489c6de7aef91e20c93c1164771260eb251e62
[blobs.git] / src / world / Simulation.hpp
1 #ifndef BLOBS_WORLD_SIMULATION_HPP_
2 #define BLOBS_WORLD_SIMULATION_HPP_
3
4 #include "Set.hpp"
5 #include "../app/Assets.hpp"
6
7 #include <set>
8
9
10 namespace blobs {
11 namespace world {
12
13 class Body;
14 class Planet;
15 class Resource;
16 class Sun;
17 class TileType;
18
19 class Simulation {
20
21 public:
22         explicit Simulation(Body &root, app::Assets &);
23         ~Simulation();
24
25         Simulation(const Simulation &) = delete;
26         Simulation &operator =(const Simulation &) = delete;
27
28         Simulation(Simulation &&) = delete;
29         Simulation &operator =(Simulation &&) = delete;
30
31 public:
32         void Tick(double dt);
33
34         void AddBody(Body &);
35         void AddPlanet(Planet &);
36         void AddSun(Sun &);
37
38         Body &Root() noexcept { return root; }
39         const Body &Root() const noexcept { return root; }
40
41         app::Assets &Assets() noexcept { return assets; }
42         const app::Assets &Assets() const noexcept { return assets; }
43         const Set<Resource> &Resources() const noexcept { return assets.data.resources; }
44         const Set<TileType> &TileTypes() const noexcept { return assets.data.tile_types; }
45
46         const std::set<Body *> &Bodies() const noexcept { return bodies; }
47         const std::set<Planet *> &Planets() const noexcept { return planets; }
48         const std::set<Sun *> &Suns() const noexcept { return suns; }
49
50         double Time() const noexcept { return time; }
51
52 private:
53         Body &root;
54         app::Assets &assets;
55         std::set<Body *> bodies;
56         std::set<Planet *> planets;
57         std::set<Sun *> suns;
58         double time;
59
60 };
61
62 }
63 }
64
65 #endif