registering lua function setTextureScale for objects
git-svn-id: svn://anubis/anaglym/trunk@220 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
fd4b6b27c8
commit
de49999c88
23
Engine.cc
23
Engine.cc
@ -925,20 +925,17 @@ void Engine::mouse_motion_event(int x, int y, int xrel, int yrel)
|
|||||||
void Engine::checkForFunctionFull(const std::string & lua_fn_name,
|
void Engine::checkForFunctionFull(const std::string & lua_fn_name,
|
||||||
const std::string & event_name, bool & presentFlag)
|
const std::string & event_name, bool & presentFlag)
|
||||||
{
|
{
|
||||||
if (!presentFlag) /* only look for events we do not have a handler for */
|
lua_getfield(m_luaState, LUA_GLOBALSINDEX, lua_fn_name.c_str());
|
||||||
|
if (lua_isfunction(m_luaState, -1))
|
||||||
{
|
{
|
||||||
lua_getfield(m_luaState, LUA_GLOBALSINDEX, lua_fn_name.c_str());
|
lua_setfield(m_luaState, LUA_GLOBALSINDEX,
|
||||||
if (lua_isfunction(m_luaState, -1))
|
(AG_EVENT_PREFIX + event_name).c_str());
|
||||||
{
|
presentFlag = true;
|
||||||
lua_setfield(m_luaState, LUA_GLOBALSINDEX,
|
}
|
||||||
(AG_EVENT_PREFIX + event_name).c_str());
|
else
|
||||||
presentFlag = true;
|
{
|
||||||
}
|
lua_pop(m_luaState, 1);
|
||||||
else
|
presentFlag = false;
|
||||||
{
|
|
||||||
lua_pop(m_luaState, 1);
|
|
||||||
presentFlag = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
Engine.h
1
Engine.h
@ -71,6 +71,7 @@ class Engine
|
|||||||
void setTextureScale(float scale)
|
void setTextureScale(float scale)
|
||||||
{
|
{
|
||||||
m_texture_scale = scale;
|
m_texture_scale = scale;
|
||||||
|
render();
|
||||||
}
|
}
|
||||||
void draw();
|
void draw();
|
||||||
dReal getMass() { return m_ode_object->getMass(); }
|
dReal getMass() { return m_ode_object->getMass(); }
|
||||||
|
2
ag.cc
2
ag.cc
@ -169,6 +169,8 @@ namespace ag
|
|||||||
lua_setfield(L, -2, "setColor");
|
lua_setfield(L, -2, "setColor");
|
||||||
lua_pushcfunction(L, object::setTexture);
|
lua_pushcfunction(L, object::setTexture);
|
||||||
lua_setfield(L, -2, "setTexture");
|
lua_setfield(L, -2, "setTexture");
|
||||||
|
lua_pushcfunction(L, object::setTextureScale);
|
||||||
|
lua_setfield(L, -2, "setTextureScale");
|
||||||
lua_pushcfunction(L, object::setMass);
|
lua_pushcfunction(L, object::setMass);
|
||||||
lua_setfield(L, -2, "setMass");
|
lua_setfield(L, -2, "setMass");
|
||||||
lua_pushcfunction(L, object::getMass);
|
lua_pushcfunction(L, object::getMass);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user