summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-05-30 15:45:39 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-30 15:45:39 (GMT)
commit65252aa0028817da65ff193fb06f175c0a7b0c1b (patch)
tree423cae42e0f667b94497b03bc0708ae2a8d95597 /src
parent79a27c2c90823f1f9212d80c6b2d63cde620855c (diff)
downloadpowder-65252aa0028817da65ff193fb06f175c0a7b0c1b.zip
powder-65252aa0028817da65ff193fb06f175c0a7b0c1b.tar.gz
drawtext for Lua
Diffstat (limited to 'src')
-rw-r--r--src/luaconsole.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c
index 4c21613..7e3403c 100644
--- a/src/luaconsole.c
+++ b/src/luaconsole.c
@@ -5,10 +5,10 @@ lua_State *l;
void luacon_open(){
const static struct luaL_reg tptluaapi [] = {
{"test", &luatpt_test},
+ {"drawtext", &luatpt_drawtext},
{NULL,NULL}
};
-
l = lua_open();
luaL_openlibs(l);
luaL_openlib(l, "tpt", tptluaapi, 0);
@@ -57,5 +57,22 @@ int luatpt_test(lua_State* l)
printf("Test successful, got %d\n", testint);
return 1;
}
+int luatpt_drawtext(lua_State* l)
+{
+ char *string;
+ int textx, texty, textred, textgreen, textblue, textalpha;
+ textx = luaL_optint(l, 1, 0);
+ texty = luaL_optint(l, 2, 0);
+ string = luaL_optstring(l, 3, 0);
+ textred = luaL_optint(l, 4, 0);
+ textgreen = luaL_optint(l, 5, 0);
+ textblue = luaL_optint(l, 6, 0);
+ textalpha = luaL_optint(l, 7, 0);
+ if(vid_buf!=NULL){
+ drawtext(vid_buf, textx, texty, string, textred, textgreen, textblue, textalpha);
+ return 0;
+ }
+ return -1;
+}
#endif