mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 18:19:43 +01:00
Add VSync graphics option, off by default
This is if you want delta-timesteps to go as quickly as possible. Also it seems like on Windows this only has an effect in exclusive fullscreen mode.
This commit is contained in:
parent
179315c889
commit
694e8f42ab
6 changed files with 43 additions and 4 deletions
|
@ -4753,6 +4753,11 @@ void Game::loadstats()
|
||||||
over30mode = atoi(pText);
|
over30mode = atoi(pText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pKey == "vsync")
|
||||||
|
{
|
||||||
|
graphics.vsync = atoi(pText);
|
||||||
|
}
|
||||||
|
|
||||||
if (pKey == "notextoutline")
|
if (pKey == "notextoutline")
|
||||||
{
|
{
|
||||||
graphics.notextoutline = atoi(pText);
|
graphics.notextoutline = atoi(pText);
|
||||||
|
@ -5002,6 +5007,10 @@ void Game::savestats()
|
||||||
msg->LinkEndChild(doc.NewText(help.String((int) over30mode).c_str()));
|
msg->LinkEndChild(doc.NewText(help.String((int) over30mode).c_str()));
|
||||||
dataNode->LinkEndChild(msg);
|
dataNode->LinkEndChild(msg);
|
||||||
|
|
||||||
|
msg = doc.NewElement("vsync");
|
||||||
|
msg->LinkEndChild(doc.NewText(help.String((int) graphics.vsync).c_str()));
|
||||||
|
dataNode->LinkEndChild(msg);
|
||||||
|
|
||||||
for (size_t i = 0; i < controllerButton_flip.size(); i += 1)
|
for (size_t i = 0; i < controllerButton_flip.size(); i += 1)
|
||||||
{
|
{
|
||||||
msg = doc.NewElement("flipButton");
|
msg = doc.NewElement("flipButton");
|
||||||
|
@ -7075,9 +7084,10 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
option("toggle analogue");
|
option("toggle analogue");
|
||||||
option("toggle mouse");
|
option("toggle mouse");
|
||||||
option("toggle fps");
|
option("toggle fps");
|
||||||
|
option("toggle vsync");
|
||||||
option("return");
|
option("return");
|
||||||
menuxoff = -50;
|
menuxoff = -85;
|
||||||
menuyoff = 8;
|
menuyoff = 0;
|
||||||
break;
|
break;
|
||||||
case Menu::ed_settings:
|
case Menu::ed_settings:
|
||||||
option("change description");
|
option("change description");
|
||||||
|
|
|
@ -139,6 +139,8 @@ void Graphics::init()
|
||||||
col_tb = 0;
|
col_tb = 0;
|
||||||
|
|
||||||
kludgeswnlinewidth = false;
|
kludgeswnlinewidth = false;
|
||||||
|
|
||||||
|
vsync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Graphics::font_idx(uint32_t ch) {
|
int Graphics::font_idx(uint32_t ch) {
|
||||||
|
@ -3100,3 +3102,8 @@ Uint32 Graphics::crewcolourreal(int t)
|
||||||
}
|
}
|
||||||
return col_crewcyan;
|
return col_crewcyan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Graphics::processVsync()
|
||||||
|
{
|
||||||
|
SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, vsync ? "1" : "0", SDL_HINT_OVERRIDE);
|
||||||
|
}
|
||||||
|
|
|
@ -324,6 +324,9 @@ public:
|
||||||
bool kludgeswnlinewidth;
|
bool kludgeswnlinewidth;
|
||||||
|
|
||||||
Uint32 crewcolourreal(int t);
|
Uint32 crewcolourreal(int t);
|
||||||
|
|
||||||
|
bool vsync;
|
||||||
|
void processVsync();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Graphics graphics;
|
extern Graphics graphics;
|
||||||
|
|
|
@ -364,6 +364,13 @@ void menuactionpress()
|
||||||
game.over30mode = !game.over30mode;
|
game.over30mode = !game.over30mode;
|
||||||
game.savestats();
|
game.savestats();
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
//toggle vsync
|
||||||
|
music.playef(11);
|
||||||
|
graphics.vsync = !graphics.vsync;
|
||||||
|
graphics.processVsync();
|
||||||
|
game.savestats();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
//back
|
//back
|
||||||
music.playef(11);
|
music.playef(11);
|
||||||
|
|
|
@ -176,6 +176,18 @@ void menurender()
|
||||||
graphics.Print(-1, 95, "Current mode: Over 30 FPS", tr, tg, tb, true);
|
graphics.Print(-1, 95, "Current mode: Over 30 FPS", tr, tg, tb, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
graphics.bigprint(-1, 30, "Toggle VSync", tr, tg, tb, true);
|
||||||
|
graphics.Print(-1, 65, "Turn VSync on or off.", tr, tg, tb, true);
|
||||||
|
|
||||||
|
if (!graphics.vsync)
|
||||||
|
{
|
||||||
|
graphics.Print(-1, 95, "Current mode: VSYNC OFF", tr/2, tg/2, tb/2, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphics.Print(-1, 95, "Current mode: VSYNC ON", tr, tg, tb, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Menu::credits:
|
case Menu::credits:
|
||||||
|
|
|
@ -105,8 +105,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, "1", SDL_HINT_OVERRIDE);
|
|
||||||
|
|
||||||
if(!FILESYSTEM_init(argv[0], baseDir, assetsPath))
|
if(!FILESYSTEM_init(argv[0], baseDir, assetsPath))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -208,6 +206,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
//Moved screensetting init here from main menu V2.1
|
//Moved screensetting init here from main menu V2.1
|
||||||
game.loadstats();
|
game.loadstats();
|
||||||
|
graphics.processVsync();
|
||||||
|
|
||||||
if (game.skipfakeload)
|
if (game.skipfakeload)
|
||||||
game.gamestate = TITLEMODE;
|
game.gamestate = TITLEMODE;
|
||||||
if(game.usingmmmmmm==0) music.usingmmmmmm=false;
|
if(game.usingmmmmmm==0) music.usingmmmmmm=false;
|
||||||
|
|
Loading…
Reference in a new issue