[client] added ability to pass options to renderers

This commit is contained in:
Geoffrey McRae 2017-12-17 20:32:44 +11:00
parent deee61efa9
commit f3e19b743c
2 changed files with 25 additions and 5 deletions

View File

@ -38,6 +38,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
typedef struct LG_RendererParams typedef struct LG_RendererParams
{ {
int argc;
const char ** argv;
TTF_Font * font; TTF_Font * font;
bool showFPS; bool showFPS;
bool resample; bool resample;

View File

@ -83,6 +83,10 @@ struct AppParams
bool scaleMouseInput; bool scaleMouseInput;
bool hideMouse; bool hideMouse;
bool ignoreQuit; bool ignoreQuit;
unsigned int rendererOptSize;
unsigned int rendererOptCount;
const char ** rendererOpts;
}; };
struct AppState state; struct AppState state;
@ -716,6 +720,8 @@ int run()
} }
LG_RendererParams lgrParams; LG_RendererParams lgrParams;
lgrParams.argc = params.rendererOptCount;
lgrParams.argv = params.rendererOpts;
lgrParams.font = state.font; lgrParams.font = state.font;
lgrParams.resample = params.useMipmap; lgrParams.resample = params.useMipmap;
lgrParams.showFPS = params.showFPS; lgrParams.showFPS = params.showFPS;
@ -936,6 +942,7 @@ void doHelp(char * app)
" -m Disable mipmapping\n" " -m Disable mipmapping\n"
" -v Disable VSYNC\n" " -v Disable VSYNC\n"
" -k Enable FPS display\n" " -k Enable FPS display\n"
" -o FLAG Specify a renderer flag\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 be manually resized\n" " -n Don't allow the window to be manually resized\n"
@ -989,7 +996,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:jMmvkanrdFx:y:w:b:Ql")) != -1) while((c = getopt(argc, argv, "hf:sc:p:jMmvko:anrdFx:y:w:b:Ql")) != -1)
switch(c) switch(c)
{ {
case '?': case '?':
@ -1034,6 +1041,17 @@ int main(int argc, char * argv[])
params.showFPS = true; params.showFPS = true;
break; break;
case 'o':
if (params.rendererOptCount == params.rendererOptSize)
{
params.rendererOptSize += 5;
params.rendererOpts = realloc(
params.rendererOpts,
params.rendererOptSize * sizeof(char *));
}
params.rendererOpts[params.rendererOptCount++] = optarg;
break;
case 'a': case 'a':
params.autoResize = true; params.autoResize = true;
break; break;