added ag.setCursorVisible() and ag.getCursorVisible()
git-svn-id: svn://anubis/anaglym/trunk@248 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
4daec02c31
commit
f8fbdf8fcb
1
.todo
1
.todo
@ -1,3 +1,2 @@
|
||||
add Lua interface for showing/hiding mouse cursor
|
||||
add 3d-picking routines using temporary ODE ray geometries
|
||||
add audio capabilities
|
||||
|
6
Engine.h
6
Engine.h
@ -189,6 +189,12 @@ class Engine
|
||||
void drawList(GLuint list);
|
||||
void callList(GLuint list);
|
||||
void clearWorld();
|
||||
void setScriptCursorVisible(bool visible)
|
||||
{
|
||||
m_script_cursor_visible = visible;
|
||||
updateCursorVisibility();
|
||||
}
|
||||
bool getScriptCursorVisible() { return m_script_cursor_visible; }
|
||||
|
||||
void getScreenSize(int * width, int * height);
|
||||
void drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
||||
|
18
ag.cc
18
ag.cc
@ -39,6 +39,7 @@ namespace ag
|
||||
{ "exit", exit },
|
||||
{ "fillRect", fillRect },
|
||||
{ "getCamera", getCamera },
|
||||
{ "getCursorVisible", getCursorVisible },
|
||||
{ "getScreenSize", getScreenSize },
|
||||
{ "getTextSize", getTextSize },
|
||||
{ "import", import },
|
||||
@ -54,6 +55,7 @@ namespace ag
|
||||
{ "setAutoPhysics", setAutoPhysics },
|
||||
{ "setAutoStartFrame", setAutoStartFrame },
|
||||
{ "setCamera", setCamera },
|
||||
{ "setCursorVisible", setCursorVisible },
|
||||
{ "setGravity", setGravity },
|
||||
// { "sleep", sleep },
|
||||
{ "startFrame", startFrame },
|
||||
@ -411,6 +413,16 @@ namespace ag
|
||||
return g_engine->setCamera(L);
|
||||
}
|
||||
|
||||
int setCursorVisible(lua_State * L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
if (argc == 1 && lua_isboolean(L, 1))
|
||||
{
|
||||
g_engine->setScriptCursorVisible(lua_toboolean(L, 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setGravity(lua_State * L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
@ -431,6 +443,12 @@ namespace ag
|
||||
return g_engine->getCamera(L);
|
||||
}
|
||||
|
||||
int getCursorVisible(lua_State * L)
|
||||
{
|
||||
lua_pushboolean(L, g_engine->getScriptCursorVisible());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int elapsedTime(lua_State * L)
|
||||
{
|
||||
lua_pushinteger(L, SDL_GetTicks());
|
||||
|
2
ag.h
2
ag.h
@ -19,6 +19,7 @@ namespace ag
|
||||
int endList(lua_State * L);
|
||||
int exit(lua_State * L);
|
||||
int getCamera(lua_State * L);
|
||||
int getCursorVisible(lua_State * L);
|
||||
int getScreenSize(lua_State * L);
|
||||
int import(lua_State * L);
|
||||
int isKeyDown(lua_State * L);
|
||||
@ -33,6 +34,7 @@ namespace ag
|
||||
int setAutoPhysics(lua_State * L);
|
||||
int setAutoStartFrame(lua_State * L);
|
||||
int setCamera(lua_State * L);
|
||||
int setCursorVisible(lua_State * L);
|
||||
int setGravity(lua_State * L);
|
||||
int sleep(lua_State * L);
|
||||
int startFrame(lua_State * L);
|
||||
|
@ -52,5 +52,7 @@ function key_down_event(key)
|
||||
-- { x = 0, y = 0, z = 1, vel = 0, fmax = 0 })
|
||||
-- local x, y, z = box:getPosition()
|
||||
-- box:setPosition(x, y, 2)
|
||||
elseif (key == "minus") then
|
||||
ag.setCursorVisible(not ag.getCursorVisible())
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user