|
|
@@ -27,7 +27,6 @@ IZ_ProcedureResult IZ_AppInitialize(IZ_App* app) { |
|
|
|
|
|
|
|
// TODO put into its timer module |
|
|
|
app->ticks = 0; |
|
|
|
app->quit = false; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@@ -38,15 +37,15 @@ void IZ_AppTeardown(IZ_App* app) { |
|
|
|
SDL_Quit(); |
|
|
|
} |
|
|
|
|
|
|
|
void IZ_AppHandleSDLEvents(IZ_App* app) { |
|
|
|
IZ_ProcedureResult IZ_AppHandleSDLEvents(IZ_App* app) { |
|
|
|
while (SDL_PollEvent(&app->input_state.sdl_event) != 0) { |
|
|
|
if (app->input_state.sdl_event.type == SDL_QUIT) { |
|
|
|
app->quit = true; |
|
|
|
break; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
IZ_InputHandleSDLEvents(&app->input_state); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
void IZ_AppHandlePortMIDIEvents(IZ_App* app) { |
|
|
@@ -74,9 +73,12 @@ void IZ_AppHandlePortMIDIEvents(IZ_App* app) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void IZ_AppHandleEvents(IZ_App* app) { |
|
|
|
IZ_AppHandleSDLEvents(app); |
|
|
|
IZ_ProcedureResult IZ_AppHandleEvents(IZ_App* app) { |
|
|
|
if (IZ_AppHandleSDLEvents(app)) { |
|
|
|
return 1; |
|
|
|
} |
|
|
|
IZ_AppHandlePortMIDIEvents(app); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
IZ_ProcedureResult IZ_AppRun(IZ_App* app, u8 arg_count, char* arg_values[]) { |
|
|
@@ -98,8 +100,7 @@ IZ_ProcedureResult IZ_AppRun(IZ_App* app, u8 arg_count, char* arg_values[]) { |
|
|
|
// TODO do audio processing |
|
|
|
// TODO do networking? |
|
|
|
|
|
|
|
IZ_AppHandleEvents(app); |
|
|
|
if (app->quit) { |
|
|
|
if (IZ_AppHandleEvents(app)) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|