From a235db919a40a04779bd5b0a39a9a5b73632e343 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 20 Oct 2009 23:20:41 +0000 Subject: [PATCH] added getCamera() git-svn-id: svn://anubis/anaglym/trunk@117 99a6e188-d820-4881-8870-2d33a10e2619 --- Engine.cc | 14 ++++++++++++++ Engine.h | 1 + ag.cc | 6 ++++++ ag.h | 1 + 4 files changed, 22 insertions(+) diff --git a/Engine.cc b/Engine.cc index 4933cc6..aeb0d86 100644 --- a/Engine.cc +++ b/Engine.cc @@ -257,6 +257,20 @@ int Engine::setCamera(lua_State * L) return 0; } +int Engine::getCamera(lua_State * L) +{ + lua_pushnumber(L, m_eye[0]); + lua_pushnumber(L, m_eye[1]); + lua_pushnumber(L, m_eye[2]); + lua_pushnumber(L, m_center[0]); + lua_pushnumber(L, m_center[1]); + lua_pushnumber(L, m_center[2]); + lua_pushnumber(L, m_up[0]); + lua_pushnumber(L, m_up[1]); + lua_pushnumber(L, m_up[2]); + return 9; +} + int Engine::registerEventHandler(lua_State * L) { int argc = lua_gettop(L); diff --git a/Engine.h b/Engine.h index 4ee07d2..638c0c2 100644 --- a/Engine.h +++ b/Engine.h @@ -109,6 +109,7 @@ class Engine /* lua services */ int setCamera(lua_State * L); + int getCamera(lua_State * L); int registerEventHandler(lua_State * L); int clearEventHandler(lua_State * L); diff --git a/ag.cc b/ag.cc index e59b0bc..fb1de98 100644 --- a/ag.cc +++ b/ag.cc @@ -29,6 +29,7 @@ namespace ag { "startFrame", startFrame }, { "endFrame", endFrame }, { "setCamera", setCamera }, + { "getCamera", getCamera }, { "elapsedTime", elapsedTime }, { "doPhysics", doPhysics }, { "drawObjects", drawObjects }, @@ -208,6 +209,11 @@ namespace ag return g_engine->setCamera(L); } + int getCamera(lua_State * L) + { + return g_engine->getCamera(L); + } + int elapsedTime(lua_State * L) { lua_pushinteger(L, SDL_GetTicks()); diff --git a/ag.h b/ag.h index 0c26af3..c4b5c85 100644 --- a/ag.h +++ b/ag.h @@ -15,6 +15,7 @@ namespace ag int startFrame(lua_State * L); int endFrame(lua_State * L); int setCamera(lua_State * L); + int getCamera(lua_State * L); int elapsedTime(lua_State * L); int doPhysics(lua_State * L); int drawObjects(lua_State * L);