/src/bindings/bind_app.cpp
https://bitbucket.org/vivkin/gam3b00bs/ · C++ · 52 lines · 41 code · 10 blank · 1 comment · 0 complexity · c57a45a0f8e4b6792738344535c12849 MD5 · raw file
- #include "common.h"
- #include "bind_all.h"
- #include "app/app.h"
-
- namespace luab
- {
-
- static int bind_app_init( lua_State * L )
- {
- lua_pushboolean( L, app::init() );
- return 1;
- }
-
- static int bind_app_term( lua_State * L )
- {
- app::term();
- return 0;
- }
-
- static int bind_app_tick( lua_State * L )
- {
- lua_pushboolean( L, app::tick() );
- return 1;
- }
-
- static int bind_app_time( lua_State * L )
- {
- struct app::timings t = app::time();
- lua_newtable( L );
- lua_pushnumber( L, t.T ); lua_setfield( L, -2, "T" );
- lua_pushnumber( L, t.dt); lua_setfield( L, -2, "dt" );
- return 1;
- }
-
- static const struct luaL_reg funcs[] =
- {
- { "init", bind_app_init },
- { "term", bind_app_term },
- { "tick", bind_app_tick },
- { "time", bind_app_time },
- {0,0}
- };
-
-
- /////////////////////////////////////////////////////////
-
- void bind_app( lua_State * L )
- {
- luaL_register( L, "app", funcs );
- }
- }