aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/iguicheckbox.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-06-23 06:52:55 -0600
committerAlexander Pickering <alex@cogarr.net>2018-06-23 06:52:55 -0600
commite6faff1394864a1fe0d517584d1c104997dff39f (patch)
treed7956fc8aabef903f354578d69d4d7fdf64ec928 /src/client/lua_api/gui/iguicheckbox.cpp
parent1aaa348ac080c97c0aeb0a02146ae26b74add5a1 (diff)
parent9fa5dcc9310a8c6ff8c77a47a86303f7b950dcf3 (diff)
downloadbrokengine-e6faff1394864a1fe0d517584d1c104997dff39f.tar.gz
brokengine-e6faff1394864a1fe0d517584d1c104997dff39f.tar.bz2
brokengine-e6faff1394864a1fe0d517584d1c104997dff39f.zip
Merge branch 'master' of ssh://cogarr.net:43/home/git/brokengine
Diffstat (limited to 'src/client/lua_api/gui/iguicheckbox.cpp')
-rw-r--r--src/client/lua_api/gui/iguicheckbox.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/lua_api/gui/iguicheckbox.cpp b/src/client/lua_api/gui/iguicheckbox.cpp
index c6e5955..74dd12e 100644
--- a/src/client/lua_api/gui/iguicheckbox.cpp
+++ b/src/client/lua_api/gui/iguicheckbox.cpp
@@ -10,21 +10,26 @@ extern "C" {
#include "../../../shared/lua_api/common.h"
using namespace irr;
+using namespace gui;
using namespace core;
extern IrrlichtDevice* device;
-//new({startx,starty},{endx,endy},"checkbox_name",parent)
+//new({startx,starty},{endx,endy},"checkbox_name"[,ud_parent])
int newiguicheckbox(lua_State* L){
- int parentid = lua_tointeger(L,-1);
- lua_pop(L,1);//{startx,starty},{endx,endy},"checkbox_name"
+ IGUIElement* par = 0;
+ if(lua_gettop(L) > 3){
+ par = (IGUIElement*)lua_touserdata(L,-1);//{startx,starty},{endx,endy},"checkbox_name",ud_parent
+ printf("Checkbox's parent was %s\n",par);
+ lua_pop(L,1);//{startx,starty},{endx,endy},"checkbox_name"
+ }
const char* text = lua_tostring(L,-1);
int tlen = strlen(text);
lua_pop(L,1);//{startx,starty},{endx,endy}
long startx,starty,endx,endy;
popvector2i(L,&endx,&endy);//{startx,starty}
popvector2i(L,&startx, &starty);//
- irr::gui::IGUICheckBox* cb = device->getGUIEnvironment()->addCheckBox(false,core::rect<int>(startx,starty,endx,endy),0,-1,stringw(text).c_str());
+ irr::gui::IGUICheckBox* cb = device->getGUIEnvironment()->addCheckBox(false,core::rect<int>(startx,starty,endx,endy),par,-1,stringw(text).c_str());
lua_pushlightuserdata(L,cb);//*checkbox
luaL_getmetatable(L,"gui.checkbox");//*checkbox,m{gui.checkbox}
lua_setmetatable(L,-2);//*checkbox
@@ -48,7 +53,6 @@ int iguicheckbox_register(lua_State* L){//
lua_getglobal(L,"gui");//{gui}
lua_pushstring(L,"newcheckbox");//{gui},new(),"newcheckbox"
lua_pushcfunction(L,newiguicheckbox);//{gui},new()
- printf("I have registered the newcheckbox function\n");
lua_settable(L,-3);//{gui}
lua_pop(L,1);
return 0;