add on_screen_change project script event & fix UIDocument::rebuildIndices & move menu background to project script
This commit is contained in:
@@ -56,6 +56,13 @@ GUI::GUI(Engine& engine)
|
||||
store("tooltip", tooltip);
|
||||
store("tooltip.label", UINode::find(tooltip, "tooltip.label"));
|
||||
container->add(tooltip);
|
||||
|
||||
rootDocument = std::make_unique<UiDocument>(
|
||||
"core:root",
|
||||
uidocscript {},
|
||||
std::dynamic_pointer_cast<gui::UINode>(container),
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
|
||||
GUI::~GUI() = default;
|
||||
@@ -74,15 +81,8 @@ std::shared_ptr<Menu> GUI::getMenu() {
|
||||
}
|
||||
|
||||
void GUI::onAssetsLoad(Assets* assets) {
|
||||
assets->store(
|
||||
std::make_unique<UiDocument>(
|
||||
"core:root",
|
||||
uidocscript {},
|
||||
std::dynamic_pointer_cast<gui::UINode>(container),
|
||||
nullptr
|
||||
),
|
||||
"core:root"
|
||||
);
|
||||
rootDocument->rebuildIndices();
|
||||
assets->store(rootDocument, "core:root");
|
||||
}
|
||||
|
||||
void GUI::resetTooltip() {
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace devtools {
|
||||
class Editor;
|
||||
}
|
||||
|
||||
class UiDocument;
|
||||
|
||||
/*
|
||||
Some info about padding and margin.
|
||||
Padding is element inner space, margin is outer
|
||||
@@ -70,6 +72,7 @@ namespace gui {
|
||||
std::shared_ptr<UINode> pressed;
|
||||
std::shared_ptr<UINode> focus;
|
||||
std::shared_ptr<UINode> tooltip;
|
||||
std::shared_ptr<UiDocument> rootDocument;
|
||||
std::unordered_map<std::string, std::shared_ptr<UINode>> storage;
|
||||
|
||||
std::unique_ptr<Camera> uicamera;
|
||||
|
||||
Reference in New Issue
Block a user