From 4be18ff9fe259036c6c9a0f1c3577aff1023238c Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 2 May 2020 14:53:43 -0700 Subject: [PATCH] Add v-sync hint This is because otherwise, on my Linux system at least, the game will take up a lot of CPU that it doesn't really need to (I only have a 60hz monitor). On Windows, it looks like Windows already enforces V-sync for applications anyway, unless they have exclusive fullscreen control. Linux doesn't enforce V-sync on apps and lets them take up as much CPU as they want, so I'm putting this here to limit the framerate. The game is already actually 30 FPS anyway, the nice smooth FPS is just visual. V-sync won't introduce any more "input lag" than already exists. --- desktop_version/src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index 25b653eb..93354e2e 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -108,6 +108,8 @@ int main(int argc, char *argv[]) } } + SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, "1", SDL_HINT_OVERRIDE); + if(!FILESYSTEM_init(argv[0], baseDir, assetsPath)) { return 1;