unique_ptr based management for SDL_Surfaces

This commit is contained in:
2015-03-08 13:59:08 +01:00
parent 31e3a307b5
commit ffbc59140a
6 changed files with 80 additions and 50 deletions

View File

@@ -5,6 +5,7 @@
#include <cstring>
#include <cstdio>
#include <cerrno>
#include <memory>
#include <glbinding/gl/gl.h>
@@ -136,4 +137,13 @@ enum class VAFormats {
VertexNormalTexcoord
};
struct SDLSurfaceDeleter {
void operator()(SDL_Surface* ptr) const
{
SDL_FreeSurface(ptr);
}
};
using SDLSurfaceUPtr = std::unique_ptr<SDL_Surface, SDLSurfaceDeleter>;
#endif