mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
gui: more lua support + 'coord' renamed to 'pos'
This commit is contained in:
parent
6f88502cae
commit
ed6a377e90
5 changed files with 23 additions and 11 deletions
|
|
@ -71,7 +71,7 @@ int l_gui_getattr(lua_State* L) {
|
|||
|
||||
if (attr == "color") {
|
||||
return lua::pushcolor_arr(L, node->getColor());
|
||||
} else if (attr == "coord") {
|
||||
} else if (attr == "pos") {
|
||||
return lua::pushvec2_arr(L, node->getCoord());
|
||||
} else if (attr == "size") {
|
||||
return lua::pushvec2_arr(L, node->getSize());
|
||||
|
|
@ -96,11 +96,15 @@ int l_gui_setattr(lua_State* L) {
|
|||
const std::string attr = lua_tostring(L, 3);
|
||||
|
||||
auto node = getDocumentNode(L, docname, element);
|
||||
|
||||
if (setattr(L, dynamic_cast<gui::Button*>(node), attr))
|
||||
return 0;
|
||||
if (setattr(L, dynamic_cast<gui::Label*>(node), attr))
|
||||
return 0;
|
||||
|
||||
if (attr == "pos") {
|
||||
node->setCoord(lua::tovec2(L, 1));
|
||||
} else if (attr == "size") {
|
||||
node->setSize(lua::tovec2(L, 1));
|
||||
} else {
|
||||
if (setattr(L, dynamic_cast<gui::Button*>(node), attr))
|
||||
return 0;
|
||||
if (setattr(L, dynamic_cast<gui::Label*>(node), attr))
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue