From 9d7fb64cdffb61dc7a5ce8cb7dab6d93c7fd5aa4 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 28 Sep 2019 01:31:08 +1000 Subject: [PATCH] SDL: Default to vsync, tab to disable --- src/pse-sdl/sdl_interface.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pse-sdl/sdl_interface.cpp b/src/pse-sdl/sdl_interface.cpp index 3f372d5ff..0b5c046d8 100644 --- a/src/pse-sdl/sdl_interface.cpp +++ b/src/pse-sdl/sdl_interface.cpp @@ -88,11 +88,11 @@ bool SDLInterface::CreateGLContext() if (GLAD_GL_KHR_debug) { glad_glDebugMessageCallbackKHR(GLDebugCallback, nullptr); - glEnable(GL_DEBUG_OUTPUT); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + // glEnable(GL_DEBUG_OUTPUT); + // glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } - SDL_GL_SetSwapInterval(0); + SDL_GL_SetSwapInterval(1); return true; } @@ -277,6 +277,10 @@ bool SDLInterface::HandleSDLEvent(const SDL_Event* event) m_controller->SetButtonState(DigitalController::Button::Select, pressed); return true; + case SDL_SCANCODE_TAB: + SDL_GL_SetSwapInterval(pressed ? 0 : 1); + break; + default: break; } @@ -582,6 +586,8 @@ void SDLInterface::Run() m_system->RunFrame(); + Render(); + // update fps counter { const double time = m_fps_timer.GetTimeSeconds(); @@ -595,7 +601,5 @@ void SDLInterface::Run() m_fps_timer.Reset(); } } - - Render(); } }