diff options
Diffstat (limited to 'src/client/lua_api/load_video.cpp')
| -rw-r--r-- | src/client/lua_api/load_video.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/client/lua_api/load_video.cpp b/src/client/lua_api/load_video.cpp index 607759c..e0c7557 100644 --- a/src/client/lua_api/load_video.cpp +++ b/src/client/lua_api/load_video.cpp @@ -20,7 +20,7 @@ extern IVideoDriver* driver; //video.drawtexture //{texture},{x,y} -//{texture},{x,y},{sourcerect},,{color},use_alpha +//{texture},{x,y},{sourcerect},{color},use_alpha int draw2dimage(lua_State* L){ int nargs = lua_gettop(L); //printf("Drawing a 2d image\n"); @@ -66,6 +66,19 @@ int draw2dimage(lua_State* L){ return 0; } +//{sx,sy},{ex,ey},{color} +int draw2dline(lua_State* L){ + long sx,sy,ex,ey; + long r,g,b,a; + popvector4i(L,&r,&g,&b,&a); + popvector2i(L,&ex,&ey); + popvector2i(L,&sx,&sy); + + driver->draw2DLine(position2d<s32>(sx,sy),position2d<s32>(ex,ey),SColor(r,g,b,a)); + + return 0; +} + void load_videofuncs(lua_State* L){ //printf("Loading video libraries...\n"); lua_newtable(L);//{} @@ -74,6 +87,8 @@ void load_videofuncs(lua_State* L){ lua_getglobal(L,"video");//{} lua_pushcfunction(L,draw2dimage);//{},draw2dimage() lua_setfield(L,-2,"drawtexture");//{} + lua_pushcfunction(L,draw2dline);//{},draw2dline() + lua_setfield(L,-2,"drawline");//{} lua_pop(L,1);// smaterial_register(L); |
