Merge pull request #1010 from devnexen/vsync_submenu
Add v-sync option to the graphics settings tab
This commit is contained in:
commit
7bcfa32b29
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user