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.fY = 0;
m_MouseCoords.fZ = 0;
// Register with Lua.
{
@@ -415,6 +416,10 @@ void InputFilter::UpdateCursorLocation(float _fX, float _fY)
m_MouseCoords.fY = _fY;
}
void InputFilter::UpdateMouseWheel(float _fZ)
{
m_MouseCoords.fZ = _fZ;
}
// lua start
#include "LuaBinding.h"
@@ -439,11 +444,17 @@ public:
lua_pushnumber( L, fY );
return 1;
}
static int GetMouseWheel( T* p, lua_State *L ){
float fZ = p->GetMouseWheel();
lua_pushnumber( L, fZ );
return 1;
}
LunaInputFilter()
{
ADD_METHOD( GetMouseX );
ADD_METHOD( GetMouseY );
ADD_METHOD( GetMouseWheel );
}
};
+4 -1
View File
@@ -37,6 +37,7 @@ struct MouseCoordinates
{
float fX;
float fY;
float fZ;
};
class RageMutex;
@@ -70,8 +71,10 @@ public:
// cursor
void UpdateCursorLocation(float _fX, float _fY);
void UpdateMouseWheel(float _fZ);
float GetCursorX(){ return m_MouseCoords.fX; }
float GetCursorY(){ return m_MouseCoords.fY; }
float GetMouseWheel(){ return m_MouseCoords.fZ; }
// Lua
void PushSelf( lua_State *L );
@@ -84,7 +87,7 @@ private:
vector<InputEvent> queue;
RageMutex *queuemutex;
MouseCoordinates m_MouseCoords;
InputFilter(const InputFilter& rhs);
InputFilter& operator=(const InputFilter& rhs);
};