aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/video/draw.cpp
diff options
context:
space:
mode:
authorAlexander <alex@cogarr.net>2019-10-27 17:25:16 -0400
committerAlexander <alex@cogarr.net>2019-10-27 17:25:16 -0400
commit0d2de2ba9c616862d7881f089382db772d034f89 (patch)
tree5fc58b63c593e2ac17f3353b50318c299f643390 /src/client/lua_api/video/draw.cpp
parentc9db55cdc2f69c3dc7aefabe0cc828a64e377024 (diff)
downloadbrokengine-0d2de2ba9c616862d7881f089382db772d034f89.tar.gz
brokengine-0d2de2ba9c616862d7881f089382db772d034f89.tar.bz2
brokengine-0d2de2ba9c616862d7881f089382db772d034f89.zip
Various updates
Diffstat (limited to 'src/client/lua_api/video/draw.cpp')
-rw-r--r--src/client/lua_api/video/draw.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/lua_api/video/draw.cpp b/src/client/lua_api/video/draw.cpp
new file mode 100644
index 0000000..1f38f34
--- /dev/null
+++ b/src/client/lua_api/video/draw.cpp
@@ -0,0 +1,29 @@
+
+#include <irrlicht.h>
+#include <shared/lua_api/common.hpp>
+#include "draw.hpp"
+
+using namespace irr;
+using namespace video;
+using namespace core;
+
+extern IrrlichtDevice* device;
+extern IVideoDriver* driver;
+//drawline2d {startx,starty},{endx,endy},{r,g,b,a}
+int drawline2d(lua_State *L){
+ long r,g,b,a;
+ popvector4i(L, &r, &g, &b, &a);
+ long endx, endy;
+ popvector2i(L, &endx, &endy);
+ long startx, starty;
+ popvector2i(L, &startx, &starty);
+ driver->draw2DLine(position2d<s32>(startx, starty), position2d<s32>(endx,endy), SColor(r,g,b,a));
+ return 0;
+}
+
+void draw_register(lua_State *L){
+ lua_getglobal(L,"video");//{video}
+ lua_pushcfunction(L,drawline2d);//{video},drawline2d()
+ lua_setfield(L,-2,"drawline2d");//{video}
+ lua_pop(L,1);//
+}