summary refs log tree commit diff stats
path: root/src/map.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-09 22:28:27 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-09 22:28:27 -0500
commit5931470800c43260f600303d1231dbaf586f26fc (patch)
treeaaaa30ee6bae81c1badc8b70d2fbdce33a058d5a /src/map.cpp
parent315ca2fb388f790791c9ce372cf44e00d51e0e7f (diff)
downloadtanetane-5931470800c43260f600303d1231dbaf586f26fc.tar.gz
tanetane-5931470800c43260f600303d1231dbaf586f26fc.tar.bz2
tanetane-5931470800c43260f600303d1231dbaf586f26fc.zip
Map changing!
Also removed some dependencies on the Renderer. More changes need to be made. Fading to black before the change would be good. And making sure the characters are facing the right direction. Maybe that code shouldn't live in Game, either. Later we also want to combine the tilesets for these two maps (and any others that are on Tanetane).
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp5
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
9Map::Map(std::string_view filename, Renderer& renderer) { 8Map::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()) {