fixed mouse coordinates to have the origin at the lower-left corner to be consistent with 2D drawing coordinates
git-svn-id: svn://anubis/anaglym/trunk@274 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
bff31eed86
commit
a646edfaa2
1
.todo
1
.todo
@ -1,4 +1,3 @@
|
||||
add audio capabilities
|
||||
add fillCircle()
|
||||
add gradient functionality
|
||||
reconcile mouse coordinates & 2D coordinates
|
||||
|
10
Engine.cc
10
Engine.cc
@ -670,7 +670,7 @@ refptr< vector<int> > Engine::pickObjects(int x, int y)
|
||||
forward[0], forward[1], forward[2]);
|
||||
initial_direction[0] = x - m_av.getWidth() / 2;
|
||||
initial_direction[1] = m_screen_dist;
|
||||
initial_direction[2] = m_av.getHeight() / 2 - y;
|
||||
initial_direction[2] = y - m_av.getHeight() / 2;
|
||||
dMultiply0(rotated_direction, r, initial_direction, 3, 3, 1);
|
||||
normalize(rotated_direction);
|
||||
|
||||
@ -1040,7 +1040,7 @@ void Engine::mousebutton_down_event(int button, int x, int y)
|
||||
EVENT_HANDLER_AG_NAME(mousebutton_down));
|
||||
lua_pushinteger(m_luaState, button);
|
||||
lua_pushnumber(m_luaState, x);
|
||||
lua_pushnumber(m_luaState, y);
|
||||
lua_pushnumber(m_luaState, m_av.getHeight() - y);
|
||||
/* call the mouse button down event function
|
||||
* This pops the function ref and arguments from the stack */
|
||||
int s = lua_pcall(m_luaState, 3, 0, 0);
|
||||
@ -1056,7 +1056,7 @@ void Engine::mousebutton_up_event(int button, int x, int y)
|
||||
EVENT_HANDLER_AG_NAME(mousebutton_up));
|
||||
lua_pushinteger(m_luaState, button);
|
||||
lua_pushnumber(m_luaState, x);
|
||||
lua_pushnumber(m_luaState, y);
|
||||
lua_pushnumber(m_luaState, m_av.getHeight() - y);
|
||||
/* call the mouse button up event function
|
||||
* This pops the function ref and arguments from the stack */
|
||||
int s = lua_pcall(m_luaState, 3, 0, 0);
|
||||
@ -1071,9 +1071,9 @@ void Engine::mouse_motion_event(int x, int y, int xrel, int yrel)
|
||||
lua_getfield(m_luaState, LUA_GLOBALSINDEX,
|
||||
EVENT_HANDLER_AG_NAME(mouse_motion));
|
||||
lua_pushnumber(m_luaState, x);
|
||||
lua_pushnumber(m_luaState, y);
|
||||
lua_pushnumber(m_luaState, m_av.getHeight() - y);
|
||||
lua_pushnumber(m_luaState, xrel);
|
||||
lua_pushnumber(m_luaState, yrel);
|
||||
lua_pushnumber(m_luaState, -yrel);
|
||||
/* call the mouse motion event function
|
||||
* This pops the function ref and arguments from the stack */
|
||||
int s = lua_pcall(m_luaState, 4, 0, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user