aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/iguieditbox.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-08-12 15:03:08 -0400
committerAlexander Pickering <alex@cogarr.net>2018-08-12 15:03:08 -0400
commitd169407dbc6d54ed4eb0bee06c6169b6ea40761d (patch)
tree859d9009286852ba68824af64dbda7cdadf15adc /src/client/lua_api/gui/iguieditbox.cpp
parent57a195bb6bcdcee16824a669270946ff284f629b (diff)
downloadbrokengine-d169407dbc6d54ed4eb0bee06c6169b6ea40761d.tar.gz
brokengine-d169407dbc6d54ed4eb0bee06c6169b6ea40761d.tar.bz2
brokengine-d169407dbc6d54ed4eb0bee06c6169b6ea40761d.zip
Changed files to use the common iguielement registry
Files now use the registry defined in iguielement, so they are all in sync.
Diffstat (limited to 'src/client/lua_api/gui/iguieditbox.cpp')
-rw-r--r--src/client/lua_api/gui/iguieditbox.cpp30
1 files changed, 14 insertions, 16 deletions
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 <shared/util/hashmap.hpp>
#include <shared/lua_api/common.hpp>
+/***
+@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);