trying to work on mouse stuff and not getting anywhere
This commit is contained in:
@@ -315,8 +315,9 @@ public:
|
|||||||
float level;
|
float level;
|
||||||
|
|
||||||
// Mouse coordinates
|
// Mouse coordinates
|
||||||
unsigned x;
|
//unsigned x;
|
||||||
unsigned y;
|
//unsigned y;
|
||||||
|
int z; // mousewheel
|
||||||
|
|
||||||
/* Whether this button is pressed. This is level with a threshold and
|
/* Whether this button is pressed. This is level with a threshold and
|
||||||
* debouncing applied. */
|
* debouncing applied. */
|
||||||
@@ -324,12 +325,12 @@ public:
|
|||||||
|
|
||||||
RageTimer ts;
|
RageTimer ts;
|
||||||
|
|
||||||
DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(0), x(0), y(0), bDown(false), ts(RageZeroTimer) { }
|
DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(0), z(0), bDown(false), ts(RageZeroTimer) { }
|
||||||
DeviceInput( InputDevice d, DeviceButton b, float l=0 ): device(d), button(b), level(l), x(0), y(0), bDown(l > 0.5f), ts(RageZeroTimer) { }
|
DeviceInput( InputDevice d, DeviceButton b, float l=0 ): device(d), button(b), level(l), z(0), bDown(l > 0.5f), ts(RageZeroTimer) { }
|
||||||
DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ):
|
DeviceInput( InputDevice d, DeviceButton b, float l, const RageTimer &t ):
|
||||||
device(d), button(b), level(l), x(0), y(0), bDown(level > 0.5f), ts(t) { }
|
device(d), button(b), level(l), z(0), bDown(level > 0.5f), ts(t) { }
|
||||||
DeviceInput( InputDevice d, DeviceButton b, const RageTimer &t, unsigned xPos=0, unsigned yPos=0 ):
|
DeviceInput( InputDevice d, DeviceButton b, const RageTimer &t, int zVal=0 ):
|
||||||
device(d), button(b), level(0), x(xPos), y(yPos), bDown(false), ts(t) { }
|
device(d), button(b), level(0), z(zVal), bDown(false), ts(t) { }
|
||||||
|
|
||||||
bool operator==( const DeviceInput &other ) const
|
bool operator==( const DeviceInput &other ) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -413,12 +413,21 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
|
|||||||
break;
|
break;
|
||||||
case DIMOFS_Z:
|
case DIMOFS_Z:
|
||||||
{
|
{
|
||||||
neg = MOUSE_WHEELUP; pos = MOUSE_WHEELDOWN;
|
neg = MOUSE_WHEELDOWN; pos = MOUSE_WHEELUP;
|
||||||
val = state.lZ;
|
val = state.lZ;
|
||||||
|
//LOG->Trace("MouseWheel polled: %i",val);
|
||||||
|
INPUTFILTER->UpdateMouseWheel(val);
|
||||||
|
|
||||||
float l = SCALE( int(val), -120.0f, 120.0f, 0.0f, 1.0f );
|
/*
|
||||||
ButtonPressed( DeviceInput(dev, neg, max(-l,0), tm) );
|
if( (int)val != 0 )
|
||||||
ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) );
|
{
|
||||||
|
// positive values: WheelUp
|
||||||
|
// negative values: WheelDown
|
||||||
|
float l = SCALE( int(val), -120.0f, 120.0f, -1.0f, 1.0f );
|
||||||
|
ButtonPressed( DeviceInput(dev, neg, max(-l,0), tm) );
|
||||||
|
ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) );
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: LOG->MapLog( "unknown input",
|
default: LOG->MapLog( "unknown input",
|
||||||
@@ -515,10 +524,12 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
|||||||
INPUTFILTER->UpdateCursorLocation((float)cursorPos.x,(float)cursorPos.y);
|
INPUTFILTER->UpdateCursorLocation((float)cursorPos.x,(float)cursorPos.y);
|
||||||
break;
|
break;
|
||||||
case DIMOFS_Z:
|
case DIMOFS_Z:
|
||||||
|
// positive values: WheelUp
|
||||||
|
// negative values: WheelDown
|
||||||
INPUTFILTER->UpdateMouseWheel(l);
|
INPUTFILTER->UpdateMouseWheel(l);
|
||||||
{
|
{
|
||||||
up = MOUSE_WHEELUP; down = MOUSE_WHEELDOWN;
|
up = MOUSE_WHEELUP; down = MOUSE_WHEELDOWN;
|
||||||
l = SCALE( int(evtbuf[i].dwData), -120.0f, 120.0f, 1.0f, -1.0f );
|
l = SCALE( int(evtbuf[i].dwData), -WHEEL_DELTA, WHEEL_DELTA, 1.0f, -1.0f );
|
||||||
DeviceInput diUp = DeviceInput(dev, up, max(-l,0), tm);
|
DeviceInput diUp = DeviceInput(dev, up, max(-l,0), tm);
|
||||||
DeviceInput diDown = DeviceInput(dev, down, max(+l,0), tm);
|
DeviceInput diDown = DeviceInput(dev, down, max(+l,0), tm);
|
||||||
ButtonPressed( diUp );
|
ButtonPressed( diUp );
|
||||||
|
|||||||
Reference in New Issue
Block a user