Add drawerlib deltaTime function

This commit is contained in:
Eidolon 2022-04-26 13:47:35 -05:00
parent 4095ef599b
commit f418c6476f

View file

@ -1201,6 +1201,14 @@ static int libd_getusertransflag(lua_State *L)
return 1; return 1;
} }
// Return the time elapsed for the previous frame, in tics.
static int libd_deltaTime(lua_State *L)
{
HUDONLY
lua_pushfixed(L, renderdeltatics);
return 1;
}
static luaL_Reg lib_draw[] = { static luaL_Reg lib_draw[] = {
// cache // cache
{"patchExists", libd_patchExists}, {"patchExists", libd_patchExists},
@ -1242,6 +1250,7 @@ static luaL_Reg lib_draw[] = {
{"renderer", libd_renderer}, {"renderer", libd_renderer},
{"localTransFlag", libd_getlocaltransflag}, {"localTransFlag", libd_getlocaltransflag},
{"userTransFlag", libd_getusertransflag}, {"userTransFlag", libd_getusertransflag},
{"deltaTime", libd_deltaTime},
{NULL, NULL} {NULL, NULL}
}; };