From e0ea870fdfcfbe9e3f0e47215bb809d4353d88e2 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Tue, 1 Oct 2024 21:22:30 +0200 Subject: removed submodule and updating resource_manager --- src/crepe/facade/Texture.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/crepe/facade/Texture.cpp (limited to 'src/crepe/facade/Texture.cpp') diff --git a/src/crepe/facade/Texture.cpp b/src/crepe/facade/Texture.cpp new file mode 100644 index 0000000..c24312a --- /dev/null +++ b/src/crepe/facade/Texture.cpp @@ -0,0 +1,31 @@ + + +#include "util/log.h" + +#include "Texture.h" +#include "SdlContext.h" +#include + +using namespace crepe; + +Texture::Texture(std::unique_ptr res) { + dbg_trace(); + this->load(std::move(res)); +} + +Texture::Texture(const char * src) { + dbg_trace(); + this->load(std::make_unique(src)); +} + +Texture::~Texture(){ + dbg_trace(); + if(this->m_texture){ + SDL_DestroyTexture(m_texture); + } +} +void Texture::load(std::unique_ptr res) { + SdlContext& ctx = SdlContext::get_instance(); + m_texture = ctx.setTextureFromPath(res->canonical()); +} + -- cgit v1.2.3