working on mousewheel stuff
This commit is contained in:
@@ -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
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user