summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/Map.cpp9
-rw-r--r--src/model/Map.hpp6
-rw-r--r--src/view/MapView.cpp4
-rw-r--r--src/view/MapView.hpp2
4 files changed, 12 insertions, 9 deletions
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> Map::load(__attribute__((unused)) const std::string &name) {
std::unique_ptr<Map> 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> Map::load(__attribute__((unused)) const std::string &name)
map->setTileAt(0, Position<int>{i, j}, 0);
}
- if (4 <= i && i < 12 && j == 8)
+ if (4 <= i && i < 12 && j == 7)
+ map->setTileAt(1, Position<int>{i, j}, 3);
+ else if (4 <= i && i < 12 && j == 8)
map->setTileAt(1, Position<int>{i, j}, 2);
else
map->setTileAt(1, Position<int>{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<std::string> tileset;
+ std::vector<std::pair<std::string, int>> tileset;
size_t width, height;
std::vector<CollisionType> collision;
@@ -160,11 +160,11 @@ public:
entityStates = std::move(other.entityStates);
}
- std::vector<std::string> & getTileset() {
+ std::vector<std::pair<std::string, int>> & getTileset() {
return tileset;
}
- const std::vector<std::string> & getTileset() const {
+ const std::vector<std::pair<std::string, int>> & getTileset() const {
return tileset;
}
diff --git a/src/view/MapView.cpp b/src/view/MapView.cpp
index c1c0639..20d5af5 100644
--- a/src/view/MapView.cpp
+++ b/src/view/MapView.cpp
@@ -31,7 +31,7 @@ namespace RPGEdit {
namespace View {
-MapView::MapView(const std::shared_ptr<Window> &window0, const std::vector<std::string> &tileset)
+MapView::MapView(const std::shared_ptr<Window> &window0, const std::vector<std::pair<std::string, int>> &tileset)
: window(window0) {
uint32_t rmask, gmask, bmask, amask;
@@ -59,7 +59,7 @@ MapView::MapView(const std::shared_ptr<Window> &window0, const std::vector<std::
.h = 0,
};
- SDL_Surface *sprite = spriteCache->get("tile", tileset[i], 0);
+ SDL_Surface *sprite = spriteCache->get("tile", tileset[i].first, tileset[i].second);
SDL_SetSurfaceBlendMode(sprite, SDL_BLENDMODE_NONE);
SDL_BlitSurface(sprite, nullptr, surface, &rect);
diff --git a/src/view/MapView.hpp b/src/view/MapView.hpp
index 9a27328..c5867cc 100644
--- a/src/view/MapView.hpp
+++ b/src/view/MapView.hpp
@@ -50,7 +50,7 @@ private:
}
public:
- MapView(const std::shared_ptr<Window> &window0, const std::vector<std::string> &tileset);
+ MapView(const std::shared_ptr<Window> &window0, const std::vector<std::pair<std::string, int>> &tileset);
~MapView();
void updateEntities(const std::vector<std::unique_ptr<Model::Entity>> &entities);