aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/video/itexture.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/video/itexture.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/video/itexture.cpp')
-rw-r--r--src/client/lua_api/video/itexture.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/client/lua_api/video/itexture.cpp b/src/client/lua_api/video/itexture.cpp
new file mode 100644
index 0000000..a7f4652
--- /dev/null
+++ b/src/client/lua_api/video/itexture.cpp
@@ -0,0 +1,41 @@
+
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+#include <irrlicht.h>
+#include "itexture.hpp"
+#include "iimage.hpp"
+#include "../../../shared/lua_api/common.h"
+
+using namespace irr;
+using namespace video;
+
+extern IrrlichtDevice* device;
+extern IVideoDriver* driver;
+//newtexture(string name,IImage* image)
+int newitexture(lua_State* L){
+ IImage* im = (IImage*) lua_touserdata(L,-1);
+ lua_pop(L,1);
+ const char* name = lua_tostring(L,-1);
+ lua_pop(L,1);
+
+ ITexture* tex = driver->addTexture(name,im);
+ if(!tex){
+ lua_pushstring(L,"Failed to create texture!");
+ lua_error(L);
+ }
+
+ lua_pushlightuserdata(L,tex);
+
+ return 1;
+}
+
+
+
+void itexture_register(lua_State* L){
+ lua_getglobal(L,"video");
+ lua_pushcfunction(L,newitexture);
+ lua_setfield(L,-2,"newtexture");
+}