From 7166c9b831f9c6a50ba42272682b776d01e5703e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 2 Feb 2021 13:01:35 -0500 Subject: Map rendering Works but I don't want to use Tileson so I'm gonna change that Mainly bc Tileson requires std::filesystem, which my clang is too old for apparently, and while I can use gcc instead I just want to not, I suppose. Also Tileson's API is very weird RE const correctness? Idk. And also being able to parse the tmx files rather than exporting to json would be preferable. --- src/game.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/game.h') diff --git a/src/game.h b/src/game.h index 274ef2e..e5976b1 100644 --- a/src/game.h +++ b/src/game.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "sprite.h" struct Input { @@ -54,10 +55,18 @@ public: } } + void loadMapFromFile(std::string_view filename) { + tson::Tileson t; + map_ = t.parse(fs::path(filename)); + } + + tson::Map* getMap() const { return map_.get(); } + private: std::vector sprites_; std::set> spritesByY_; + std::unique_ptr map_; }; #endif /* end of include guard: GAME_H_E6F1396E */ -- cgit 1.4.1