void Application::Run() { //Main Loop Scene *scene = new Assignment3(); scene->Init(); m_timer.startTimer(); // Start timer to calculate how long it takes to render this frame while (!glfwWindowShouldClose(m_window) && !IsKeyPressed(VK_ESCAPE)) { scene->Update(m_timer.getElapsedTime()); scene->Render(); //Swap buffers glfwSwapBuffers(m_window); //Get and organize events, like keyboard and mouse input, window resizing, etc... glfwPollEvents(); m_timer.waitUntil(frameTime); // Frame rate limiter. Limits each frame to a specified time in ms. } //Check if the ESC key had been pressed or if the window had been closed scene->Exit(); delete scene; }
void Application::Run() { //Main Loop Scene *scene = new SP2Scene(); scene->Init(); m_timer.startTimer(); // Start timer to calculate how long it takes to render this frame while (!glfwWindowShouldClose(m_window) && SharedData::GetInstance()->Exit == false) { glfwGetWindowSize(m_window, &SharedData::GetInstance()->Current_MonitorWidth, &SharedData::GetInstance()->Current_MonitorHeight); scene->Update(m_timer.getElapsedTime()); scene->Render(); //Swap buffers glfwSwapBuffers(m_window); //Get and organize events, like keyboard and mouse input, window resizing, etc... glfwPollEvents(); m_timer.waitUntil(frameTime); // Frame rate limiter. Limits each frame to a specified time in ms. } //Check if the ESC key had been pressed or if the window had been closed scene->Exit(); delete scene; }
void Application::Run() { //Main Loop Scene *scene0 = new MAINMENU(); Scene *scene1 = new SP2(); Scene *scene2 = new PLANET1(); Scene *scene3 = new PLANET2(); Scene *scene4 = new PLANET3(); Scene *scene5 = new PLANET4(); Scene *scene6 = new PLANET5(); Scene *currScene = scene5; scene0->Init(); scene1->Init(); scene2->Init(); scene3->Init(); scene4->Init(); scene5->Init(); scene6->Init(); m_timer.startTimer(); // Start timer to calculate how long it takes to render this frame while ((!glfwWindowShouldClose(m_window) && !(c_UserInterface::GetEnum()->quitGame))) { if (IsKeyPressed('P')) { currScene = scene0; } if (GameMode::GetInstance()->gameState == 1) { currScene = scene1; } else if (GameMode::GetInstance()->gameState == 2) { currScene = scene2; } else if (GameMode::GetInstance()->gameState == 3) { currScene = scene3; } else if (GameMode::GetInstance()->gameState == 4) { currScene = scene4; } else if (GameMode::GetInstance()->gameState == 5) { currScene = scene5; } else if (GameMode::GetInstance()->gameState == 6) { currScene = scene6; GameMode::GetInstance()->gameState = 0; } currScene->Update(m_timer.getElapsedTime()); currScene->Render(); //Swap buffers glfwSwapBuffers(m_window); //Get and organize events, like keyboard and mouse input, window resizing, etc... glfwPollEvents(); m_timer.waitUntil(frameTime); // Frame rate limiter. Limits each frame to a specified time in ms. } //Check if the ESC key had been pressed or if the window had been closed currScene->Exit(); delete currScene; }