Screenshot for lua

This commit is contained in:
Simon Robertshaw 2011-10-21 17:37:26 +01:00
parent c1eb40af61
commit 08009ebbaa
2 changed files with 23 additions and 3 deletions

View File

@ -77,4 +77,5 @@ int luatpt_setdebug(lua_State* l);
int luatpt_setfpscap(lua_State* l); int luatpt_setfpscap(lua_State* l);
int luatpt_getscript(lua_State* l); int luatpt_getscript(lua_State* l);
int luatpt_setwindowsize(lua_State* l); int luatpt_setwindowsize(lua_State* l);
int luatpt_screenshot(lua_State* l);
#endif #endif

View File

@ -65,6 +65,7 @@ void luacon_open(){
{"getscript",&luatpt_getscript}, {"getscript",&luatpt_getscript},
{"setwindowsize",&luatpt_setwindowsize}, {"setwindowsize",&luatpt_setwindowsize},
{"watertest",&luatpt_togglewater}, {"watertest",&luatpt_togglewater},
{"screenshot",&luatpt_screenshot},
{NULL,NULL} {NULL,NULL}
}; };
@ -1123,9 +1124,9 @@ int luatpt_setdebug(lua_State* l)
} }
int luatpt_setfpscap(lua_State* l) int luatpt_setfpscap(lua_State* l)
{ {
int fpscap = luaL_optint(l, 1, 0); int fpscap = luaL_optint(l, 1, 0);
limitFPS = fpscap; limitFPS = fpscap;
return 0; return 0;
} }
int luatpt_getscript(lua_State* l) int luatpt_getscript(lua_State* l)
{ {
@ -1225,4 +1226,22 @@ int luatpt_setwindowsize(lua_State* l)
return 1; return 1;
} }
int luatpt_screenshot(lua_State* l)
{
int captureUI = luaL_optint(l, 1, 0);
if(vid_buf)
{
if(captureUI)
{
dump_frame(vid_buf, XRES+BARSIZE, YRES+MENUSIZE, XRES+BARSIZE);
}
else
{
dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE);
}
return 0;
}
return luaL_error(l, "Screen buffer does not exist");
}
#endif #endif