mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed bug where the render target is updated instead of the default output when the window is resized.
This commit is contained in:
parent
f17587df4a
commit
2e3c778ef5
@ -115,6 +115,12 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
}
|
||||
|
||||
if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
||||
/* Make sure we're operating on the default render target */
|
||||
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
|
||||
if (saved_target) {
|
||||
SDL_SetRenderTarget(renderer, NULL);
|
||||
}
|
||||
|
||||
if (renderer->logical_w) {
|
||||
UpdateLogicalSize(renderer);
|
||||
} else {
|
||||
@ -140,6 +146,10 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
renderer->UpdateViewport(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
if (saved_target) {
|
||||
SDL_SetRenderTarget(renderer, saved_target);
|
||||
}
|
||||
} else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) {
|
||||
renderer->hidden = SDL_TRUE;
|
||||
} else if (event->window.event == SDL_WINDOWEVENT_SHOWN) {
|
||||
|
Loading…
Reference in New Issue
Block a user