cleanup Image element & add fallback

This commit is contained in:
MihailRis 2026-01-27 23:04:30 +03:00
parent 3c900460e6
commit 18e7fb55a6
2 changed files with 40 additions and 33 deletions

View file

@ -3,21 +3,31 @@
#include "UINode.hpp"
#include "maths/UVRegion.hpp"
namespace util {
struct TextureRegion;
}
namespace gui {
class Image : public UINode {
class Image final : public UINode {
protected:
std::string texture;
std::string fallback;
UVRegion region {};
bool autoresize = false;
bool isFallback = false;
util::TextureRegion refreshTexture(const Assets& assets);
public:
Image(GUI& gui, std::string texture, glm::vec2 size=glm::vec2(32,32));
virtual void draw(const DrawContext& pctx, const Assets& assets) override;
void draw(const DrawContext& pctx, const Assets& assets) override;
virtual void setAutoResize(bool flag);
virtual bool isAutoResize() const;
virtual const std::string& getTexture() const;
virtual void setTexture(const std::string& name);
void setAutoResize(bool flag);
bool isAutoResize() const;
const std::string& getTexture() const;
const std::string& getFallback() const;
void setTexture(const std::string& name);
void setFallback(const std::string& name);
void setRegion(const UVRegion& region);
const UVRegion& getRegion() const;
};