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