unique_ptr based management for SDL_Surfaces
This commit is contained in:
10
common.hh
10
common.hh
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user