mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
refactor: add GUI instance reference to UI nodes
This commit is contained in:
parent
74a94f869c
commit
4c48afbb90
70 changed files with 1133 additions and 832 deletions
|
|
@ -44,7 +44,7 @@ void scripting::on_frontend_init(Hud* hud, WorldRenderer* renderer) {
|
|||
lua::call_nothrow(L, 0, 0);
|
||||
}
|
||||
|
||||
for (auto& pack : engine->getAllContentPacks()) {
|
||||
for (auto& pack : Engine::getInstance().getAllContentPacks()) {
|
||||
lua::emit_event(
|
||||
lua::get_main_state(),
|
||||
pack.id + ":.hudopen",
|
||||
|
|
@ -56,7 +56,7 @@ void scripting::on_frontend_init(Hud* hud, WorldRenderer* renderer) {
|
|||
}
|
||||
|
||||
void scripting::on_frontend_render() {
|
||||
for (auto& pack : engine->getAllContentPacks()) {
|
||||
for (auto& pack : Engine::getInstance().getAllContentPacks()) {
|
||||
lua::emit_event(
|
||||
lua::get_main_state(),
|
||||
pack.id + ":.hudrender",
|
||||
|
|
@ -67,7 +67,7 @@ void scripting::on_frontend_render() {
|
|||
|
||||
void scripting::on_frontend_close() {
|
||||
auto L = lua::get_main_state();
|
||||
for (auto& pack : engine->getAllContentPacks()) {
|
||||
for (auto& pack : Engine::getInstance().getAllContentPacks()) {
|
||||
lua::emit_event(
|
||||
L,
|
||||
pack.id + ":.hudclose",
|
||||
|
|
@ -109,7 +109,7 @@ gui::PageLoaderFunc scripting::create_page_loader() {
|
|||
auto func = lua::create_lambda(L);
|
||||
return [func](const std::string& name) -> std::shared_ptr<gui::UINode> {
|
||||
auto docname = func({name}).asString();
|
||||
return engine->getAssets()->require<UiDocument>(docname).getRoot();
|
||||
return Engine::getInstance().getAssets()->require<UiDocument>(docname).getRoot();
|
||||
};
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue