diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index cac83323..a41e5421 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -170,6 +170,28 @@ void Graphics::destroy() #undef CLEAR_ARRAY } +void Graphics::destroy_buffers() +{ +#define FREE_SURFACE(SURFACE) \ + SDL_FreeSurface(SURFACE); \ + SURFACE = NULL; + + FREE_SURFACE(backBuffer) + FREE_SURFACE(footerbuffer) + FREE_SURFACE(ghostbuffer) + FREE_SURFACE(foregroundBuffer) + FREE_SURFACE(menubuffer) + FREE_SURFACE(warpbuffer) + FREE_SURFACE(warpbuffer_lerp) + FREE_SURFACE(towerbg.buffer) + FREE_SURFACE(towerbg.buffer_lerp) + FREE_SURFACE(titlebg.buffer) + FREE_SURFACE(titlebg.buffer_lerp) + FREE_SURFACE(tempBuffer) + +#undef FREE_SURFACE +} + int Graphics::font_idx(uint32_t ch) { if (font_positions.size() > 0) { std::map::iterator iter = font_positions.find(ch); diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index d6467f2c..1d574a69 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -19,6 +19,8 @@ public: void init(); void destroy(); + void destroy_buffers(); + GraphicsResources grphx; int bfontlen(uint32_t ch);