diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-10-22 12:15:03 +0200 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-10-22 12:15:03 +0200 |
commit | 9037aca03bfa4312794a6954752628381256f777 (patch) | |
tree | b5402ae6552ca84bb4cdf9a2f1507dc460a399ac /src/crepe/api/spritesheet.cpp | |
parent | 176ac90fce318334f1377d94d6e637e1eff84c3c (diff) |
merged further and changed to standard
Diffstat (limited to 'src/crepe/api/spritesheet.cpp')
-rw-r--r-- | src/crepe/api/spritesheet.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/crepe/api/spritesheet.cpp b/src/crepe/api/spritesheet.cpp deleted file mode 100644 index 7f5da38..0000000 --- a/src/crepe/api/spritesheet.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#include "spritesheet.h" -#include "SDL_rect.h" -#include "SDL_render.h" -#include "api/Resource.h" -#include "facade/SdlContext.h" -#include <memory> - - -using namespace crepe::api; - -Spritesheet::Spritesheet(const char* src, const int row, const int col){ - this->load(std::make_unique<api::Resource>(src), row, col); -} - -Spritesheet::Spritesheet(std::unique_ptr<api::Resource> res, const int row, const int col){ - this->load(std::move(res), row, col); -} - -Spritesheet::~Spritesheet(){ - - if (this->m_spritesheet) { - SDL_DestroyTexture(this->m_spritesheet); - } -} - -void Spritesheet::select_sprite(const int x, const int y){ - m_clip.x = x * m_clip.w; - m_clip.y = y * m_clip.h; -} - -void Spritesheet::load(std::unique_ptr<api::Resource> res, const int row, const int col){ - auto& ctx = SdlContext::get_instance(); - - this->m_spritesheet = ctx.setTextureFromPath(res->canonical(), this->m_clip, row, col); -} - |