[client] added option to prevent window resize

This commit is contained in:
Geoffrey McRae 2017-11-28 19:48:40 +11:00
parent b9e3db1971
commit a3572b2188

View File

@ -56,6 +56,7 @@ struct AppState
struct AppParams struct AppParams
{ {
bool autoResize; bool autoResize;
bool allowResize;
bool keepAspect; bool keepAspect;
bool borderless; bool borderless;
bool center; bool center;
@ -73,6 +74,7 @@ struct AppState state;
struct AppParams params = struct AppParams params =
{ {
.autoResize = false, .autoResize = false,
.allowResize = true,
.keepAspect = true, .keepAspect = true,
.borderless = false, .borderless = false,
.center = true, .center = true,
@ -642,8 +644,8 @@ int run()
params.h, params.h,
( (
SDL_WINDOW_SHOWN | SDL_WINDOW_SHOWN |
(!params.autoResize ? SDL_WINDOW_RESIZABLE : 0) | (params.allowResize ? SDL_WINDOW_RESIZABLE : 0) |
( params.borderless ? SDL_WINDOW_BORDERLESS : 0) (params.borderless ? SDL_WINDOW_BORDERLESS : 0)
) )
); );
@ -794,6 +796,7 @@ void doHelp(char * app)
" -m Disable mipmapping\n" " -m Disable mipmapping\n"
"\n" "\n"
" -a Auto resize the window to the guest\n" " -a Auto resize the window to the guest\n"
" -n Don't allow the window to resize\n"
" -r Don't maintain the aspect ratio\n" " -r Don't maintain the aspect ratio\n"
" -d Borderless mode\n" " -d Borderless mode\n"
" -x XPOS Initial window X position [current: %s]\n" " -x XPOS Initial window X position [current: %s]\n"
@ -841,7 +844,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:gmardx:y:w:b:l")) != -1) while((c = getopt(argc, argv, "hf:sc:p:gmanrdx:y:w:b:l")) != -1)
switch(c) switch(c)
{ {
case '?': case '?':
@ -878,6 +881,10 @@ int main(int argc, char * argv[])
params.autoResize = true; params.autoResize = true;
break; break;
case 'n':
params.allowResize = false;
break;
case 'r': case 'r':
params.keepAspect = false; params.keepAspect = false;
break; break;