diff options
| author | Alexander Pickering <alex@cogarr.net> | 2018-06-28 16:05:26 -0600 |
|---|---|---|
| committer | Alexander Pickering <alex@cogarr.net> | 2018-06-28 16:05:26 -0600 |
| commit | ef25a513437196a3ea9ee45e6e03565eb86067d2 (patch) | |
| tree | acd43d214f9a7ec96e7fcd66097fd13593dd8f38 /src/client/lua_api/gui/iguiwindow.cpp | |
| parent | 2260a1dda8693664c77a03781ae07fbb5f0ea8a0 (diff) | |
| download | brokengine-ef25a513437196a3ea9ee45e6e03565eb86067d2.tar.gz brokengine-ef25a513437196a3ea9ee45e6e03565eb86067d2.tar.bz2 brokengine-ef25a513437196a3ea9ee45e6e03565eb86067d2.zip | |
Simplified makefile
Made makefile much simpiler, added option to build dynamically with
DEBUG=true
Diffstat (limited to 'src/client/lua_api/gui/iguiwindow.cpp')
| -rw-r--r-- | src/client/lua_api/gui/iguiwindow.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
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 <shared/lua_api/common.hpp> 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<s32>(x,y,x+w,y+h), + core::rect<s32>(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} |
