mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
fix containers refreshing
This commit is contained in:
parent
d845aeb55f
commit
34295faca2
4 changed files with 19 additions and 7 deletions
|
|
@ -66,6 +66,7 @@ namespace gui {
|
|||
class UINode : public std::enable_shared_from_this<UINode> {
|
||||
protected:
|
||||
GUI& gui;
|
||||
bool mustRefresh = true;
|
||||
private:
|
||||
/// @brief element identifier used for direct access in UiDocument
|
||||
std::string id = "";
|
||||
|
|
@ -131,7 +132,12 @@ namespace gui {
|
|||
|
||||
/// @brief Called every frame for all visible elements
|
||||
/// @param delta delta timУ
|
||||
virtual void act(float delta) {};
|
||||
virtual void act(float delta) {
|
||||
if (mustRefresh) {
|
||||
mustRefresh = false;
|
||||
refresh();
|
||||
}
|
||||
};
|
||||
virtual void draw(const DrawContext& pctx, const Assets& assets) = 0;
|
||||
|
||||
virtual void setVisible(bool flag);
|
||||
|
|
@ -275,5 +281,9 @@ namespace gui {
|
|||
const std::shared_ptr<UINode>& node,
|
||||
const std::string& id
|
||||
);
|
||||
|
||||
void setMustRefresh() {
|
||||
mustRefresh = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue