add 'region' image property
This commit is contained in:
@@ -55,7 +55,7 @@ void Image::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
UVRegion(),
|
||||
region,
|
||||
false,
|
||||
true,
|
||||
calcColor()
|
||||
@@ -76,3 +76,7 @@ const std::string& Image::getTexture() const {
|
||||
void Image::setTexture(const std::string& name) {
|
||||
texture = name;
|
||||
}
|
||||
|
||||
void Image::setRegion(const UVRegion& region) {
|
||||
this->region = region;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "UINode.hpp"
|
||||
#include "maths/UVRegion.hpp"
|
||||
|
||||
namespace gui {
|
||||
class Image : public UINode {
|
||||
protected:
|
||||
std::string texture;
|
||||
UVRegion region {};
|
||||
bool autoresize = false;
|
||||
public:
|
||||
Image(GUI& gui, std::string texture, glm::vec2 size=glm::vec2(32,32));
|
||||
@@ -16,5 +18,6 @@ namespace gui {
|
||||
virtual bool isAutoResize() const;
|
||||
virtual const std::string& getTexture() const;
|
||||
virtual void setTexture(const std::string& name);
|
||||
void setRegion(const UVRegion& region);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user