From 8e502af0572b24aab75616d66d4424bfe864daac Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 1 Oct 2009 03:46:14 +0000 Subject: [PATCH] added ag::loadStaticModel() git-svn-id: svn://anubis/anaglym/trunk@45 99a6e188-d820-4881-8870-2d33a10e2619 --- ag.cc | 19 +++++++++++++++++-- ag.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) 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);