diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-09-25 16:31:22 +0200 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-09-25 16:31:22 +0200 |
commit | 9ab843567b27bd23eb7e0d2d4a48b78f7df93595 (patch) | |
tree | 5f580dfe75a2cf3148cdd3a9ff2b0b0930340ada /resource-manager/Image_asset.cpp | |
parent | 35224c07549448e919a18a463e5dec81bbabf7c6 (diff) |
testing map implementation
Diffstat (limited to 'resource-manager/Image_asset.cpp')
-rw-r--r-- | resource-manager/Image_asset.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/resource-manager/Image_asset.cpp b/resource-manager/Image_asset.cpp index 791e988..c5599e9 100644 --- a/resource-manager/Image_asset.cpp +++ b/resource-manager/Image_asset.cpp @@ -1,10 +1,9 @@ #include "Image_asset.h" -#include <SDL2/SDL_surface.h> #include <SDL_image.h> -#include <SDL_render.h> -#include <string> +#include <SDL_surface.h> + Texture::Texture(const std::string& path){ @@ -15,12 +14,14 @@ void Texture::setTexture(SDL_Renderer& renderer){ m_texture = SDL_CreateTextureFromSurface(&renderer, m_surface); } - Texture::~Texture(){ - SDL_FreeSurface(m_surface); + if (m_surface) { + SDL_FreeSurface(m_surface); + } - if(m_texture) + if(m_texture){ SDL_DestroyTexture(m_texture); + } } SDL_Surface* Texture::getSurface() const { |