From d169407dbc6d54ed4eb0bee06c6169b6ea40761d Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 12 Aug 2018 15:03:08 -0400 Subject: Changed files to use the common iguielement registry Files now use the registry defined in iguielement, so they are all in sync. --- src/client/lua_api/gui/iguieditbox.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/client/lua_api/gui/iguieditbox.cpp') diff --git a/src/client/lua_api/gui/iguieditbox.cpp b/src/client/lua_api/gui/iguieditbox.cpp index 1ceab1f..790eaf3 100644 --- a/src/client/lua_api/gui/iguieditbox.cpp +++ b/src/client/lua_api/gui/iguieditbox.cpp @@ -12,12 +12,25 @@ extern "C" { #include #include +/*** +@module gui +*/ + using namespace irr; using namespace core; using namespace gui; extern IrrlichtDevice* device; +/*** +@function neweditbox() +Creates a new text entry box +@tparam dimensions rect The rectangle to place the box at. If the box has a parent, +it is offset from the upper-left of the parent element. +@tparam parent (iguielement | nil) parent The parent element of the edit box +@tparam default_text (string | nil) default_text The default text to have in the edit box +@treturn iguieditbox The edit box element +*/ //gui.neweditbox({{sx,sy},{ex,ey}}[,parent][,"default text"]) static int newiguieditbox(lua_State* L){ printf("Creating edit box!\n"); @@ -61,18 +74,6 @@ static int newiguieditbox(lua_State* L){ return 1; } -//{guieditbox}:getinput() -int getinputtext(lua_State* L){ - lua_getfield(L, -1, "guielement");//{guieditbox},ud_guielement - irr::gui::IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1); - lua_pop(L,2);// - const wchar_t *t = el->getText(); - size_t strlen = wcslen(t); - char output[strlen]; - wcstombs(output,t,strlen); - lua_pushstring(L,output);//"str" - return 1; -} static const luaL_reg iguieditbox_f[] = { {"neweditbox",newiguieditbox}, @@ -80,10 +81,6 @@ static const luaL_reg iguieditbox_f[] = { }; static const luaL_reg iguieditbox_m[] = { - {"move", moveiguielement}, - {"settext", setiguitext}, - {"getinput", getinputtext}, - {"remove", removeiguielement}, {0,0}, }; @@ -91,6 +88,7 @@ void iguieditbox_register(lua_State* L){ luaL_newmetatable(L, "gui.iguieditbox"); lua_newtable(L); luaL_register(L,NULL,iguieditbox_m); + luaL_register(L,NULL,iguielement_m); lua_setfield(L,-2,"__index"); lua_pop(L,1); -- cgit v1.2.3-70-g09d2