Browse Source

Add "frameRateSync" to settings.json

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
d83d2e0dff
3 changed files with 11 additions and 1 deletions
  1. +1
    -0
      include/settings.hpp
  2. +9
    -0
      src/settings.cpp
  3. +1
    -1
      src/window.cpp

+ 1
- 0
include/settings.hpp View File

@@ -19,6 +19,7 @@ extern bool lockModules;
extern bool checkVersion;
extern bool skipLoadOnLaunch;
extern float frameRateLimit;
extern bool frameRateSync;


} // namespace settings


+ 9
- 0
src/settings.cpp View File

@@ -80,6 +80,9 @@ static json_t *settingsToJson() {
// frameRateLimit
json_object_set_new(rootJ, "frameRateLimit", json_real(frameRateLimit));

// frameRateSync
json_object_set_new(rootJ, "frameRateSync", json_boolean(frameRateSync));

return rootJ;
}

@@ -171,6 +174,11 @@ static void settingsFromJson(json_t *rootJ) {
json_t *frameRateLimitJ = json_object_get(rootJ, "frameRateLimit");
if (frameRateLimitJ)
frameRateLimit = json_number_value(frameRateLimitJ);

// frameRateSync
json_t *frameRateSyncJ = json_object_get(rootJ, "frameRateSync");
if (frameRateSyncJ)
frameRateSync = json_boolean_value(frameRateSyncJ);
}


@@ -217,6 +225,7 @@ bool lockModules = false;
bool checkVersion = true;
bool skipLoadOnLaunch = false;
float frameRateLimit = 0.0;
bool frameRateSync = true;


} // namespace settings


+ 1
- 1
src/window.cpp View File

@@ -223,7 +223,7 @@ Window::Window() {

glfwMakeContextCurrent(win);
// Enable v-sync
glfwSwapInterval(1);
glfwSwapInterval(settings::frameRateSync ? 1 : 0);

glfwSetWindowSizeCallback(win, windowSizeCallback);
glfwSetMouseButtonCallback(win, mouseButtonCallback);


Loading…
Cancel
Save