From e5c808f2cbabd1262392a18a68e30009dd020b61 Mon Sep 17 00:00:00 2001 From: jonylu7 Date: Sun, 10 Mar 2024 13:35:26 +0800 Subject: [PATCH] get map tile and set --- include/Map.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/Map.hpp b/include/Map.hpp index a3fda367..36908f02 100644 --- a/include/Map.hpp +++ b/include/Map.hpp @@ -80,6 +80,16 @@ class MapClass : public Core::Drawable { return m_Map[position.x][position.y]; } + void setTileByCellPosition(glm::vec2 position, + std::shared_ptr tile) { + if (position.x > m_MapWdith - 1 || position.y > m_MapHeight - 1 || + position.x < 0 || position.y < 0) { + LOG_DEBUG("False Position Getting"); + return; + } + m_Map[position.x][position.y] = tile; + } + // weird static std::vector> readMapAndTileSet(std::vector map, std::map tileset) {