added ag::loadStaticModel()

git-svn-id: svn://anubis/anaglym/trunk@45 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-01 03:46:14 +00:00
parent 05858c0c22
commit 8e502af057
2 changed files with 18 additions and 2 deletions

19
ag.cc
View File

@ -23,6 +23,7 @@ namespace ag
{ "print", print }, { "print", print },
{ "println", println }, { "println", println },
{ "loadModel", loadModel }, { "loadModel", loadModel },
{ "loadStaticModel", loadStaticModel },
{ "videoStart", videoStart }, { "videoStart", videoStart },
{ "videoStop", videoStop }, { "videoStop", videoStop },
{ "sleep", sleep }, { "sleep", sleep },
@ -99,7 +100,7 @@ namespace ag
return ret; return ret;
} }
int loadModel(lua_State * L) static int loadModelSpecify(lua_State * L, bool static_data)
{ {
int argc = lua_gettop(L); int argc = lua_gettop(L);
@ -123,12 +124,16 @@ namespace ag
lua_setfield(L, -2, "id"); lua_setfield(L, -2, "id");
lua_pushcfunction(L, object::draw); lua_pushcfunction(L, object::draw);
lua_setfield(L, -2, "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 != "") if (physpath != "")
{ {
Engine::Object * obj = g_engine->getObject(id); Engine::Object * obj = g_engine->getObject(id);
if (obj != NULL) if (obj != NULL)
{ {
obj->loadPhy(physpath); obj->loadPhy(physpath, static_data);
} }
} }
return 1; return 1;
@ -146,6 +151,16 @@ namespace ag
return 1; return 1;
} }
int loadModel(lua_State * L)
{
loadModelSpecify(L, false);
}
int loadStaticModel(lua_State * L)
{
loadModelSpecify(L, true);
}
int videoStart(lua_State * L) int videoStart(lua_State * L)
{ {
g_engine->getVideo()->start(); g_engine->getVideo()->start();

1
ag.h
View File

@ -10,6 +10,7 @@ namespace ag
int print(lua_State * L); int print(lua_State * L);
int println(lua_State * L); int println(lua_State * L);
int loadModel(lua_State * L); int loadModel(lua_State * L);
int loadStaticModel(lua_State * L);
int videoStart(lua_State * L); int videoStart(lua_State * L);
int videoStop(lua_State * L); int videoStop(lua_State * L);
int sleep(lua_State * L); int sleep(lua_State * L);