From 3ed8b14c477a148fed1c7f10c82820ae2bdbfe40 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 23 Feb 2011 20:01:14 -0600 Subject: [PATCH] alright, this may help out some, but there's still no path to INPUTFILTER yet... need to get x and y coordinates --- src/archutils/Darwin/MouseDevice.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/archutils/Darwin/MouseDevice.cpp b/src/archutils/Darwin/MouseDevice.cpp index f987a4e0de..7a00e61522 100644 --- a/src/archutils/Darwin/MouseDevice.cpp +++ b/src/archutils/Darwin/MouseDevice.cpp @@ -90,7 +90,10 @@ void MouseDevice::AddElement( int usagePage, int usage, IOHIDElementCookie cooki void MouseDevice::Open() { - //const Mouse& m = m_Mouse; + const Mouse& m = m_Mouse; +#define ADD(x) if( m.x ) AddElementToQueue( m.x ) + ADD( x_axis ); ADD( y_axis ); ADD( z_axis ); +#undef ADD for( hash_map::const_iterator i = m_Mapping.begin(); i != m_Mapping.end(); ++i ) AddElementToQueue( i->first ); } @@ -98,9 +101,25 @@ void MouseDevice::Open() void MouseDevice::GetButtonPresses( vector& vPresses, IOHIDElementCookie cookie, int value, const RageTimer& now ) const { // todo: add mouse axis stuff -aj - hash_map::const_iterator iter = m_Mapping.find( cookie ); - if( iter != m_Mapping.end() ) - vPresses.push_back( DeviceInput(DEVICE_MOUSE, iter->second, value, now) ); + const Mouse& m = m_Mouse; + if( m.x_axis == cookie ) + { + float level = SCALE( value, m.x_min, m.x_max, -1.0f, 1.0f ); + } + else if( m.y_axis == cookie ) + { + float level = SCALE( value, m.x_min, m.x_max, -1.0f, 1.0f ); + } + else if( m.z_axis == cookie ) + { + float level = SCALE( value, m.z_min, m.z_max, -1.0f, 1.0f ); + } + else + { + hash_map::const_iterator iter = m_Mapping.find( cookie ); + if( iter != m_Mapping.end() ) + vPresses.push_back( DeviceInput(DEVICE_MOUSE, iter->second, value, now) ); + } } void MouseDevice::GetDevicesAndDescriptions( vector& vDevices ) const