move SDL_Surface_Deleter and SDL_Texture_Deleter
This commit is contained in:
@@ -7,10 +7,31 @@ namespace yaze {
|
||||
namespace app {
|
||||
namespace core {
|
||||
|
||||
/**
|
||||
* @brief Deleter for SDL_Window and SDL_Renderer.
|
||||
*/
|
||||
struct SDL_Deleter {
|
||||
void operator()(SDL_Window *p) const { SDL_DestroyWindow(p); }
|
||||
void operator()(SDL_Renderer *p) const { SDL_DestroyRenderer(p); }
|
||||
void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Deleter for SDL_Texture.
|
||||
*/
|
||||
struct SDL_Texture_Deleter {
|
||||
void operator()(SDL_Texture *p) const {
|
||||
if (p) SDL_DestroyTexture(p);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Deleter for SDL_Surface.
|
||||
*/
|
||||
struct SDL_Surface_Deleter {
|
||||
void operator()(SDL_Surface *p) const {
|
||||
// Check if the surface is not null
|
||||
if (p) SDL_FreeSurface(p);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace core
|
||||
|
||||
Reference in New Issue
Block a user