aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/video/draw.cpp
blob: 7140162d6a902fb50ca9be516ddab5945bd036d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);//
}