summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Render.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Render.cpp b/src/Render.cpp
index b19b679..9c6cb38 100644
--- a/src/Render.cpp
+++ b/src/Render.cpp
@@ -496,6 +496,10 @@ void Render::RenderGui() {
ImGui::Checkbox("Wireframe", &wireframe);
+ static bool vsync = false;
+
+ ImGui::Checkbox("VSync", &vsync);
+
if (ImGui::Button("Apply settings")) {
if (distance != world->MaxRenderingDistance) {
world->MaxRenderingDistance = distance;
@@ -507,6 +511,12 @@ void Render::RenderGui() {
isWireframe = wireframe;
timer.SetDelayLength(std::chrono::duration<double, std::milli>(1.0 / targetFps * 1000.0));
+ if (vsync) {
+ timer.SetDelayLength(std::chrono::milliseconds(0));
+ SDL_GL_SetSwapInterval(1);
+ } else
+ SDL_GL_SetSwapInterval(0);
+
}
ImGui::Separator();