From dceebe50052be0b71de3ca2adbfac6a001b0c8e9 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Tue, 29 Mar 2011 18:02:28 -0500 Subject: [PATCH] trying to work on mouse stuff and not getting anywhere --- src/RageInputDevice.h | 15 ++++++------- .../InputHandler/InputHandler_DirectInput.cpp | 21 ++++++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/RageInputDevice.h b/src/RageInputDevice.h index 89084be39d..a81401e6a3 100644 --- a/src/RageInputDevice.h +++ b/src/RageInputDevice.h @@ -315,8 +315,9 @@ public: float level; // Mouse coordinates - unsigned x; - unsigned y; + //unsigned x; + //unsigned y; + int z; // mousewheel /* Whether this button is pressed. This is level with a threshold and * debouncing applied. */ @@ -324,12 +325,12 @@ public: RageTimer ts; - DeviceInput(): device(InputDevice_Invalid), button(DeviceButton_Invalid), level(0), x(0), y(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(): 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), z(0), bDown(l > 0.5f), ts(RageZeroTimer) { } 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) { } - DeviceInput( InputDevice d, DeviceButton b, const RageTimer &t, unsigned xPos=0, unsigned yPos=0 ): - device(d), button(b), level(0), x(xPos), y(yPos), bDown(false), ts(t) { } + device(d), button(b), level(l), z(0), bDown(level > 0.5f), ts(t) { } + DeviceInput( InputDevice d, DeviceButton b, const RageTimer &t, int zVal=0 ): + device(d), button(b), level(0), z(zVal), bDown(false), ts(t) { } bool operator==( const DeviceInput &other ) const { diff --git a/src/arch/InputHandler/InputHandler_DirectInput.cpp b/src/arch/InputHandler/InputHandler_DirectInput.cpp index 6dedbeba21..a0a9316e64 100644 --- a/src/arch/InputHandler/InputHandler_DirectInput.cpp +++ b/src/arch/InputHandler/InputHandler_DirectInput.cpp @@ -413,12 +413,21 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm ) break; case DIMOFS_Z: { - neg = MOUSE_WHEELUP; pos = MOUSE_WHEELDOWN; + neg = MOUSE_WHEELDOWN; pos = MOUSE_WHEELUP; 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) ); - ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) ); + /* + if( (int)val != 0 ) + { + // 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; 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); break; case DIMOFS_Z: + // positive values: WheelUp + // negative values: WheelDown INPUTFILTER->UpdateMouseWheel(l); { 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 diDown = DeviceInput(dev, down, max(+l,0), tm); ButtonPressed( diUp );