added autoDrawObjects setting, on by default
git-svn-id: svn://anubis/anaglym/trunk@88 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
53e98eb57a
commit
967b6ac5b5
@ -33,6 +33,7 @@ Engine::Engine(const string & path)
|
|||||||
m_autoPhysics = true;
|
m_autoPhysics = true;
|
||||||
m_autoStartFrame = true;
|
m_autoStartFrame = true;
|
||||||
m_autoEndFrame = true;
|
m_autoEndFrame = true;
|
||||||
|
m_autoDrawObjects = true;
|
||||||
|
|
||||||
size_t pos = path.find_last_of("\\/");
|
size_t pos = path.find_last_of("\\/");
|
||||||
m_engine_path = (pos != string::npos) ? string(path, 0, pos) : ".";
|
m_engine_path = (pos != string::npos) ? string(path, 0, pos) : ".";
|
||||||
@ -285,6 +286,8 @@ void Engine::update()
|
|||||||
{
|
{
|
||||||
lua_pop(m_luaState, 1);
|
lua_pop(m_luaState, 1);
|
||||||
}
|
}
|
||||||
|
if (m_autoDrawObjects)
|
||||||
|
drawObjects();
|
||||||
if (m_autoEndFrame)
|
if (m_autoEndFrame)
|
||||||
endFrame();
|
endFrame();
|
||||||
m_drawing = false;
|
m_drawing = false;
|
||||||
|
9
Engine.h
9
Engine.h
@ -60,12 +60,14 @@ class Engine
|
|||||||
Object * getObject(int id);
|
Object * getObject(int id);
|
||||||
void doPhysics();
|
void doPhysics();
|
||||||
void drawObjects();
|
void drawObjects();
|
||||||
void setAutoPhysics(bool autoPhysics) { m_autoPhysics = autoPhysics; }
|
void setAutoPhysics(bool val) { m_autoPhysics = val; }
|
||||||
bool getAutoPhysics() { return m_autoPhysics; }
|
bool getAutoPhysics() { return m_autoPhysics; }
|
||||||
void setAutoStartFrame(bool asf) { m_autoStartFrame = asf; }
|
void setAutoStartFrame(bool val) { m_autoStartFrame = val; }
|
||||||
bool getAutoStartFrame() { return m_autoStartFrame; }
|
bool getAutoStartFrame() { return m_autoStartFrame; }
|
||||||
void setAutoEndFrame(bool asf) { m_autoEndFrame = asf; }
|
void setAutoEndFrame(bool val) { m_autoEndFrame = val; }
|
||||||
bool getAutoEndFrame() { return m_autoEndFrame; }
|
bool getAutoEndFrame() { return m_autoEndFrame; }
|
||||||
|
void setAutoDrawObjects(bool val) { m_autoDrawObjects = val; }
|
||||||
|
bool getAutoDrawObjects() { return m_autoDrawObjects; }
|
||||||
void startFrame();
|
void startFrame();
|
||||||
void endFrame();
|
void endFrame();
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ class Engine
|
|||||||
bool m_autoPhysics;
|
bool m_autoPhysics;
|
||||||
bool m_autoStartFrame;
|
bool m_autoStartFrame;
|
||||||
bool m_autoEndFrame;
|
bool m_autoEndFrame;
|
||||||
|
bool m_autoDrawObjects;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Engine * g_engine;
|
extern Engine * g_engine;
|
||||||
|
9
ag.cc
9
ag.cc
@ -35,6 +35,7 @@ namespace ag
|
|||||||
{ "setAutoPhysics", setAutoPhysics },
|
{ "setAutoPhysics", setAutoPhysics },
|
||||||
{ "setAutoStartFrame", setAutoStartFrame },
|
{ "setAutoStartFrame", setAutoStartFrame },
|
||||||
{ "setAutoEndFrame", setAutoEndFrame },
|
{ "setAutoEndFrame", setAutoEndFrame },
|
||||||
|
{ "setAutoDrawObjects", setAutoDrawObjects },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
luaL_register(L, "ag", functions);
|
luaL_register(L, "ag", functions);
|
||||||
@ -260,6 +261,14 @@ namespace ag
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setAutoDrawObjects(lua_State * L)
|
||||||
|
{
|
||||||
|
int argc = lua_gettop(L);
|
||||||
|
if (argc == 1 && lua_isboolean(L, 1))
|
||||||
|
g_engine->setAutoDrawObjects(lua_toboolean(L, 1));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
namespace object
|
namespace object
|
||||||
{
|
{
|
||||||
static Engine::Object * getObject(lua_State * L, int index)
|
static Engine::Object * getObject(lua_State * L, int index)
|
||||||
|
1
ag.h
1
ag.h
@ -21,6 +21,7 @@ namespace ag
|
|||||||
int setAutoPhysics(lua_State * L);
|
int setAutoPhysics(lua_State * L);
|
||||||
int setAutoStartFrame(lua_State * L);
|
int setAutoStartFrame(lua_State * L);
|
||||||
int setAutoEndFrame(lua_State * L);
|
int setAutoEndFrame(lua_State * L);
|
||||||
|
int setAutoDrawObjects(lua_State * L);
|
||||||
|
|
||||||
namespace object
|
namespace object
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
function update()
|
function update()
|
||||||
ballx, bally, ballz = ball:getPosition()
|
ballx, bally, ballz = ball:getPosition()
|
||||||
ag.setCamera(7, -6, 15, ballx, bally, ballz, 0, 0, 1)
|
ag.setCamera(7, -6, 15, ballx, bally, ballz, 0, 0, 1)
|
||||||
ag.drawObjects()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--ag.setCamera(8, -8, 15, -8, 8, 4, 0, 0, 1)
|
--ag.setCamera(8, -8, 15, -8, 8, 4, 0, 0, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user