|
|
@@ -18,6 +18,16 @@ IZ_InputState* IZ_AppGetInputState(struct IZ_App* app) { |
|
|
|
|
|
|
|
IZ_ProcedureResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char* argv[]) { |
|
|
|
memset(app, 0, sizeof(struct IZ_App)); |
|
|
|
|
|
|
|
const char* cmdline_buffer; |
|
|
|
char config_path[128]; |
|
|
|
// TODO abstract command line args parsing |
|
|
|
if ((cmdline_buffer = IZ_ConfigGetCommandlineOption(argc, argv, "-c"))) { |
|
|
|
memcpy_s(config_path, 128, cmdline_buffer, 128); |
|
|
|
} else { |
|
|
|
IZ_ConfigGetDefaultPath(config_path, 128); |
|
|
|
} |
|
|
|
|
|
|
|
u32 flags = ( |
|
|
|
SDL_INIT_VIDEO |
|
|
|
| SDL_INIT_GAMECONTROLLER |
|
|
@@ -29,15 +39,6 @@ IZ_ProcedureResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char* arg |
|
|
|
return IZ_APP_RUN_SDL_INIT_ERROR; |
|
|
|
} |
|
|
|
|
|
|
|
const char* cmdline_buffer; |
|
|
|
char config_path[128]; |
|
|
|
// TODO abstract command line args parsing |
|
|
|
if ((cmdline_buffer = IZ_ConfigGetCommandlineOption(argc, argv, "-c"))) { |
|
|
|
memcpy_s(config_path, 128, cmdline_buffer, 128); |
|
|
|
} else { |
|
|
|
IZ_ConfigGetDefaultPath(config_path, 128); |
|
|
|
} |
|
|
|
|
|
|
|
if (IZ_VideoInitialize(&app->video_state, app, config_path, argc, argv)) { |
|
|
|
return IZ_APP_RUN_VIDEO_INIT_ERROR; |
|
|
|
} |
|
|
@@ -65,6 +66,31 @@ void IZ_AppTeardown(struct IZ_App* app) { |
|
|
|
} |
|
|
|
|
|
|
|
IZ_ProcedureResult IZ_AppRun(struct IZ_App* app, u8 argc, const char* argv[]) { |
|
|
|
if (IZ_ConfigGetCommandlineOption(argc, argv, "-h")) { |
|
|
|
printf( |
|
|
|
( |
|
|
|
"\n" |
|
|
|
"%s - %s\n" |
|
|
|
"\n" |
|
|
|
"Usage:\n" |
|
|
|
"\n" |
|
|
|
" %s [options]\n" |
|
|
|
"\n" |
|
|
|
"Options:\n" |
|
|
|
"\n" |
|
|
|
" -c <path> Specifies the path to the config file. (default: \"./config-game.ini\")\n" |
|
|
|
" -f <value> Specifies the frames per second. (default: 30)\n" |
|
|
|
" -h Displays this help file.\n" |
|
|
|
" -i <value> Specifies the interval of sending packets (default: 200)\n" |
|
|
|
" in milliseconds.\n" |
|
|
|
), |
|
|
|
IZ_APP_NAME, |
|
|
|
IZ_APP_DESCRIPTION, |
|
|
|
"game.exe" |
|
|
|
); |
|
|
|
return IZ_APP_RUN_RESULT_OK; |
|
|
|
} |
|
|
|
|
|
|
|
IZ_ProcedureResult init_result = IZ_AppInitialize(app, argc, argv); |
|
|
|
if (init_result) { |
|
|
|
return init_result; |
|
|
|