1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Merge pull request #19812 from ZehMatt/fix-19811

Fix #19811: Use the correct SDL event for window resize handling
This commit is contained in:
Matthias Moninger
2023-04-03 21:32:37 +03:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@@ -337,14 +337,15 @@ public:
ContextQuit();
break;
case SDL_WINDOWEVENT:
if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
if (e.window.event == SDL_WINDOWEVENT_RESIZED)
{
LOG_VERBOSE("New Window size: %ux%u\n", e.window.data1, e.window.data2);
OnResize(e.window.data1, e.window.data2);
}
switch (e.window.event)
{
case SDL_WINDOWEVENT_SIZE_CHANGED:
case SDL_WINDOWEVENT_RESIZED:
case SDL_WINDOWEVENT_MOVED:
case SDL_WINDOWEVENT_MAXIMIZED:
case SDL_WINDOWEVENT_RESTORED:

View File

@@ -135,16 +135,22 @@ public:
char scaleQualityBuffer[4];
snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%d", static_cast<int32_t>(scaleQuality));
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
_screenTexture = SDL_CreateTexture(_sdlRenderer, pixelFormat, SDL_TEXTUREACCESS_STREAMING, width, height);
Guard::Assert(_screenTexture != nullptr, "Failed to create screen texture: %s", SDL_GetError());
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, scaleQualityBuffer);
uint32_t scale = std::ceil(gConfigGeneral.WindowScale);
_scaledScreenTexture = SDL_CreateTexture(
_sdlRenderer, pixelFormat, SDL_TEXTUREACCESS_TARGET, width * scale, height * scale);
Guard::Assert(_scaledScreenTexture != nullptr, "Failed to create scaled screen texture: %s", SDL_GetError());
}
else
{
_screenTexture = SDL_CreateTexture(_sdlRenderer, pixelFormat, SDL_TEXTUREACCESS_STREAMING, width, height);
Guard::Assert(_screenTexture != nullptr, "Failed to create screen texture: %s", SDL_GetError());
}
uint32_t format;