commit 1ae9f202
Protext the sprite textures again
Changed files
| M | source/code/puzzle_editor/PuzzleEditorState.cpp before |
| M | source/code/sago/SagoSprite.hpp before |
diff --git a/source/code/puzzle_editor/PuzzleEditorState.cpp b/source/code/puzzle_editor/PuzzleEditorState.cpp
index a1e1195..06456cd 100644
--- a/source/code/puzzle_editor/PuzzleEditorState.cpp
+++ b/source/code/puzzle_editor/PuzzleEditorState.cpp
@@ -81,7 +81,7 @@ static void DrawBrick(int brick, int x, int y, int width, int height) {
sago::SagoSprite& sprite = globalData.bricks[brick];
ImGui::SetCursorScreenPos({ static_cast<float>(x), static_cast<float>(y) });
- ImGuiWritePartOfTexture(sprite.tex.get(), sprite.imgCord.x, sprite.imgCord.y, sprite.GetWidth(), sprite.GetHeight(), width, height);
+ ImGuiWritePartOfTexture(sprite.GetTextureHandler().get(), sprite.GetImageCord().x, sprite.GetImageCord().y, sprite.GetWidth(), sprite.GetHeight(), width, height);
}
void PuzzleEditorState::Draw(SDL_Renderer* target) {
diff --git a/source/code/sago/SagoSprite.hpp b/source/code/sago/SagoSprite.hpp
index 7482a26..025d6b6 100644
--- a/source/code/sago/SagoSprite.hpp
+++ b/source/code/sago/SagoSprite.hpp
@@ -98,6 +98,19 @@ public:
int GetHeight() const;
~SagoSprite() = default;
+ const TextureHandler& GetTextureHandler() const {
+ return this->tex;
+ }
+
+ const SDL_Rect& GetImageCord() const {
+ return this->imgCord;
+ }
+
+ const SDL_Rect& GetOrigin() const {
+ return this->origin;
+ }
+
+private:
TextureHandler tex;
SDL_Rect imgCord = {};
SDL_Rect origin = {};