From f20e711380d67bc3966c8c4e1b8ace62b969d4d2 Mon Sep 17 00:00:00 2001 From: Alan Youngblood Date: Sun, 13 Aug 2023 17:27:07 -0400 Subject: [PATCH] Tilemap doesn't use hardcoded path instead uses generated path from Game.cpp --- .DS_Store | Bin 10244 -> 10244 bytes src/ecs/TileMapComponent.h | 4 ++-- src/game/Game.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.DS_Store b/.DS_Store index e632dd3ef2a76217ad666d95374c17d861dcff6d..16f259154bb0d2b677ca4e271a195d4e5c54a311 100644 GIT binary patch delta 74 zcmZn(XbIS0C&aj8vb|8DxxsZvYA?nj)I|qsX?udLba)(fsTTyxmj&3Cx@uAzI9N1 gc1~_ye$V9VLh_8go4*V3@or{U_{FmMzX&rk0AcDEO8@`> diff --git a/src/ecs/TileMapComponent.h b/src/ecs/TileMapComponent.h index 1973083..3dba7cf 100644 --- a/src/ecs/TileMapComponent.h +++ b/src/ecs/TileMapComponent.h @@ -46,8 +46,8 @@ public: { // TILESON ~~~~~~~~~~~ - //const std::filesystem::path jsonPath = std::filesystem::u8path(mapPath); - const std::filesystem::path jsonPath = std::filesystem::u8path("/Users/ayoungblood/Projects/KaijuSaveEarth/assets/maps/kaiju-city-map.json"); + const std::filesystem::path jsonPath = std::filesystem::u8path(mapPath); + //const std::filesystem::path jsonPath = std::filesystem::u8path("/Users/ayoungblood/Projects/KaijuSaveEarth/assets/maps/kaiju-city-map.json"); map = t.parse(jsonPath); //std::cout << "Trying to load json tile map from: " << jsonPath << std::endl; if(map->getStatus() == tson::ParseStatus::OK) diff --git a/src/game/Game.cpp b/src/game/Game.cpp index 3f4dc24..54ce1b9 100644 --- a/src/game/Game.cpp +++ b/src/game/Game.cpp @@ -191,7 +191,8 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g levelMap.y = 0; // printf("Trying to load Tilemap\n"); - gameScene.addComponent("assets/maps/kaiju-city-map.json","kaiju-city","Tile Layer 1","Collision",gScale,player.getComponent().position.x+player.getComponent().width/2,player.getComponent().position.y+player.getComponent().height/2); //150,100 + std::string mapPath = Game::projPath + "assets/maps/kaiju-city-map.json"; + gameScene.addComponent(mapPath,"kaiju-city","Tile Layer 1","Collision",gScale,player.getComponent().position.x+player.getComponent().width/2,player.getComponent().position.y+player.getComponent().height/2); //150,100 gameScene.addGroup(groupMap); // printf("Completed loading Tilemap\n");