aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/simple.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-09 23:55:49 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-09 23:55:49 -0500
commit2831e232b886c5e3b0791ea5192f9e5194e6abf3 (patch)
tree4fb9309d18f388673b7a21b8f0e927727006f585 /src/client/lua_api/gui/simple.cpp
parent35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940 (diff)
downloadbrokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.gz
brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.bz2
brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.zip
Added IGUIImages
Added the ability to display itextures on the gui
Diffstat (limited to 'src/client/lua_api/gui/simple.cpp')
-rw-r--r--src/client/lua_api/gui/simple.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/client/lua_api/gui/simple.cpp b/src/client/lua_api/gui/simple.cpp
new file mode 100644
index 0000000..8790069
--- /dev/null
+++ b/src/client/lua_api/gui/simple.cpp
@@ -0,0 +1,55 @@
+#include <irrlicht.h>
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+
+// {{startx, starty},{endx,endy}}
+lua_torecti(lua_State* L, int number, int* sx, int* sy, int* ex, int* ey){
+ lua_pushnumber(L,1);// ...,{},...,1
+ lua_gettable(L,number);// ...,{{sx,sy},{ex,ey}},...,{sx,sy}
+
+ lua_pushnumber(L,1);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},1
+ lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},sx
+ *sx = lua_tonumber(L,-1);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},sx
+
+ lua_pop(1);// ...,{{sx,sy},{ex,ey}},...,{sx,sy}
+
+ lua_pushnumber(L,2);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},2
+ lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},sy
+ *sy = lua_tonumber(L,-1);
+
+ lua_pop(2);// ...,{{sx,sy},{ex,ey}},...
+
+
+ lua_pushnumber(L,2);// ...,{{sx,sy},{ex,ey}},...,2
+ lua_gettable(L,number);// ...,{{sx,sy},{ex,ey}},...,{ex,ey}
+ lua_pushnumber(L,1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},1
+
+ lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ex
+ *ex = lua_tonumber(L,-1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ex
+ lua_pop(L,1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey}
+
+ lua_pushnumber(L,2);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},2
+ lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ey
+ *ey = lua_tonumber(L,-1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ey
+
+ lua_pop(L,2);// ...,{{sx,sy},{ex,ey}},...
+}
+
+int addIGUIButton(lua_State* L){
+ IGUIEnvironment env = lua_touserdata(L,1);
+ IGUIElement parent = lua_touserdata(L,2);
+ s32 id = lua_tonumber(L,3);
+ s32 sx,sy,ex,ey;
+ lua_torecti(L,4,&sx,&sy,&ex,&ey);
+ core::rect<s32> rect = core::rect<s32>(sx,sy,ex,ey);
+ IGUIElement* button = env->addButton(rect,parent,id,
+
+}
+
+void add_gui(lua_State* L){
+
+}
+