working on mousewheel stuff

This commit is contained in:
AJ Kelly
2011-03-16 16:35:48 -05:00
parent 0812bc2e29
commit cea981d2c9
2 changed files with 15 additions and 1 deletions
+11
View File
@@ -100,6 +100,7 @@ InputFilter::InputFilter()
m_MouseCoords.fX = 0; m_MouseCoords.fX = 0;
m_MouseCoords.fY = 0; m_MouseCoords.fY = 0;
m_MouseCoords.fZ = 0;
// Register with Lua. // Register with Lua.
{ {
@@ -415,6 +416,10 @@ void InputFilter::UpdateCursorLocation(float _fX, float _fY)
m_MouseCoords.fY = _fY; m_MouseCoords.fY = _fY;
} }
void InputFilter::UpdateMouseWheel(float _fZ)
{
m_MouseCoords.fZ = _fZ;
}
// lua start // lua start
#include "LuaBinding.h" #include "LuaBinding.h"
@@ -439,11 +444,17 @@ public:
lua_pushnumber( L, fY ); lua_pushnumber( L, fY );
return 1; return 1;
} }
static int GetMouseWheel( T* p, lua_State *L ){
float fZ = p->GetMouseWheel();
lua_pushnumber( L, fZ );
return 1;
}
LunaInputFilter() LunaInputFilter()
{ {
ADD_METHOD( GetMouseX ); ADD_METHOD( GetMouseX );
ADD_METHOD( GetMouseY ); ADD_METHOD( GetMouseY );
ADD_METHOD( GetMouseWheel );
} }
}; };
+3
View File
@@ -37,6 +37,7 @@ struct MouseCoordinates
{ {
float fX; float fX;
float fY; float fY;
float fZ;
}; };
class RageMutex; class RageMutex;
@@ -70,8 +71,10 @@ public:
// cursor // cursor
void UpdateCursorLocation(float _fX, float _fY); void UpdateCursorLocation(float _fX, float _fY);
void UpdateMouseWheel(float _fZ);
float GetCursorX(){ return m_MouseCoords.fX; } float GetCursorX(){ return m_MouseCoords.fX; }
float GetCursorY(){ return m_MouseCoords.fY; } float GetCursorY(){ return m_MouseCoords.fY; }
float GetMouseWheel(){ return m_MouseCoords.fZ; }
// Lua // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );