? Mac/XCode-2.2/build ? Mac/XCode-2.2/OIS.xcodeproj/pieterhoste.mode1v3 ? Mac/XCode-2.2/OIS.xcodeproj/pieterhoste.pbxuser ? src/.DS_Store Index: Mac/XCode-2.2/OIS.xcodeproj/project.pbxproj =================================================================== RCS file: /cvsroot/wgois/ois/Mac/XCode-2.2/OIS.xcodeproj/project.pbxproj,v retrieving revision 1.8.2.3 diff -u -r1.8.2.3 project.pbxproj --- Mac/XCode-2.2/OIS.xcodeproj/project.pbxproj 8 May 2008 20:28:29 -0000 1.8.2.3 +++ Mac/XCode-2.2/OIS.xcodeproj/project.pbxproj 20 Sep 2009 10:02:04 -0000 @@ -99,6 +99,9 @@ 0043D8F80C356840007ACDF6 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0043D8F60C356840007ACDF6 /* Carbon.framework */; }; 0043D8F90C356840007ACDF6 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0043D8F60C356840007ACDF6 /* Carbon.framework */; }; 0082F2890C827BF500E926BE /* OISConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0082F2880C827BF500E926BE /* OISConsole.cpp */; }; + 249631C71066334D00EFD0E1 /* MacJoyStick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 249631C31066333900EFD0E1 /* MacJoyStick.cpp */; }; + 249631C81066335600EFD0E1 /* MacJoyStick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 249631C31066333900EFD0E1 /* MacJoyStick.cpp */; }; + 249631C91066335D00EFD0E1 /* MacJoyStick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 249631C31066333900EFD0E1 /* MacJoyStick.cpp */; }; 4A04E1A80CEF6B6B00E2B94E /* OISFactoryCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A04E1A70CEF6B6B00E2B94E /* OISFactoryCreator.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4A04E1A90CEF6B6B00E2B94E /* OISFactoryCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A04E1A70CEF6B6B00E2B94E /* OISFactoryCreator.h */; }; 4A04E1AA0CEF6B6B00E2B94E /* OISFactoryCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A04E1A70CEF6B6B00E2B94E /* OISFactoryCreator.h */; }; @@ -173,7 +176,7 @@ /* Begin PBXFileReference section */ 0043D85D0C356509007ACDF6 /* OIS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OIS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 0043D85F0C356509007ACDF6 /* OIS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "OIS-Info.plist"; sourceTree = ""; }; + 0043D85F0C356509007ACDF6 /* OIS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "OIS-Info.plist"; sourceTree = ""; }; 0043D8700C35664A007ACDF6 /* OIS.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OIS.h; path = ../../includes/OIS.h; sourceTree = SOURCE_ROOT; }; 0043D8710C35664A007ACDF6 /* OISConfig.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OISConfig.h; path = ../../includes/OISConfig.h; sourceTree = SOURCE_ROOT; }; 0043D8720C35664A007ACDF6 /* OISEffect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OISEffect.h; path = ../../includes/OISEffect.h; sourceTree = SOURCE_ROOT; }; @@ -207,13 +210,14 @@ 0043D8F60C356840007ACDF6 /* Carbon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 0082F04D0C824FE100E926BE /* ConsoleDemo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ConsoleDemo; sourceTree = BUILT_PRODUCTS_DIR; }; 0082F2880C827BF500E926BE /* OISConsole.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = OISConsole.cpp; path = ../../demos/OISConsole.cpp; sourceTree = SOURCE_ROOT; }; + 249631C31066333900EFD0E1 /* MacJoyStick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MacJoyStick.cpp; path = ../../src/mac/MacJoyStick.cpp; sourceTree = SOURCE_ROOT; }; 4A04E1A70CEF6B6B00E2B94E /* OISFactoryCreator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OISFactoryCreator.h; path = ../../includes/OISFactoryCreator.h; sourceTree = SOURCE_ROOT; }; 4AC4C3930CDD840500603F93 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 4ACD7A520CEF903600D72CD9 /* OISException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = OISException.cpp; path = ../../src/OISException.cpp; sourceTree = SOURCE_ROOT; }; 4ADFD2650CDE7322006031E4 /* MacHIDManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MacHIDManager.h; path = ../../includes/mac/MacHIDManager.h; sourceTree = SOURCE_ROOT; }; 4ADFD2A80CDE7BAC006031E4 /* MacHIDManager.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = MacHIDManager.cpp; path = ../../src/mac/MacHIDManager.cpp; sourceTree = SOURCE_ROOT; }; 4AEB08F60D73DA6D007CD406 /* ConsoleTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ConsoleTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 4AEB08F80D73DA6D007CD406 /* ConsoleTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "ConsoleTest-Info.plist"; sourceTree = ""; }; + 4AEB08F80D73DA6D007CD406 /* ConsoleTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ConsoleTest-Info.plist"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -360,6 +364,7 @@ 0043D86D0C3565F7007ACDF6 /* OSX */ = { isa = PBXGroup; children = ( + 249631C31066333900EFD0E1 /* MacJoyStick.cpp */, 0043D89C0C3566C9007ACDF6 /* MacHelpers.cpp */, 4ADFD2A80CDE7BAC006031E4 /* MacHIDManager.cpp */, 0043D89D0C3566C9007ACDF6 /* MacInputManager.cpp */, @@ -606,6 +611,7 @@ 0043D8A20C3566C9007ACDF6 /* MacKeyboard.cpp in Sources */, 0043D8A30C3566C9007ACDF6 /* MacMouse.cpp in Sources */, 4ADFD2A90CDE7BAC006031E4 /* MacHIDManager.cpp in Sources */, + 249631C71066334D00EFD0E1 /* MacJoyStick.cpp in Sources */, 4ACD7A530CEF903600D72CD9 /* OISException.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -625,6 +631,7 @@ 0043D8E90C356819007ACDF6 /* OISKeyboard.cpp in Sources */, 0043D8EA0C356819007ACDF6 /* OISObject.cpp in Sources */, 4ADFD2AA0CDE7BAC006031E4 /* MacHIDManager.cpp in Sources */, + 249631C81066335600EFD0E1 /* MacJoyStick.cpp in Sources */, 4ACD7A540CEF903600D72CD9 /* OISException.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -644,6 +651,7 @@ 0043D8F30C35681A007ACDF6 /* OISKeyboard.cpp in Sources */, 0043D8F40C35681A007ACDF6 /* OISObject.cpp in Sources */, 4ADFD2AB0CDE7BAC006031E4 /* MacHIDManager.cpp in Sources */, + 249631C91066335D00EFD0E1 /* MacJoyStick.cpp in Sources */, 4ACD7A550CEF903600D72CD9 /* OISException.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; Index: src/mac/MacJoyStick.cpp =================================================================== RCS file: /cvsroot/wgois/ois/src/mac/Attic/MacJoyStick.cpp,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 MacJoyStick.cpp --- src/mac/MacJoyStick.cpp 2 Sep 2009 08:01:48 -0000 1.1.2.1 +++ src/mac/MacJoyStick.cpp 20 Sep 2009 10:02:04 -0000 @@ -89,16 +89,25 @@ switch(event.type) { case kIOHIDElementTypeInput_Button: - if(event.value == 0) - mListener->buttonPressed(JoyStickEvent(this, mState), (int)event.elementCookie); - else if(event.value == 1) - mListener->buttonReleased(JoyStickEvent(this, mState), (int)event.elementCookie); + { + std::vector::iterator buttonIt = std::find(mCookies.buttonCookies.begin(), mCookies.buttonCookies.end(), event.elementCookie); + int button = std::distance(mCookies.buttonCookies.begin(), buttonIt); + mState.mButtons[button] = (event.value == 1); + + if(mBuffered && mListener) + { + if(event.value == 0) + mListener->buttonPressed(JoyStickEvent(this, mState), button); + else if(event.value == 1) + mListener->buttonReleased(JoyStickEvent(this, mState), button); + } break; + } case kIOHIDElementTypeInput_Misc: //TODO: It's an axis! - kind of - for gamepads - or should this be a pov? case kIOHIDElementTypeInput_Axis: mState.mAxes[(int)event.elementCookie].abs = event.value; - mListener->axisMoved(JoyStickEvent(this, mState), (int)event.elementCookie); + if(mBuffered && mListener) mListener->axisMoved(JoyStickEvent(this, mState), (int)event.elementCookie); break; }