| 456 | } |
| 457 | |
| 458 | void windowSizeChanged(int32_t width, int32_t height) |
| 459 | { |
| 460 | int32_t pixelWidth = width; |
| 461 | int32_t pixelHeight = height; |
| 462 | if (!SDL_GetWindowSizeInPixels(_window, &pixelWidth, &pixelHeight)) |
| 463 | { |
| 464 | pixelWidth = width; |
| 465 | pixelHeight = height; |
| 466 | } |
| 467 | |
| 468 | auto& drawingEngine = Gfx::getDrawingEngine(); |
| 469 | drawingEngine.resize(pixelWidth, pixelHeight); |
| 470 | |
| 471 | Gui::resize(); |
| 472 | Gfx::invalidateScreen(); |
| 473 | |
| 474 | // Save window size to config if NOT maximized |
| 475 | auto wf = SDL_GetWindowFlags(_window); |
| 476 | if (!_isChangingDisplayMode && !(wf & SDL_WINDOW_MAXIMIZED) && !(wf & SDL_WINDOW_FULLSCREEN)) |
| 477 | { |
| 478 | int32_t windowWidth = width; |
| 479 | int32_t windowHeight = height; |
| 480 | SDL_GetWindowSize(_window, &windowWidth, &windowHeight); |
| 481 | |
| 482 | auto& cfg = Config::get().display; |
| 483 | if (cfg.mode == Config::ScreenMode::window) |
| 484 | { |
| 485 | cfg.windowResolution = { windowWidth, windowHeight }; |
| 486 | _lastWindowedResolution = cfg.windowResolution; |
| 487 | Config::write(); |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | void triggerResize() |
| 493 | { |
no test coverage detected