diff --git a/data/editor.ini b/data/editor.ini index 89d04483..6b857bfa 100644 --- a/data/editor.ini +++ b/data/editor.ini @@ -2,4 +2,5 @@ width=1280 height=800 resizable=true -fullscreen=false \ No newline at end of file +fullscreen=false +vsync=false \ No newline at end of file diff --git a/data/pingpong.ini b/data/pingpong.ini index e4d2a034..70f7d190 100644 --- a/data/pingpong.ini +++ b/data/pingpong.ini @@ -2,4 +2,5 @@ width=800 height=600 resizable=false -fullscreen=false \ No newline at end of file +fullscreen=false +vsync=false \ No newline at end of file diff --git a/data/platformer.ini b/data/platformer.ini index e4d2a034..70f7d190 100644 --- a/data/platformer.ini +++ b/data/platformer.ini @@ -2,4 +2,5 @@ width=800 height=600 resizable=false -fullscreen=false \ No newline at end of file +fullscreen=false +vsync=false \ No newline at end of file diff --git a/data/racing.ini b/data/racing.ini index d28c43f1..c613fccd 100644 --- a/data/racing.ini +++ b/data/racing.ini @@ -2,4 +2,5 @@ width=600 height=600 resizable=false -fullscreen=false \ No newline at end of file +fullscreen=false +vsync=false \ No newline at end of file diff --git a/data/teamgame.ini b/data/teamgame.ini index e4d2a034..70f7d190 100644 --- a/data/teamgame.ini +++ b/data/teamgame.ini @@ -2,4 +2,5 @@ width=800 height=600 resizable=false -fullscreen=false \ No newline at end of file +fullscreen=false +vsync=false \ No newline at end of file diff --git a/data/tiles_example.ini b/data/tiles_example.ini index 5d95eb4f..00e529d4 100644 --- a/data/tiles_example.ini +++ b/data/tiles_example.ini @@ -2,4 +2,5 @@ width=800 height=600 resizable=true -fullscreen=false \ No newline at end of file +fullscreen=false +vsync=false \ No newline at end of file diff --git a/source/dagger/core/graphics/window.cpp b/source/dagger/core/graphics/window.cpp index 4b848598..bae9df42 100644 --- a/source/dagger/core/graphics/window.cpp +++ b/source/dagger/core/graphics/window.cpp @@ -138,6 +138,7 @@ void WindowSystem::SpinUp() m_Config.windowHeight = atoi(Engine::GetIniFile().GetValue("window", "height", "600")); m_Config.fullscreen = strcmp(Engine::GetIniFile().GetValue("window", "fullscreen", "false"), "true") == 0; m_Config.resizable = strcmp(Engine::GetIniFile().GetValue("window", "resizable", "false"), "true") == 0; + m_Config.vsync = strcmp(Engine::GetIniFile().GetValue("window", "vsync", "false"), "true") == 0; assert(m_Config.windowWidth > 0 && m_Config.windowHeight > 0); @@ -179,7 +180,14 @@ void WindowSystem::SpinUp() } glfwMakeContextCurrent(window); - glfwSwapInterval(0); + if (m_Config.vsync) + { + glfwSwapInterval(1); + } + else + { + glfwSwapInterval(0); + } if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { diff --git a/source/dagger/core/graphics/window.h b/source/dagger/core/graphics/window.h index 5b1f5a93..47fc6edd 100644 --- a/source/dagger/core/graphics/window.h +++ b/source/dagger/core/graphics/window.h @@ -35,6 +35,7 @@ struct RenderConfig { Bool fullscreen; Bool resizable; + Bool vsync; GLsizei windowWidth; GLsizei windowHeight; GLFWwindow* window;