[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
{
int argc;
const char ** argv;
TTF_Font * font;
bool showFPS;
bool resample;

View File

@ -83,6 +83,10 @@ struct AppParams
bool scaleMouseInput;
bool hideMouse;
bool ignoreQuit;
unsigned int rendererOptSize;
unsigned int rendererOptCount;
const char ** rendererOpts;
};
struct AppState state;
@ -716,6 +720,8 @@ int run()
}
LG_RendererParams lgrParams;
lgrParams.argc = params.rendererOptCount;
lgrParams.argv = params.rendererOpts;
lgrParams.font = state.font;
lgrParams.resample = params.useMipmap;
lgrParams.showFPS = params.showFPS;
@ -936,6 +942,7 @@ void doHelp(char * app)
" -m Disable mipmapping\n"
" -v Disable VSYNC\n"
" -k Enable FPS display\n"
" -o FLAG Specify a renderer flag\n"
"\n"
" -a Auto resize the window to the guest\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 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)
{
case '?':
@ -1034,6 +1041,17 @@ int main(int argc, char * argv[])
params.showFPS = true;
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':
params.autoResize = true;
break;