diff --git a/src/main.c b/src/main.c index ec571bd..749e551 100644 --- a/src/main.c +++ b/src/main.c @@ -36,10 +36,7 @@ static void poll_events(void) { break; switch (e.window.event) { - case SDL_WINDOWEVENT_RESIZED: case SDL_WINDOWEVENT_SIZE_CHANGED: - ctx.window_w = e.window.data1; - ctx.window_h = e.window.data2; ctx.window_size_has_changed = true; break; } @@ -151,6 +148,14 @@ void main_loop(void) { render_queue_clear(); poll_events(); + + if (ctx.window_size_has_changed) { + t_vec2 size; + SDL_GetWindowSize(ctx.window, &size.x, &size.y); + ctx.window_w = size.x; + ctx.window_h = size.y; + } + input_state_update(&ctx.input); game_tick();