diff options
Diffstat (limited to 'src/client/lua_api/gui/iguielement.cpp')
| -rw-r--r-- | src/client/lua_api/gui/iguielement.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/client/lua_api/gui/iguielement.cpp b/src/client/lua_api/gui/iguielement.cpp index 3567d80..81d339f 100644 --- a/src/client/lua_api/gui/iguielement.cpp +++ b/src/client/lua_api/gui/iguielement.cpp @@ -49,6 +49,27 @@ int getiguiclippingrect(lua_State* L){ lua_getfield(L,-1,"guielement"); IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1);//{element},ud_element lua_pop(L,2); + core::rect<s32> rect = el->getAbsolutePosition(); + pushrecti( + L, + rect.UpperLeftCorner.X, + rect.UpperLeftCorner.Y, + rect.LowerRightCorner.X, + rect.LowerRightCorner.Y + ); + return 1; +} + +/*** +Find the rectangle that an element occupies that is visible to the user +@function guielement:getabsclippingrect() +@treturn rect The rectangle that this element occupies that is visible to the user +*/ +//getabsclippingrect({element}) :: {{sx,sy},{ex,ey}} +int getiguiabsclippingrect(lua_State *L){ + lua_getfield(L,-1,"guielement"); + IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1);//{element},ud_element + lua_pop(L,2); core::rect<s32> rect = el->getAbsoluteClippingRect(); pushrecti( L, @@ -61,6 +82,26 @@ int getiguiclippingrect(lua_State* L){ } /*** +Find the relative rectangle that this element occupies +@function guielement:getrelrect() +@treturn rect The rectangle that this element occupies relative to it's parent +*/ +int getiguirelrect(lua_State *L){ + lua_getfield(L,-1,"guielement"); + IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1);//{element},ud_element + lua_pop(L,2); + core::rect<s32> rect = el->getRelativePosition(); + pushrecti( + L, + rect.UpperLeftCorner.X, + rect.UpperLeftCorner.Y, + rect.LowerRightCorner.X, + rect.LowerRightCorner.Y + ); + return 1; +} + +/*** Sets the text of the element This function may do different things to different gui elements. For example, on a window, it sets the title. |
