aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Texture.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-08 19:12:37 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-08 19:12:37 +0100
commitac8a58a2a16118ea4c40fcc533c3420edde45122 (patch)
treef93b591f164c051003788c7edaa55fa9dd50cd82 /src/crepe/api/Texture.h
parentba713ba89127e3b4a24f204f67bccaa9c2972916 (diff)
fixed all the RAII
Diffstat (limited to 'src/crepe/api/Texture.h')
-rw-r--r--src/crepe/api/Texture.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/crepe/api/Texture.h b/src/crepe/api/Texture.h
index 0cacfe5..9bda5fe 100644
--- a/src/crepe/api/Texture.h
+++ b/src/crepe/api/Texture.h
@@ -5,16 +5,14 @@
// API namespace?
#include <SDL2/SDL_render.h>
+#include <functional>
#include <memory>
#include "Asset.h"
namespace crepe {
-//! Forward declaration of SDLContext class.
class SDLContext;
-
-//! Forward declaration of Animator class.
class Animator;
/**
@@ -64,11 +62,8 @@ private:
void load(std::unique_ptr<Asset> res);
private:
- struct TextureDeleter{
- void operator()(SDL_Texture* texture) const { SDL_DestroyTexture(texture);}
- };
//! The texture of the class from the library
- std::unique_ptr<SDL_Texture, TextureDeleter> texture;
+ std::unique_ptr<SDL_Texture, std::function<void(SDL_Texture *)>> texture;
//! Grants SDLContext access to private members.
friend class SDLContext;