Moved decision of which map to load to Config.ini
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
[Debug]
|
[Debug]
|
||||||
LogLevel=1
|
LogLevel=1
|
||||||
|
LoadMap=
|
||||||
|
|
||||||
[Video]
|
[Video]
|
||||||
Fullscreen=false
|
Fullscreen=false
|
||||||
|
|||||||
+11
-4
@@ -37,6 +37,10 @@ Game::Game(int argc, char* argv[])
|
|||||||
|
|
||||||
// Create a world
|
// Create a world
|
||||||
m_World = new World();
|
m_World = new World();
|
||||||
|
std::string mapToLoad = m_Config->Get<std::string>("Debug.LoadMap", "");
|
||||||
|
if (!mapToLoad.empty()) {
|
||||||
|
ResourceManager::Load<EntityXMLFile>(mapToLoad)->PopulateWorld(m_World);
|
||||||
|
}
|
||||||
|
|
||||||
m_LastTime = glfwGetTime();
|
m_LastTime = glfwGetTime();
|
||||||
|
|
||||||
@@ -75,10 +79,13 @@ void Game::Tick()
|
|||||||
bool Game::testOnKeyUp(const Events::KeyUp& e)
|
bool Game::testOnKeyUp(const Events::KeyUp& e)
|
||||||
{
|
{
|
||||||
if (e.KeyCode == GLFW_KEY_R) {
|
if (e.KeyCode == GLFW_KEY_R) {
|
||||||
delete m_World;
|
std::string mapToLoad = m_Config->Get<std::string>("Debug.LoadMap", "");
|
||||||
m_World = new World();
|
if (!mapToLoad.empty()) {
|
||||||
ResourceManager::Release("EntityXMLFile", "Schema/Entities/Test.xml");
|
delete m_World;
|
||||||
ResourceManager::Load<EntityXMLFile>("Schema/Entities/Test.xml")->PopulateWorld(m_World);
|
m_World = new World();
|
||||||
|
ResourceManager::Release("EntityXMLFile", mapToLoad);
|
||||||
|
ResourceManager::Load<EntityXMLFile>(mapToLoad)->PopulateWorld(m_World);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user