[client] add option to disable vsync

This commit is contained in:
Geoffrey McRae 2017-12-02 16:43:42 +11:00
parent aef0328050
commit a7c4cdcea1

View File

@ -59,6 +59,7 @@ struct AppState
struct AppParams struct AppParams
{ {
bool vsync;
bool autoResize; bool autoResize;
bool allowResize; bool allowResize;
bool keepAspect; bool keepAspect;
@ -79,6 +80,7 @@ struct AppParams
struct AppState state; struct AppState state;
struct AppParams params = struct AppParams params =
{ {
.vsync = true,
.autoResize = false, .autoResize = false,
.allowResize = true, .allowResize = true,
.keepAspect = true, .keepAspect = true,
@ -810,7 +812,9 @@ int run()
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
state.renderer = SDL_CreateRenderer(state.window, -1, state.renderer = SDL_CreateRenderer(state.window, -1,
SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_RENDERER_ACCELERATED |
(params.vsync ? SDL_RENDERER_PRESENTVSYNC : 0)
);
if (params.useBufferStorage) if (params.useBufferStorage)
{ {
@ -943,6 +947,7 @@ void doHelp(char * app)
"\n" "\n"
" -g Disable OpenGL 4.3 Buffer Storage (GL_ARB_buffer_storage)\n" " -g Disable OpenGL 4.3 Buffer Storage (GL_ARB_buffer_storage)\n"
" -m Disable mipmapping\n" " -m Disable mipmapping\n"
" -v Disable VSync\n"
" -k Enable FPS display\n" " -k Enable FPS display\n"
"\n" "\n"
" -a Auto resize the window to the guest\n" " -a Auto resize the window to the guest\n"
@ -994,7 +999,7 @@ void doLicense()
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
int c; int c;
while((c = getopt(argc, argv, "hf:sc:p:jgmkanrdx:y:w:b:l")) != -1) while((c = getopt(argc, argv, "hf:sc:p:jgmvkanrdx:y:w:b:l")) != -1)
switch(c) switch(c)
{ {
case '?': case '?':
@ -1031,6 +1036,10 @@ int main(int argc, char * argv[])
params.useMipmap = false; params.useMipmap = false;
break; break;
case 'v':
params.vsync = false;
break;
case 'k': case 'k':
params.showFPS = true; params.showFPS = true;
break; break;