summaryrefslogtreecommitdiffstats
path: root/src/Render.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-12 13:20:05 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:34 +0100
commit6665821972afe7c44a7b602dc27326d2fe211f8a (patch)
tree58efe77d4a2a45796871d679ee3d58ec5d3ed12d /src/Render.cpp
parentThere is no more latency in PUSH_EVENT, so DIRECT_EVENT_CALL can be replaced with PUSH_EVENT (diff)
downloadAltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.tar
AltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.tar.gz
AltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.tar.bz2
AltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.tar.lz
AltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.tar.xz
AltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.tar.zst
AltCraft-6665821972afe7c44a7b602dc27326d2fe211f8a.zip
Diffstat (limited to 'src/Render.cpp')
-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();