void Application::Run() { sf::RenderWindow window(sf::VideoMode(RESOLUTION_X, RESOLUTION_Y), "Lol", sf::Style::Fullscreen); //sf::RenderWindow window(sf::VideoMode(RESOLUTION_X, RESOLUTION_Y), "PLACEHOLDER"); window.setFramerateLimit(60); // Game loop while(window.isOpen()) { frameTime = frameClock.restart(); ManageEvents(&window); // Get events (input, etc.) Process(&window); // Handle game logic, main mechanics Render(&window); // Display graphics } }
void Game::Start() { DEBUG_ASSERT(m_CurrentScene.get() != NULL); Uint32 lastTime = SDL_GetTicks(); m_Quit = false; while(!m_Quit) { // CLEAR SCREEN m_DisplayContext.SetColor(Color::Black); m_DisplayContext.ClearScreen(); // MANAGE INPUT DEVICES m_KeyboardDevice.Update(); // MANAGE EVENTS ManageEvents(); Uint32 currentTime = SDL_GetTicks(); double deltaTime = (double)(currentTime - lastTime) / 1000.0; lastTime = currentTime; // MANAGE CURRENT SCENE m_CurrentScene->Update(deltaTime); m_Framerate.Update(deltaTime); // RENDER GAME OBJECTS m_CurrentScene->Render(&m_DisplayContext); m_Framerate.Render(&m_DisplayContext); // FLIP (SWAP) DISPLAY BUFFERS m_DisplayContext.Flip(); #ifdef USE_FRAMERATE_LIMITER m_Framerate.LimitFramerate(); #endif } }
void CInputManager::Update() { m_keyboardController->Update(); m_mouseController->Update(); ProcessGestures(); ManageEvents(); }