mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
add on_screen_change project script event & fix UIDocument::rebuildIndices & move menu background to project script
This commit is contained in:
parent
7749da4a85
commit
0a02d3fbec
16 changed files with 148 additions and 66 deletions
|
|
@ -79,9 +79,12 @@ static int l_textbox_paste(lua::State* L) {
|
|||
|
||||
static int l_container_add(lua::State* L) {
|
||||
auto docnode = get_document_node(L);
|
||||
if (docnode.document == nullptr) {
|
||||
throw std::runtime_error("target document not found");
|
||||
}
|
||||
auto node = dynamic_cast<Container*>(docnode.node.get());
|
||||
if (node == nullptr) {
|
||||
return 0;
|
||||
throw std::runtime_error("target container not found");
|
||||
}
|
||||
auto xmlsrc = lua::require_string(L, 2);
|
||||
try {
|
||||
|
|
@ -99,7 +102,7 @@ static int l_container_add(lua::State* L) {
|
|||
UINode::getIndices(subnode, docnode.document->getMapWriteable());
|
||||
node->add(std::move(subnode));
|
||||
} catch (const std::exception& err) {
|
||||
throw std::runtime_error(err.what());
|
||||
throw std::runtime_error("container:add(...): " + std::string(err.what()));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,12 +58,8 @@ static void create_libs(State* L, StateType stateType) {
|
|||
openlib(L, "vec4", vec4lib);
|
||||
openlib(L, "yaml", yamllib);
|
||||
|
||||
if (stateType == StateType::SCRIPT) {
|
||||
openlib(L, "app", applib);
|
||||
} else if (stateType == StateType::BASE) {
|
||||
openlib(L, "__vc_app", applib);
|
||||
}
|
||||
if (stateType == StateType::BASE || stateType == StateType::SCRIPT) {
|
||||
openlib(L, "__vc_app", applib);
|
||||
openlib(L, "assets", assetslib);
|
||||
openlib(L, "audio", audiolib);
|
||||
openlib(L, "console", consolelib);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue