[ADD] The scene switching works now, the only thing to do is controling the scenes with the keys!

This commit is contained in:
Lars
2021-05-28 16:04:41 +02:00
parent 93b3223737
commit 5d31327a47
7 changed files with 133 additions and 139 deletions

View File

@@ -5,13 +5,19 @@
namespace scene
{
std::map<Scenes, Scene*> scenes;
Scene* current_scene;
GLFWwindow* window;
void scene::Startup_Scene::start()
scene::Scenes scene::Startup_Scene::start(GLFWwindow *window)
{
while (return_value == scene::Scenes::STARTUP)
{
render();
update(window);
glfwSwapBuffers(window);
glfwPollEvents();
}
return return_value;
}
void scene::Startup_Scene::render()
@@ -19,17 +25,16 @@ namespace scene
}
void scene::Startup_Scene::update()
void scene::Startup_Scene::update(GLFWwindow* window)
{
}
void scene::Startup_Scene::onKey(int key, int scancode, int action, int mods)
void scene::Startup_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
{
current_scene = scenes[Scenes::INGAME];
current_scene->start();
return_value = scene::Scenes::INGAME;
}
}
}