Corrections projet

This commit is contained in:
Adrien Guatto
2025-12-01 16:07:50 +01:00
parent 70fc7019dc
commit 6c8abfbade
3 changed files with 25 additions and 46 deletions

View File

@@ -157,7 +157,7 @@ race_result_t simulation_loop(bool show_guide,
SDL_WINDOWPOS_UNDEFINED,
MAX_X,
MAX_Y,
SDL_WINDOW_SHOWN)) == NULL)
SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE)) == NULL)
log_fatal("[sdl] could not open window (%s)\n", SDL_GetError());
r = SDL_CreateRenderer(w, -1, SDL_RENDERER_ACCELERATED);
@@ -256,6 +256,13 @@ race_result_t simulation_loop(bool show_guide,
case SDL_QUIT:
quit = true;
break;
case SDL_WINDOWEVENT:
if (e.window.event == SDL_WINDOWEVENT_RESIZED) {
float newwidth = e.window.data1;
float newheight = e.window.data2;
SDL_RenderSetScale(r, newwidth / MAX_X, newheight / MAX_Y);
}
break;
case SDL_KEYDOWN:
switch (e.key.keysym.sym) {
case SDLK_q: