diff options
Diffstat (limited to 'src/game.h')
-rw-r--r-- | src/game.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/game.h b/src/game.h index e5976b1..2c1680a 100644 --- a/src/game.h +++ b/src/game.h | |||
@@ -4,8 +4,9 @@ | |||
4 | #include <set> | 4 | #include <set> |
5 | #include <range/v3/all.hpp> | 5 | #include <range/v3/all.hpp> |
6 | #include <vector> | 6 | #include <vector> |
7 | #include <tileson.hpp> | 7 | #include <memory> |
8 | #include "sprite.h" | 8 | #include "sprite.h" |
9 | #include "map.h" | ||
9 | 10 | ||
10 | struct Input { | 11 | struct Input { |
11 | bool left = false; | 12 | bool left = false; |
@@ -55,18 +56,15 @@ public: | |||
55 | } | 56 | } |
56 | } | 57 | } |
57 | 58 | ||
58 | void loadMapFromFile(std::string_view filename) { | 59 | void setMap(std::unique_ptr<Map> map) { map_ = std::move(map); } |
59 | tson::Tileson t; | ||
60 | map_ = t.parse(fs::path(filename)); | ||
61 | } | ||
62 | 60 | ||
63 | tson::Map* getMap() const { return map_.get(); } | 61 | const Map& getMap() const { return *map_; } |
64 | 62 | ||
65 | private: | 63 | private: |
66 | 64 | ||
67 | std::vector<Sprite> sprites_; | 65 | std::vector<Sprite> sprites_; |
68 | std::set<std::tuple<int, int>> spritesByY_; | 66 | std::set<std::tuple<int, int>> spritesByY_; |
69 | std::unique_ptr<tson::Map> map_; | 67 | std::unique_ptr<Map> map_; |
70 | }; | 68 | }; |
71 | 69 | ||
72 | #endif /* end of include guard: GAME_H_E6F1396E */ | 70 | #endif /* end of include guard: GAME_H_E6F1396E */ |