aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/load_gui.cpp
diff options
context:
space:
mode:
authorAlexander <alex@cogarr.net>2019-06-26 16:14:00 -0400
committerAlexander <alex@cogarr.net>2019-06-26 16:14:00 -0400
commitd5cd0c7b4425e25b11a1ceec154a5c752d508a42 (patch)
treeef50cd7d419bba30ee08f46c97232b1c8c68d2be /src/client/lua_api/load_gui.cpp
parent3d60e1432ec43ade4aa61b5a70dd6b8975417e9f (diff)
downloadbrokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.tar.gz
brokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.tar.bz2
brokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.zip
Major refactor of physics code
Move all the physics code into the shared directory, and fix the ghost objects (aabb only)
Diffstat (limited to 'src/client/lua_api/load_gui.cpp')
-rw-r--r--src/client/lua_api/load_gui.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/client/lua_api/load_gui.cpp b/src/client/lua_api/load_gui.cpp
index 845661a..64b9711 100644
--- a/src/client/lua_api/load_gui.cpp
+++ b/src/client/lua_api/load_gui.cpp
@@ -25,6 +25,7 @@ extern "C" {
#include "gui/iguispinbox.hpp"
#include "gui/iguitreeview.hpp"
#include "gui/iguicombobox.hpp"
+#include "gui/iguielement.hpp"
#include "../callbackhandeler.hpp"
#include "guiparts.hpp"
@@ -43,6 +44,7 @@ lua_State* tL;
int screenwidth(lua_State* L);
int screenheight(lua_State* L);
+int getroot(lua_State *L);
/***
@function gui.scrw()
@@ -72,7 +74,12 @@ void load_guifuncs(lua_State* L){
//Various enums
lua_newtable(L);
+
+ lua_pushcfunction(L,getroot);
+ lua_setfield(L,-2,"getroot");
+
lua_setglobal(L,"gui");
+
iguilabel_register(L);
iguicheckbox_register(L);
iguiwindow_register(L,device);
@@ -90,19 +97,38 @@ void load_guifuncs(lua_State* L){
lua_pushcfunction(L,screenheight);
lua_setglobal(L,"scrh");
+
+ luaL_newmetatable(L, "gui.iguielement");//{m_iguielement}
+ lua_newtable(L);//{m_iguibutton},{}
+ luaL_register(L,NULL,iguielement_m);
+ lua_setfield(L,-2,"__index");//{m_iguielement}
+ lua_pop(L,1);
+
}
int screenheight(lua_State* L){
- core::rect<s32> dim = guidevice->getGUIEnvironment()->getRootGUIElement()->getAbsoluteClippingRect();
- lua_pushnumber(L,dim.getHeight());
- //printf("Got screen height:%d\n",dim.getWidth());
- return 1;
+ core::rect<s32> dim = guidevice->getGUIEnvironment()->getRootGUIElement()->getAbsoluteClippingRect();
+ lua_pushnumber(L,dim.getHeight());
+ //printf("Got screen height:%d\n",dim.getWidth());
+ return 1;
}
int screenwidth(lua_State* L){
- core::rect<s32> dim = guidevice->getGUIEnvironment()->getRootGUIElement()->getAbsoluteClippingRect();
- lua_pushnumber(L,dim.getWidth());
- //printf("Got screen width:%d\n",dim.getWidth());
- return 1;
+ core::rect<s32> dim = guidevice->getGUIEnvironment()->getRootGUIElement()->getAbsoluteClippingRect();
+ lua_pushnumber(L,dim.getWidth());
+ //printf("Got screen width:%d\n",dim.getWidth());
+ return 1;
+}
+
+//Get the root gui element
+int getroot(lua_State* L){
+ IGUIElement *ele = device->getGUIEnvironment()->getRootGUIElement();
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,ele);//{},ud_iguibutton
+ lua_setfield(L,-2,"guielement");//{guielement}
+ luaL_getmetatable(L,"gui.iguielement");//{guielement},{m_iguibutton}
+ lua_setmetatable(L,-2);//{guielement}
+
+ return 1;
}