]> git.localhorst.tv Git - blobs.git/blob - src/app/Assets.hpp
load universe from file
[blobs.git] / src / app / Assets.hpp
1 #ifndef BLOBS_APP_ASSETS_HPP_
2 #define BLOBS_APP_ASSETS_HPP_
3
4 #include "../creature/NameGenerator.hpp"
5 #include "../graphics/AlphaSprite.hpp"
6 #include "../graphics/ArrayTexture.hpp"
7 #include "../graphics/Canvas.hpp"
8 #include "../graphics/CreatureSkin.hpp"
9 #include "../graphics/CubeMap.hpp"
10 #include "../graphics/Font.hpp"
11 #include "../graphics/PlanetSurface.hpp"
12 #include "../graphics/SkyBox.hpp"
13 #include "../graphics/SunSurface.hpp"
14 #include "../math/GaloisLFSR.hpp"
15 #include "../world/Resource.hpp"
16 #include "../world/Set.hpp"
17 #include "../world/TileType.hpp"
18
19 #include <string>
20
21
22 namespace blobs {
23 namespace io {
24         class TokenStreamReader;
25 }
26 namespace world {
27         class Body;
28         class Planet;
29         class Simulation;
30         class Sun;
31 }
32 namespace app {
33
34 struct Assets {
35
36         std::string path;
37         std::string data_path;
38         std::string font_path;
39         std::string skin_path;
40         std::string sky_path;
41         std::string tile_path;
42
43         math::GaloisLFSR random;
44
45         creature::NameGenerator name;
46
47         struct {
48                 world::Set<world::Resource> resources;
49                 world::Set<world::TileType> tile_types;
50         } data;
51
52         struct {
53                 graphics::Font large;
54                 graphics::Font medium;
55                 graphics::Font small;
56         } fonts;
57
58         struct {
59                 graphics::ArrayTexture tiles;
60                 graphics::ArrayTexture skins;
61                 graphics::CubeMap sky;
62         } textures;
63
64         struct {
65                 graphics::AlphaSprite alpha_sprite;
66                 graphics::Canvas canvas;
67                 graphics::PlanetSurface planet_surface;
68                 graphics::SunSurface sun_surface;
69                 graphics::CreatureSkin creature_skin;
70                 graphics::SkyBox sky_box;
71         } shaders;
72
73         Assets();
74         ~Assets();
75
76         Assets(const Assets &) = delete;
77         Assets &operator =(const Assets &) = delete;
78
79         Assets(Assets &&) = delete;
80         Assets &operator =(Assets &&) = delete;
81
82         void ReadResources(io::TokenStreamReader &);
83         void ReadTileTypes(io::TokenStreamReader &);
84
85         void LoadTileTexture(const std::string &name, graphics::ArrayTexture &, int layer) const;
86         void LoadSkinTexture(const std::string &name, graphics::ArrayTexture &, int layer) const;
87         void LoadSkyTexture(const std::string &name, graphics::CubeMap &) const;
88
89         void LoadUniverse(const std::string &name, world::Simulation &) const;
90         world::Body *ReadBody(io::TokenStreamReader &, world::Simulation &) const;
91         void ReadBodyProperty(const std::string &name, io::TokenStreamReader &, world::Body &, world::Simulation &) const;
92         void ReadPlanetProperty(const std::string &name, io::TokenStreamReader &, world::Planet &, world::Simulation &) const;
93         void ReadSunProperty(const std::string &name, io::TokenStreamReader &, world::Sun &, world::Simulation &) const;
94
95 };
96
97 }
98 }
99
100 #endif