diff --git a/src/packages/game/IZ_app.c b/src/packages/game/IZ_app.c index 53704c6..11ed39a 100644 --- a/src/packages/game/IZ_app.c +++ b/src/packages/game/IZ_app.c @@ -39,13 +39,13 @@ void IZ_AppTeardown(IZ_App* app) { } void IZ_AppHandleSDLEvents(IZ_App* app) { - while (SDL_PollEvent(&app->sdl_event) != 0) { - if (app->sdl_event.type == SDL_QUIT) { + while (SDL_PollEvent(&app->input_state.sdl_event) != 0) { + if (app->input_state.sdl_event.type == SDL_QUIT) { app->quit = true; break; } - IZ_InputHandleSDLEvents(app->sdl_event, &app->input_state); + IZ_InputHandleSDLEvents(&app->input_state); } } diff --git a/src/packages/game/IZ_app.h b/src/packages/game/IZ_app.h index cda03fe..9a26b70 100644 --- a/src/packages/game/IZ_app.h +++ b/src/packages/game/IZ_app.h @@ -13,8 +13,6 @@ #include "memory/IZ_pool.h" typedef struct { - SDL_Event sdl_event; - IZ_InputState input_state; IZ_VideoState video_state; diff --git a/src/packages/game/input/IZ_input.c b/src/packages/game/input/IZ_input.c index c23cb08..e802509 100644 --- a/src/packages/game/input/IZ_input.c +++ b/src/packages/game/input/IZ_input.c @@ -1,8 +1,8 @@ #include "IZ_input.h" -void IZ_InputHandleSDLEvents(SDL_Event e, IZ_InputState* state) { - IZ_JoystickHandleEvents(e, &state->joystick_state, &state->action); - IZ_KeyboardHandleEvents(e, &state->keyboard_state, &state->action); +void IZ_InputHandleSDLEvents(IZ_InputState* state) { + IZ_JoystickHandleEvents(state->sdl_event, &state->joystick_state, &state->action); + IZ_KeyboardHandleEvents(state->sdl_event, &state->keyboard_state, &state->action); } void IZ_InputHandlePortMIDIEvents(PmEvent e, IZ_InputState* state) { diff --git a/src/packages/game/input/IZ_input.h b/src/packages/game/input/IZ_input.h index e74a7f6..478aa57 100644 --- a/src/packages/game/input/IZ_input.h +++ b/src/packages/game/input/IZ_input.h @@ -7,13 +7,14 @@ #include "IZ_midi.h" typedef struct { + SDL_Event sdl_event; IZ_Action action[PLAYERS]; IZ_KeyboardState keyboard_state[PLAYERS]; IZ_JoystickState joystick_state[PLAYERS]; IZ_MIDIInputState midi_input_state[PLAYERS]; } IZ_InputState; -void IZ_InputHandleSDLEvents(SDL_Event, IZ_InputState*); +void IZ_InputHandleSDLEvents(IZ_InputState*); void IZ_InputHandlePortMIDIEvents(PmEvent, IZ_InputState*);