Skip to content

Commit

Permalink
V-Sync new submenu proposal.
Browse files Browse the repository at this point in the history
disabled or plain mode, maybe adaptive mode can be considered at some point.
  • Loading branch information
devnexen committed Apr 16, 2022
1 parent e6d1856 commit b539f2f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Resources/Scripts/Gui/StartupScreen/ConfigViewTabs.as
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ namespace spades {
_Tr("StartupScreen",
"Uses a number representation which allows wider dynamic range during rendering process. " "Additionally, this allows color calculation whose value is in linear correspondence with actual energy, " "that is, physically accurate blending can be achieved.")));

cfg.AddRow(StartupScreenConfigCheckItemEditor(
ui, StartupScreenConfig(ui, "r_vsync"), "0", "1",
_Tr("StartupScreen", "V-Sync"),
_Tr("StartupScreen",
"Enables frame rate synchronization.")));

{
StartupScreenComplexConfig cplx;
cplx.AddEditor(StartupScreenConfigCheckItemEditor(
Expand Down
8 changes: 8 additions & 0 deletions Sources/Core/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ namespace spades {
void Settings::ItemHandle::operator=(const std::string &value) { item->Set(value); }
void Settings::ItemHandle::operator=(int value) { item->Set(value); }
void Settings::ItemHandle::operator=(float value) { item->Set(value); }
bool Settings::ItemHandle::operator==(int value) {
item->Load();
return item->intValue == value;
}
bool Settings::ItemHandle::operator!=(int value) {
item->Load();
return item->intValue != value;
}
Settings::ItemHandle::operator std::string() {
item->Load();
return item->string;
Expand Down
2 changes: 2 additions & 0 deletions Sources/Core/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ namespace spades {
void operator=(const std::string &);
void operator=(int);
void operator=(float);
bool operator==(int);
bool operator!=(int);
operator std::string();
operator float();
operator int();
Expand Down
2 changes: 1 addition & 1 deletion Sources/Gui/SDLRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ namespace spades {

#ifndef __sun
if (rtype == RendererType::GL) {
if (SDL_GL_SetSwapInterval(r_vsync) != 0) {
if (r_vsync != 0 && SDL_GL_SetSwapInterval(r_vsync) != 0) {
SPRaise("SDL_GL_SetSwapInterval failed: %s", SDL_GetError());
}
}
Expand Down

0 comments on commit b539f2f

Please sign in to comment.