For SDL backend, reset graphics context if get a SDL_RENDER_DEVICE_RESET event

This commit is contained in:
UnknownShadow200 2020-06-30 12:15:10 +10:00
parent 259a78b911
commit d805d33d7d

View File

@ -110,6 +110,7 @@ static void InitGraphicsMode(struct GraphicsMode* m) {
*#########################################################################################################################*/ *#########################################################################################################################*/
#if defined CC_BUILD_SDL #if defined CC_BUILD_SDL
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "Graphics.h"
static SDL_Window* win_handle; static SDL_Window* win_handle;
static void RefreshWindowBounds(void) { static void RefreshWindowBounds(void) {
@ -350,6 +351,11 @@ void Window_ProcessEvents(void) {
Event_RaiseVoid(&WindowEvents.Closing); Event_RaiseVoid(&WindowEvents.Closing);
SDL_DestroyWindow(win_handle); SDL_DestroyWindow(win_handle);
break; break;
case SDL_RENDER_DEVICE_RESET:
Gfx_LoseContext("SDL device reset event");
Gfx_RecreateContext();
break;
} }
} }
} }