mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
cleanup Image element & add fallback
This commit is contained in:
parent
3c900460e6
commit
18e7fb55a6
2 changed files with 40 additions and 33 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue