From 124116a8bf56ccc742e6efcb3b9e83abe97bf143 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 26 Sep 2014 03:13:26 +0200 Subject: Extend map model with rotated tiles --- src/model/Map.cpp | 9 ++++++--- src/model/Map.hpp | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/model') diff --git a/src/model/Map.cpp b/src/model/Map.cpp index 749b25f..cb1cb30 100644 --- a/src/model/Map.cpp +++ b/src/model/Map.cpp @@ -87,8 +87,9 @@ void Map::finishEntityTransition(Entity *entity) { std::unique_ptr Map::load(__attribute__((unused)) const std::string &name) { std::unique_ptr map(new Map(16, 16, 2)); - map->tileset.push_back("dirt"); - map->tileset.push_back("horizontal_bar"); + map->tileset.emplace_back("dirt", 0); + map->tileset.emplace_back("horizontal_bar", 0); + map->tileset.emplace_back("horizontal_bar", 2); for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { @@ -100,7 +101,9 @@ std::unique_ptr Map::load(__attribute__((unused)) const std::string &name) map->setTileAt(0, Position{i, j}, 0); } - if (4 <= i && i < 12 && j == 8) + if (4 <= i && i < 12 && j == 7) + map->setTileAt(1, Position{i, j}, 3); + else if (4 <= i && i < 12 && j == 8) map->setTileAt(1, Position{i, j}, 2); else map->setTileAt(1, Position{i, j}, 0); diff --git a/src/model/Map.hpp b/src/model/Map.hpp index b8a8e18..ed58fd6 100644 --- a/src/model/Map.hpp +++ b/src/model/Map.hpp @@ -43,7 +43,7 @@ namespace Model { class _Map { protected: - std::vector tileset; + std::vector> tileset; size_t width, height; std::vector collision; @@ -160,11 +160,11 @@ public: entityStates = std::move(other.entityStates); } - std::vector & getTileset() { + std::vector> & getTileset() { return tileset; } - const std::vector & getTileset() const { + const std::vector> & getTileset() const { return tileset; } -- cgit v1.2.3