bool Level::load(const std::string& id) { LevelReader reader; if (!reader.readLevel(id, m_levelData)) { return false; } m_levelData.id = id; // load level m_backgroundTileMap.load(m_levelData, m_levelData.backgroundTileLayers); m_lightedForegroundTileMap.load(m_levelData, m_levelData.lightedForegroundTileLayers); m_foregroundTileMap.load(m_levelData, m_levelData.foregroundTileLayers); g_resourceManager->loadLevelResources(); return true; }
bool Level::load(const std::string& id) { LevelReader reader; if (!reader.readLevel(id, m_levelData)) { return false; } m_levelData.id = id; // load level m_backgroundTileMap.load(m_levelData.tileSetPath, m_levelData.tileSize, m_levelData.backgroundTileLayers, m_levelData.mapSize.x, m_levelData.mapSize.y); m_foregroundTileMap.load(m_levelData.tileSetPath, m_levelData.tileSize, m_levelData.foregroundTileLayers, m_levelData.mapSize.x, m_levelData.mapSize.y); tileWidth = static_cast<float>(m_levelData.tileSize.x); tileHeight = static_cast<float>(m_levelData.tileSize.y); g_resourceManager->loadLevelResources(); return true; }