diff options
Diffstat (limited to 'src/map.cpp')
| -rw-r--r-- | src/map.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
| diff --git a/src/map.cpp b/src/map.cpp index b6f6755..99711c6 100644 --- a/src/map.cpp +++ b/src/map.cpp | |||
| @@ -4,9 +4,8 @@ | |||
| 4 | #include <tmxlite/Property.hpp> | 4 | #include <tmxlite/Property.hpp> |
| 5 | #include <tmxlite/TileLayer.hpp> | 5 | #include <tmxlite/TileLayer.hpp> |
| 6 | #include <tmxlite/Tileset.hpp> | 6 | #include <tmxlite/Tileset.hpp> |
| 7 | #include "renderer.h" | ||
| 8 | 7 | ||
| 9 | Map::Map(std::string_view filename, Renderer& renderer) { | 8 | Map::Map(std::string_view filename) : filename_(filename) { |
| 10 | tmx::Map mapfile; | 9 | tmx::Map mapfile; |
| 11 | if (!mapfile.load(filename.data())) { | 10 | if (!mapfile.load(filename.data())) { |
| 12 | throw std::invalid_argument("Could not find map file: " + std::string(filename)); | 11 | throw std::invalid_argument("Could not find map file: " + std::string(filename)); |
| @@ -24,7 +23,7 @@ Map::Map(std::string_view filename, Renderer& renderer) { | |||
| 24 | // There should only be one tileset. | 23 | // There should only be one tileset. |
| 25 | const tmx::Tileset& tileset = mapfile.getTilesets()[0]; | 24 | const tmx::Tileset& tileset = mapfile.getTilesets()[0]; |
| 26 | firstGID = tileset.getFirstGID(); | 25 | firstGID = tileset.getFirstGID(); |
| 27 | tilesetTextureId_ = renderer.loadImageFromFile(tileset.getImagePath()); | 26 | tilesetFilename_ = tileset.getImagePath(); |
| 28 | tilesetColumns_ = tileset.getColumnCount(); | 27 | tilesetColumns_ = tileset.getColumnCount(); |
| 29 | 28 | ||
| 30 | for (const auto& layer : mapfile.getLayers()) { | 29 | for (const auto& layer : mapfile.getLayers()) { |
