aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/iguicheckbox.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-05-28 17:07:04 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-05-28 17:07:04 -0400
commit06d3e8182d018ca613f177f6ff7a3bbb6494cc79 (patch)
tree18289e9d48c03cb3910e5fbe27ffd18c6b81eb53 /src/client/lua_api/gui/iguicheckbox.cpp
parent5fc253ce728c6e078886e092376c2e0f0320ebd9 (diff)
downloadbrokengine-06d3e8182d018ca613f177f6ff7a3bbb6494cc79.tar.gz
brokengine-06d3e8182d018ca613f177f6ff7a3bbb6494cc79.tar.bz2
brokengine-06d3e8182d018ca613f177f6ff7a3bbb6494cc79.zip
Various additions
Various additions, updates, and bugfixes while making mahjong solitare.
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;