diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 5 | ||||
-rw-r--r-- | src/dyetool/client.cpp | 5 | ||||
-rw-r--r-- | src/render/graphics.cpp | 22 | ||||
-rw-r--r-- | src/render/graphics.h | 8 |
4 files changed, 31 insertions, 9 deletions
diff --git a/src/client.cpp b/src/client.cpp index 1838398d4..5867c9474 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -730,6 +730,11 @@ void Client::gameClear() logger->log("textures left: %d", textures_count); #endif // DEBUG_OPENGL_LEAKS + Graphics::cleanUp(); + + if (logger != nullptr) + logger->log1("Quitting12"); + delete2(chatLogger); TranslationManager::close(); } diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp index 0a03c4c68..8ed409a0a 100644 --- a/src/dyetool/client.cpp +++ b/src/dyetool/client.cpp @@ -492,6 +492,11 @@ void Client::gameClear() logger->log("textures left: %d", textures_count); #endif // DEBUG_OPENGL_LEAKS + Graphics::cleanUp(); + + if (logger != nullptr) + logger->log1("Quitting12"); + // delete2(chatLogger); TranslationManager::close(); VirtFs::deinit(); diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 92a9acc36..82a4cbfd6 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -107,6 +107,18 @@ RENDER_OPENGL_MGLDEFINES_H Graphics *mainGraphics A_NONNULLPOINTER = nullptr; +#ifdef USE_SDL2 +SDL_Renderer *restrict Graphics::mRenderer = nullptr; +#endif // USE_SDL2 +#ifdef USE_OPENGL +#ifdef USE_SDL2 +SDL_GLContext Graphics::mGLContext = nullptr; +#else // USE_SDL2 + +void *restrict Graphics::mGLContext = nullptr; +#endif // USE_SDL2 +#endif // USE_OPENGL + Graphics::Graphics() : mWidth(0), mHeight(0), @@ -114,12 +126,6 @@ Graphics::Graphics() : mActualHeight(0), mClipStack(1000), mWindow(nullptr), -#ifdef USE_SDL2 - mRenderer(nullptr), -#endif // USE_SDL2 -#ifdef USE_OPENGL - mGLContext(nullptr), -#endif // USE_OPENGL mBpp(0), mAlpha(false), mFullscreen(false), @@ -146,6 +152,10 @@ Graphics::Graphics() : Graphics::~Graphics() { endDraw(); +} + +void Graphics::cleanUp() +{ #ifdef USE_SDL2 if (mRenderer) { diff --git a/src/render/graphics.h b/src/render/graphics.h index 36f3ed721..6eb18dfab 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -120,6 +120,8 @@ class Graphics notfinal */ virtual ~Graphics(); + static void cleanUp(); + /** * Alignments for text drawing. */ @@ -518,14 +520,14 @@ class Graphics notfinal SDL_Window *restrict mWindow; #ifdef USE_SDL2 - SDL_Renderer *restrict mRenderer; + static SDL_Renderer *restrict mRenderer; #endif // USE_SDL2 #ifdef USE_OPENGL #ifdef USE_SDL2 - SDL_GLContext mGLContext; + static SDL_GLContext mGLContext; #else // USE_SDL2 - void *restrict mGLContext; + static void *restrict mGLContext; #endif // USE_SDL2 #endif // USE_OPENGL |