From ef25a513437196a3ea9ee45e6e03565eb86067d2 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 28 Jun 2018 16:05:26 -0600 Subject: Simplified makefile Made makefile much simpiler, added option to build dynamically with DEBUG=true --- src/client/lua_api/gui/iguiwindow.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/client/lua_api/gui/iguiwindow.cpp') diff --git a/src/client/lua_api/gui/iguiwindow.cpp b/src/client/lua_api/gui/iguiwindow.cpp index 150ba68..705af18 100644 --- a/src/client/lua_api/gui/iguiwindow.cpp +++ b/src/client/lua_api/gui/iguiwindow.cpp @@ -15,7 +15,7 @@ extern "C" { #include "iguiwindow.hpp" #include "iguiutil.hpp" #include "../../callbackhandeler.hpp" -#include "../../../shared/lua_api/common.h" +#include using namespace irr; using namespace gui; @@ -32,39 +32,38 @@ static bool iguiwindowevent(irr::SEvent e){ return shouldclose == 1; } -//new({posx,posy},{width,height},"title"[,parent]) +//new({{sx,sy},{ex,ey}},"title"[,{guielement=parent}]) :: {guielement} static int newiguiwindow(lua_State* L){ IGUIElement* parent = NULL; int numargs = lua_gettop(L); if(numargs == 4){ + lua_getfield(L,-1,"guielement");//{{sx,sy},{ex,ey}},"title",{guielement=parent},parent parent = (IGUIElement*)lua_touserdata(L,-1); - lua_pop(L,1); + lua_pop(L,2); } + //{{sx,sy},{ex,ey},"title" const char* title_c = lua_tostring(L,-1); const wchar_t* title_w = irr::core::stringw(title_c).c_str(); - lua_pop(L,1); + lua_pop(L,1);//{{sx,sy},{ex,ey}} //Frame position - long x,y,w,h; - popvector2i(L,&w,&h); - popvector2i(L,&x,&y); + long sx,sy,ex,ey; + poprecti(L,&sx,&sy,&ex,&ey);// //Create the window IGUIEnvironment* env = guidevice->getGUIEnvironment(); IGUIWindow* wi = env->addWindow( - core::rect(x,y,x+w,y+h), + core::rect(sx,sy,ex,ey), false, title_w, parent, -1 ); - lua_pushlightuserdata(L,wi); - lua_newtable(L);//{} lua_pushlightuserdata(L,wi);//{},{ud_window} - lua_setfield(L,-2,"element");//{element=ud_window} + lua_setfield(L,-2,"guielement");//{element=ud_window} luaL_getmetatable(L,"gui.window");//{element=ud_window},{m_gui.window} lua_setmetatable(L,-2);//{element=ud_window, __meta=gui.window} -- cgit v1.2.3-70-g09d2