diff --git a/ag.cc b/ag.cc index d2e52b1..018ad12 100644 --- a/ag.cc +++ b/ag.cc @@ -23,6 +23,7 @@ namespace ag { "print", print }, { "println", println }, { "loadModel", loadModel }, + { "loadStaticModel", loadStaticModel }, { "videoStart", videoStart }, { "videoStop", videoStop }, { "sleep", sleep }, @@ -99,7 +100,7 @@ namespace ag return ret; } - int loadModel(lua_State * L) + static int loadModelSpecify(lua_State * L, bool static_data) { int argc = lua_gettop(L); @@ -123,12 +124,16 @@ namespace ag lua_setfield(L, -2, "id"); lua_pushcfunction(L, object::draw); lua_setfield(L, -2, "draw"); + lua_pushcfunction(L, object::setPosition); + lua_setfield(L, -2, "setPosition"); + lua_pushcfunction(L, object::getPosition); + lua_setfield(L, -2, "getPosition"); if (physpath != "") { Engine::Object * obj = g_engine->getObject(id); if (obj != NULL) { - obj->loadPhy(physpath); + obj->loadPhy(physpath, static_data); } } return 1; @@ -146,6 +151,16 @@ namespace ag return 1; } + int loadModel(lua_State * L) + { + loadModelSpecify(L, false); + } + + int loadStaticModel(lua_State * L) + { + loadModelSpecify(L, true); + } + int videoStart(lua_State * L) { g_engine->getVideo()->start(); diff --git a/ag.h b/ag.h index fd62469..a3b9de7 100644 --- a/ag.h +++ b/ag.h @@ -10,6 +10,7 @@ namespace ag int print(lua_State * L); int println(lua_State * L); int loadModel(lua_State * L); + int loadStaticModel(lua_State * L); int videoStart(lua_State * L); int videoStop(lua_State * L); int sleep(lua_State * L);