Content menu, content-pack dependencies
This commit is contained in:
@@ -45,6 +45,7 @@ class Camera;
|
||||
|
||||
namespace gui {
|
||||
typedef std::function<void()> runnable;
|
||||
typedef std::function<void(const std::string&)> stringconsumer;
|
||||
|
||||
class UINode;
|
||||
class Container;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace gui {
|
||||
virtual glm::vec2 contentOffset() {return glm::vec2(0.0f);};
|
||||
glm::vec2 calcCoord() const;
|
||||
virtual void setCoord(glm::vec2 coord);
|
||||
glm::vec2 size() const;
|
||||
virtual glm::vec2 size() const;
|
||||
virtual void size(glm::vec2 size);
|
||||
void _size(glm::vec2 size);
|
||||
virtual void refresh() {};
|
||||
|
||||
@@ -22,6 +22,13 @@ const uint KEY_BACKSPACE = 259;
|
||||
|
||||
using namespace gui;
|
||||
|
||||
Label::Label(string text, string fontName)
|
||||
: UINode(vec2(), vec2(text.length() * 8, 15)),
|
||||
text_(util::str2wstr_utf8(text)),
|
||||
fontName_(fontName) {
|
||||
}
|
||||
|
||||
|
||||
Label::Label(wstring text, string fontName)
|
||||
: UINode(vec2(), vec2(text.length() * 8, 15)),
|
||||
text_(text),
|
||||
@@ -64,6 +71,7 @@ void Label::size(vec2 sizenew) {
|
||||
|
||||
// ================================= Image ====================================
|
||||
Image::Image(string texture, vec2 size) : UINode(vec2(), size), texture(texture) {
|
||||
setInteractive(false);
|
||||
}
|
||||
|
||||
void Image::draw(Batch2D* batch, Assets* assets) {
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace gui {
|
||||
std::string fontName_;
|
||||
wstringsupplier supplier = nullptr;
|
||||
public:
|
||||
Label(std::string text, std::string fontName="normal");
|
||||
Label(std::wstring text, std::string fontName="normal");
|
||||
|
||||
virtual Label& text(std::wstring text);
|
||||
@@ -40,6 +41,9 @@ namespace gui {
|
||||
virtual void draw(Batch2D* batch, Assets* assets) override;
|
||||
|
||||
virtual Label* textSupplier(wstringsupplier supplier);
|
||||
virtual glm::vec2 size() const override {
|
||||
return UINode::size();
|
||||
}
|
||||
virtual void size(glm::vec2 size) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user