From 27a80d9766f71328244e69d46ba26c85e47eeddb Mon Sep 17 00:00:00 2001 From: freezarite Date: Sun, 17 Nov 2024 17:05:26 +0100 Subject: [PATCH] added new Constructor for SpriteComponent as Tiles wont work with enums --- include/SpriteComponent.h | 4 ++++ src/SpriteComponent.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/SpriteComponent.h b/include/SpriteComponent.h index 5cc3b53..4b9f8e2 100644 --- a/include/SpriteComponent.h +++ b/include/SpriteComponent.h @@ -35,9 +35,13 @@ private: int textureXOffset; int textureYOffset; + //should be changed in the future as this is only for the tiles + const char* path; + public: SpriteComponent(Textures texture, int zIndex); SpriteComponent(Textures texture, int xOffset, int yOffset, int zIndex); + SpriteComponent(const char* path, int xOffset, int yOffset, int zIndex); SpriteComponent( Textures texture, bool isAnimated, diff --git a/src/SpriteComponent.cpp b/src/SpriteComponent.cpp index 36f6766..77ad9f1 100644 --- a/src/SpriteComponent.cpp +++ b/src/SpriteComponent.cpp @@ -25,6 +25,11 @@ SpriteComponent::SpriteComponent(Textures texture, int xOffset, int yOffset, int this->textureEnum = texture; } +SpriteComponent::SpriteComponent(const char* path, int xOffset, int yOffset, int zIndex) : RenderObject(zIndex, VEGO_Game().renderManager), textureXOffset(xOffset), textureYOffset(yOffset) { + + this->path = path; +} + SpriteComponent::SpriteComponent( Textures texture, bool isAnimated,