Changeset 8284 for code/branches/kicklib2/src/external/ois
- Timestamp:
- Apr 21, 2011, 6:58:23 PM (14 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 33 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
- Property svn:mergeinfo changed
-
code/branches/kicklib2/src/external/ois/CMakeLists.txt
r5929 r8284 31 31 OISKeyboard.h 32 32 OISMouse.h 33 OISMultiTouch.h 33 34 OISObject.h 34 35 OISPrereqs.h 35 36 36 COMPILATION_BEGIN OISCompilation.cpp37 #COMPILATION_BEGIN OISCompilation.cpp 37 38 OISEffect.cpp 38 39 OISException.cpp … … 42 43 OISKeyboard.cpp 43 44 OISObject.cpp 44 COMPILATION_END45 #COMPILATION_END 45 46 ) 46 47 IF(WIN32) … … 52 53 ENDIF() 53 54 54 INCLUDE_DIRECTORIES(.) 55 # Some unexplained hackery for Visual Studio 2005 56 ADD_COMPILER_FLAGS("-D_WIN32_DCOM" MSVC8) 57 58 # MinGW doesn't come with some required Windows headers 59 IF(MINGW) 60 INCLUDE_DIRECTORIES(${WMI_INCLUDE_DIR}) 61 ENDIF() 55 62 56 63 ORXONOX_ADD_LIBRARY(ois_orxonox … … 59 66 "OIS_NONCLIENT_BUILD" 60 67 VERSION 61 1. 268 1.3 62 69 SOURCE_FILES 63 70 ${OIS_FILES} … … 65 72 66 73 IF(WIN32) 67 TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES}) 74 TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES} ${WMI_LIBRARY}) 75 ELSEIF(APPLE) 76 TARGET_LINK_LIBRARIES(ois_orxonox "/System/Library/Frameworks/IOKit.framework" "/System/Library/Frameworks/Carbon.framework") 68 77 ENDIF() -
code/branches/kicklib2/src/external/ois/OIS.h
r5781 r8284 29 29 #include "OISKeyboard.h" 30 30 #include "OISJoyStick.h" 31 #include "OISMultiTouch.h" 31 32 #include "OISInputManager.h" 32 33 #include "OISFactoryCreator.h" -
code/branches/kicklib2/src/external/ois/OISConfig.h
r5781 r8284 70 70 @remarks 71 71 Build in support for Win32 XInput (Xbox 360 Controller) 72 @notes73 Not Yet Implemented74 72 */ 75 73 //#define OIS_WIN32_XINPUT_SUPPORT -
code/branches/kicklib2/src/external/ois/OISInputManager.cpp
r5781 r8284 37 37 #elif defined OIS_APPLE_PLATFORM 38 38 # include "mac/MacInputManager.h" 39 #elif defined OIS_IPHONE_PLATFORM 40 # include "iphone/iPhoneInputManager.h" 39 41 #elif defined OIS_XBOX_PLATFORM 40 42 # include "xbox/XBoxInputManager.h" … … 59 61 m_wiiMoteSupport(0) 60 62 { 63 mFactories.clear(); 64 mFactoryObjects.clear(); 61 65 } 62 66 … … 111 115 #elif defined OIS_APPLE_PLATFORM 112 116 im = new MacInputManager(); 117 #elif defined OIS_IPHONE_PLATFORM 118 im = new iPhoneInputManager(); 113 119 #else 114 120 OIS_EXCEPT(E_General, "No platform library.. check build platform defines!"); -
code/branches/kicklib2/src/external/ois/OISKeyboard.h
r5781 r8284 184 184 { 185 185 public: 186 KeyEvent( Object* obj, KeyCode kc, unsigned int txt) : EventArg(obj), key(kc), text(txt) {}186 KeyEvent(Object* obj, KeyCode kc, unsigned int txt) : EventArg(obj), key(kc), text(txt) {} 187 187 virtual ~KeyEvent() {} 188 188 … … 201 201 public: 202 202 virtual ~KeyListener() {} 203 virtual bool keyPressed( const KeyEvent &arg) = 0;204 virtual bool keyReleased( const KeyEvent &arg) = 0;203 virtual bool keyPressed(const KeyEvent &arg) = 0; 204 virtual bool keyReleased(const KeyEvent &arg) = 0; 205 205 }; 206 206 … … 220 220 A KeyCode to check 221 221 */ 222 virtual bool isKeyDown( KeyCode key) const = 0;222 virtual bool isKeyDown(KeyCode key) const = 0; 223 223 224 224 /** … … 229 229 Send a pointer to a class derived from KeyListener or 0 to clear the callback 230 230 */ 231 virtual void setEventCallback( KeyListener *keyListener) { mListener = keyListener;}231 virtual void setEventCallback(KeyListener *keyListener) { mListener = keyListener;} 232 232 233 233 /** … … 254 254 Off, Unicode, Ascii 255 255 */ 256 virtual void setTextTranslation( TextTranslationMode mode);256 virtual void setTextTranslation(TextTranslationMode mode); 257 257 258 258 /** … … 272 272 The string as determined from the current locale 273 273 */ 274 virtual const std::string& getAsString( KeyCode kc) = 0;274 virtual const std::string& getAsString(KeyCode kc) = 0; 275 275 276 276 //! Enum of bit position of modifer … … 286 286 Check modifier status 287 287 */ 288 bool isModifierDown( Modifier mod) const;288 bool isModifierDown(Modifier mod) const; 289 289 290 290 /** … … 293 293 (in the form of 1 is down and 0 is up) 294 294 */ 295 virtual void copyKeyStates( char keys[256]) const = 0;295 virtual void copyKeyStates(char keys[256]) const = 0; 296 296 297 297 protected: -
code/branches/kicklib2/src/external/ois/OISPrereqs.h
r7163 r8284 79 79 # endif 80 80 #elif defined( __APPLE_CC__ ) // Apple OS X 81 # define OIS_APPLE_PLATFORM 82 # undef _OISExport 83 # define _OISExport __attribute__((visibility("default"))) 81 // Device Simulator 82 # if __IPHONE_OS_VERSION_MIN_REQUIRED >= 20201 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 20000 83 //# if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000 84 # define OIS_IPHONE_PLATFORM 85 # else 86 # define OIS_APPLE_PLATFORM 87 # endif 88 # undef _OISExport 89 # define _OISExport __attribute__((visibility("default"))) 84 90 #else //Probably Linux 85 91 # define OIS_LINUX_PLATFORM … … 95 101 //-------------- Common Classes, Enums, and Typdef's -------------------------// 96 102 #define OIS_VERSION_MAJOR 1 97 #define OIS_VERSION_MINOR 2103 #define OIS_VERSION_MINOR 3 98 104 #define OIS_VERSION_PATCH 0 99 #define OIS_VERSION_NAME " Smash"105 #define OIS_VERSION_NAME "1.3.0" 100 106 101 107 #define OIS_VERSION ((OIS_VERSION_MAJOR << 16) | (OIS_VERSION_MINOR << 8) | OIS_VERSION_PATCH) … … 110 116 class Mouse; 111 117 class JoyStick; 118 class MultiTouch; 112 119 class KeyListener; 113 120 class MouseListener; 121 class MultiTouchListener; 114 122 class JoyStickListener; 115 123 class Interface; … … 130 138 enum Type 131 139 { 132 OISUnknown = 0, 133 OISKeyboard = 1, 134 OISMouse = 2, 135 OISJoyStick = 3, 136 OISTablet = 4 140 OISUnknown = 0, 141 OISKeyboard = 1, 142 OISMouse = 2, 143 OISJoyStick = 3, 144 OISTablet = 4, 145 OISMultiTouch = 5 137 146 }; 138 147 -
code/branches/kicklib2/src/external/ois/ReadMe.txt
r5781 r8284 5 5 The zlib/libpng License 6 6 7 Copyright (c) 2005-20 07Phillip Castaneda (pjcast -- www.wreckedgames.com)7 Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 8 8 9 9 This software is provided 'as-is', without any express or implied warranty. In no … … 46 46 Win32/ 47 47 Contains Visual Studio .Net Solution Files 48 Contains CodeBlocks + MinGW + StlPortproject files for OIS48 Contains CodeBlocks project files for OIS 49 49 50 50 ---- Dependencies ------------------------------------------------------ 51 51 DirectInput 8 52 Ogre & CEGUI 0.4.0 If building CEGUIOgre OIS Demo53 52 54 SDL/55 A test bed for an OIS InputManager with SDL as the backend. Not recommended;56 however, useful for platforms with non-native OIS ports for temporary use.57 53 58 54 Linux/ 59 55 ---- Dependencies ------------------------------------------------------ 60 56 X11 61 Ogre (GLX Platform) & CEGUI 0.4.0 If building CEGUIOgre OIS Demo 62 Newer Linux Kernel (2.6+ ?) for Event API - else, use --disable-joyevents 57 Newer Linux Kernel (2.6+ ?) for Event API 63 58 64 59 Steps to build on Linux: … … 69 64 ---- Configure build options -------------------------------------------- 70 65 ./configure --help --- List all configure options 71 ./configure --disable-ogre --- Disables CEGUIOgre ActionMapping Demo 72 ./configure --disable-joyevents --- Uses /dev/input/jsX instead of 73 /dev/input/eventX 66 74 67 75 68 LinuxCB/ … … 80 73 81 74 Mac/ 82 83 XCode-1.5/84 Non-complete native OIS port.85 86 75 XCode-2.2/ 87 Working, complete, OIS port to OSX using SDL as a backend.76 Working, mostly complete OSX vackend. -
code/branches/kicklib2/src/external/ois/VERSION
r5781 r8284 1 OIS v1_2 CVS updated on 2009/01/24 2 Note that this is not CVS HEAD, but v1_2 branch! 3 1 OIS SVN v1.3 branch updated on 2011/02/20 (revision 32) 2 https://wgois.svn.sourceforge.net/svnroot/wgois/ois/branches/v1-3/ -
code/branches/kicklib2/src/external/ois/changes_orxonox.diff
r7163 r8284 10 10 //Ignorable Dll interface warning... 11 11 # if !defined(OIS_MINGW_COMPILER) 12 13 12 14 --- linux/EventHelpers.cpp (revision 5668) 13 15 +++ linux/EventHelpers.cpp (working copy) … … 37 39 +++ win32/Win32ForceFeedback.cpp 38 40 @@ -25,7 +25,7 @@ 39 #include < Math.h>41 #include <math.h> 40 42 41 43 // 0 = No trace; 1 = Important traces; 2 = Debug traces … … 45 47 #if (defined (_DEBUG) || defined(OIS_WIN32_JOYFF_DEBUG)) 46 48 #include <iostream> 49 50 51 --- win32/Win32JoyStick.cpp 52 +++ win32/Win32JoyStick.cpp 53 @@ -26,6 +26,14 @@ 54 #include "OISEvents.h" 55 #include "OISException.h" 56 57 +// (Orxonox): Required for MinGW to compile properly 58 +#ifdef __MINGW32__ 59 +# include <oaidl.h> 60 +# ifndef __MINGW_EXTENSION 61 +# define __MINGW_EXTENSION __extension__ 62 +# endif 63 +#endif 64 + 65 #include <cassert> 66 #include <wbemidl.h> 67 #include <oleauto.h> 68 @@ -39,6 +47,11 @@ 69 } 70 #endif 71 72 +// (Orxonox): MinGW doesn't have swscanf_s 73 +#ifdef __MINGW32__ 74 +# define swscanf_s swscanf 75 +#endif 76 + 77 #ifdef OIS_WIN32_XINPUT_SUPPORT 78 # pragma comment(lib, "xinput.lib") 79 #endif 80 @@ -583,7 +596,12 @@ 81 bool bCleanupCOM = SUCCEEDED(hr); 82 83 // Create WMI 84 + // (Orxonox): Fix for MinGW 85 +#ifdef __MINGW32__ 86 + hr = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID*)&pIWbemLocator); 87 +#else 88 hr = CoCreateInstance(__uuidof(WbemLocator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID*)&pIWbemLocator); 89 +#endif 90 if( FAILED(hr) || pIWbemLocator == NULL ) 91 goto LCleanup; 92 93 94 --- mac/MacHIDManager.cpp 95 +++ mac/MacHIDManager.cpp 96 @@ -406,6 +406,7 @@ 97 switch(iType) 98 { 99 case OISJoyStick: 100 + { 101 int totalDevs = totalDevices(iType); 102 int freeDevs = freeDevices(iType); 103 int devID = totalDevs - freeDevs; 104 @@ -413,6 +414,7 @@ 105 obj = new MacJoyStick((*it)->combinedKey, bufferMode, *it, creator, devID); 106 (*it)->inUse = true; 107 return obj; 108 + } 109 case OISTablet: 110 //Create MacTablet 111 break; -
code/branches/kicklib2/src/external/ois/linux/LinuxInputManager.cpp
r5781 r8284 40 40 hideMouse = true; 41 41 mGrabs = true; 42 useXRepeat = false;43 42 keyboardUsed = mouseUsed = false; 44 43 … … 74 73 75 74 //--------- Keyboard Settings ------------// 76 i = paramList.find("XAutoRepeatOn");77 if( i != paramList.end() )78 if( i->second == "true" )79 useXRepeat = true;80 81 75 i = paramList.find("x11_keyboard_grab"); 82 76 if( i != paramList.end() ) … … 172 166 { 173 167 if( keyboardUsed == false ) 174 obj = new LinuxKeyboard(this, bufferMode, grabKeyboard , useXRepeat);168 obj = new LinuxKeyboard(this, bufferMode, grabKeyboard); 175 169 break; 176 170 } -
code/branches/kicklib2/src/external/ois/linux/LinuxInputManager.h
r5781 r8284 101 101 bool mGrabs; 102 102 bool hideMouse; 103 104 //! By default, keyboard disables XRepeatRate105 bool useXRepeat;106 103 }; 107 104 } -
code/branches/kicklib2/src/external/ois/linux/LinuxJoyStickEvents.cpp
r5781 r8284 96 96 //We are in non blocking mode - we just read once, and try to fill up buffer 97 97 input_event js[JOY_BUFFERSIZE]; 98 int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE); 99 if( ret <= 0 ) 100 return; 101 102 //Determine how many whole events re read up 103 ret /= sizeof(struct input_event); 104 for(int i = 0; i < ret; ++i) 98 while(true) 105 99 { 106 switch(js[i].type) 100 int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE); 101 if( ret < 0 ) 102 break; 103 104 //Determine how many whole events re read up 105 ret /= sizeof(struct input_event); 106 for(int i = 0; i < ret; ++i) 107 107 { 108 case EV_KEY: //Button 109 { 110 int button = mButtonMap[js[i].code]; 111 112 #ifdef OIS_LINUX_JOY_DEBUG 113 cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl; 114 #endif 115 116 //Check to see whether push or released event... 117 if(js[i].value) 118 { 119 mState.mButtons[button] = true; 120 if( mBuffered && mListener ) 121 if(!mListener->buttonPressed(JoyStickEvent(this,mState), button)) return; 122 } 123 else 124 { 125 mState.mButtons[button] = false; 126 if( mBuffered && mListener ) 127 if(!mListener->buttonReleased(JoyStickEvent(this,mState), button)) return; 128 } 129 break; 130 } 131 132 case EV_ABS: //Absolute Axis 133 { 134 //A Stick (BrakeDefine is the highest possible Axis) 135 if( js[i].code <= ABS_BRAKE ) 136 { 137 int axis = mAxisMap[js[i].code]; 138 assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" ); 139 140 axisMoved[axis] = true; 141 142 //check for rescaling: 143 if( mRanges[axis].min == JoyStick::MIN_AXIS && mRanges[axis].max != JoyStick::MAX_AXIS ) 144 { //Scale is perfect 145 mState.mAxes[axis].abs = js[i].value; 108 switch(js[i].type) 109 { 110 case EV_KEY: //Button 111 { 112 int button = mButtonMap[js[i].code]; 113 114 #ifdef OIS_LINUX_JOY_DEBUG 115 cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl; 116 #endif 117 118 //Check to see whether push or released event... 119 if(js[i].value) 120 { 121 mState.mButtons[button] = true; 122 if( mBuffered && mListener ) 123 if(!mListener->buttonPressed(JoyStickEvent(this,mState), button)) return; 146 124 } 147 125 else 148 { //Rescale 149 float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max); 150 mState.mAxes[axis].abs = (int)(32767.0f - (65535.0f * proportion)); 126 { 127 mState.mButtons[button] = false; 128 if( mBuffered && mListener ) 129 if(!mListener->buttonReleased(JoyStickEvent(this,mState), button)) return; 151 130 } 152 } 153 else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed 154 { 155 //Normalise the POV to between 0-7 156 //Even is X Axis, Odd is Y Axis 157 unsigned char LinuxPovNumber = js[i].code - 16; 158 short OIS_POVIndex = POV_MASK[LinuxPovNumber]; 159 160 //Handle X Axis first (Even) (left right) 161 if((LinuxPovNumber & 0x0001) == 0) 131 break; 132 } 133 134 case EV_ABS: //Absolute Axis 135 { 136 //A Stick (BrakeDefine is the highest possible Axis) 137 if( js[i].code <= ABS_BRAKE ) 162 138 { 163 //Why do this? Because, we use a bit field, and when this axis is east, 164 //it can't possibly be west too. So clear out the two X axes, then refil 165 //it in with the new direction bit. 166 //Clear the East/West Bit Flags first 167 mState.mPOV[OIS_POVIndex].direction &= 0x11110011; 168 if( js[i].value == -1 ) //Left 169 mState.mPOV[OIS_POVIndex].direction |= Pov::West; 170 else if( js[i].value == 1 ) //Right 171 mState.mPOV[OIS_POVIndex].direction |= Pov::East; 139 int axis = mAxisMap[js[i].code]; 140 assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" ); 141 142 axisMoved[axis] = true; 143 144 //check for rescaling: 145 if( mRanges[axis].min == JoyStick::MIN_AXIS && mRanges[axis].max != JoyStick::MAX_AXIS ) 146 { //Scale is perfect 147 mState.mAxes[axis].abs = js[i].value; 148 } 149 else 150 { //Rescale 151 float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max); 152 mState.mAxes[axis].abs = (int)(32767.0f - (65535.0f * proportion)); 153 } 172 154 } 173 //Handle Y Axis (Odd) (up down) 174 else 155 else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed 175 156 { 176 //Clear the North/South Bit Flags first 177 mState.mPOV[OIS_POVIndex].direction &= 0x11111100; 178 if( js[i].value == -1 ) //Up 179 mState.mPOV[OIS_POVIndex].direction |= Pov::North; 180 else if( js[i].value == 1 ) //Down 181 mState.mPOV[OIS_POVIndex].direction |= Pov::South; 157 //Normalise the POV to between 0-7 158 //Even is X Axis, Odd is Y Axis 159 unsigned char LinuxPovNumber = js[i].code - 16; 160 short OIS_POVIndex = POV_MASK[LinuxPovNumber]; 161 162 //Handle X Axis first (Even) (left right) 163 if((LinuxPovNumber & 0x0001) == 0) 164 { 165 //Why do this? Because, we use a bit field, and when this axis is east, 166 //it can't possibly be west too. So clear out the two X axes, then refil 167 //it in with the new direction bit. 168 //Clear the East/West Bit Flags first 169 mState.mPOV[OIS_POVIndex].direction &= 0x11110011; 170 if( js[i].value == -1 ) //Left 171 mState.mPOV[OIS_POVIndex].direction |= Pov::West; 172 else if( js[i].value == 1 ) //Right 173 mState.mPOV[OIS_POVIndex].direction |= Pov::East; 174 } 175 //Handle Y Axis (Odd) (up down) 176 else 177 { 178 //Clear the North/South Bit Flags first 179 mState.mPOV[OIS_POVIndex].direction &= 0x11111100; 180 if( js[i].value == -1 ) //Up 181 mState.mPOV[OIS_POVIndex].direction |= Pov::North; 182 else if( js[i].value == 1 ) //Down 183 mState.mPOV[OIS_POVIndex].direction |= Pov::South; 184 } 185 186 if( mBuffered && mListener ) 187 if( mListener->povMoved( JoyStickEvent(this,mState), OIS_POVIndex) == false ) 188 return; 182 189 } 183 184 if( mBuffered && mListener ) 185 if( mListener->povMoved( JoyStickEvent(this,mState), OIS_POVIndex) == false ) 186 return; 187 } 188 break; 189 } 190 191 192 case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?) 193 #ifdef OIS_LINUX_JOY_DEBUG 194 cout << "\nWarning: Relatives axes not supported yet" << endl; 195 #endif 196 break; 197 default: break; 190 break; 191 } 192 193 194 case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?) 195 #ifdef OIS_LINUX_JOY_DEBUG 196 cout << "\nWarning: Relatives axes not supported yet" << endl; 197 #endif 198 break; 199 default: break; 200 } 198 201 } 199 202 } -
code/branches/kicklib2/src/external/ois/linux/LinuxKeyboard.cpp
r5781 r8284 33 33 #include <iostream> 34 34 //-------------------------------------------------------------------// 35 LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab , bool useXRepeat)35 LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab) 36 36 : Keyboard(creator->inputSystemName(), buffered, 0, creator) 37 37 { … … 43 43 grabKeyboard = grab; 44 44 keyFocusLost = false; 45 46 xAutoRepeat = useXRepeat;47 oldXAutoRepeat = false;48 45 49 46 //X Key Map to KeyCode … … 213 210 214 211 keyFocusLost = false; 215 216 if( xAutoRepeat == false )217 {218 //We do not want to blindly turn on autorepeat later when quiting if219 //it was not on to begin with.. So, let us check and see first220 XKeyboardState old;221 XGetKeyboardControl( display, &old );222 oldXAutoRepeat = false;223 224 if( old.global_auto_repeat == AutoRepeatModeOn )225 oldXAutoRepeat = true;226 227 XAutoRepeatOff( display );228 }229 212 } 230 213 … … 234 217 if( display ) 235 218 { 236 if( oldXAutoRepeat )237 XAutoRepeatOn(display);238 239 219 if( grabKeyboard ) 240 220 XUngrabKeyboard(display, CurrentTime); … … 303 283 304 284 while( XPending(display) > 0 ) 305 { XNextEvent(display, &event); if( KeyPress == event.type ) 285 { 286 XNextEvent(display, &event); 287 288 if(KeyPress == event.type) 306 289 { 307 290 unsigned int character = 0; 308 291 309 if( mTextMode != Off)292 if(mTextMode != Off) 310 293 { 311 294 unsigned char buffer[6] = {0,0,0,0,0,0}; … … 332 315 if( event.xkey.state & Mod1Mask && key == XK_Tab ) 333 316 linMan->_setGrabState(false); 334 } else if( KeyRelease == event.type ) 317 } 318 else if(KeyRelease == event.type) 335 319 { 336 //Mask out the modifier states X sets.. or we will get improper values 337 event.xkey.state &= ~ShiftMask; 338 event.xkey.state &= ~LockMask; 339 340 //Else, it is a valid key release 341 XLookupString(&event.xkey,NULL,0,&key,NULL); 342 _injectKeyUp(key); } 320 if(!_isKeyRepeat(event)) 321 { 322 //Mask out the modifier states X sets.. or we will get improper values 323 event.xkey.state &= ~ShiftMask; 324 event.xkey.state &= ~LockMask; 325 326 XLookupString(&event.xkey,NULL,0,&key,NULL); 327 _injectKeyUp(key); 328 } 329 } 343 330 } 344 331 -
code/branches/kicklib2/src/external/ois/linux/LinuxKeyboard.h
r5781 r8284 34 34 { 35 35 public: 36 LinuxKeyboard(InputManager* creator, bool buffered, bool grab , bool useXRepeat);36 LinuxKeyboard(InputManager* creator, bool buffered, bool grab); 37 37 virtual ~LinuxKeyboard(); 38 38 … … 59 59 60 60 protected: 61 inline bool _isKeyRepeat(XEvent &event) 62 { 63 //When a key is repeated, there will be two events: released, followed by another immediate pressed. So check to see if another pressed is present 64 if(!XPending(display)) 65 return false; 66 67 XEvent e; 68 XPeekEvent(display, &e); 69 if(e.type == KeyPress && e.xkey.keycode == event.xkey.keycode && (e.xkey.time - event.xkey.time) < 2) 70 { 71 XNextEvent(display, &e); 72 return true; 73 } 74 75 return false; 76 } 77 61 78 bool _injectKeyDown( KeySym key, int text ); 62 79 bool _injectKeyUp( KeySym key ); … … 75 92 bool keyFocusLost; 76 93 77 bool xAutoRepeat;78 bool oldXAutoRepeat;79 80 94 std::string mGetString; 81 95 }; -
code/branches/kicklib2/src/external/ois/linux/LinuxMouse.cpp
r5781 r8284 173 173 174 174 //Compute this frames Relative X & Y motion 175 mState.X.rel= event.xmotion.x - oldXMouseX;176 mState.Y.rel= event.xmotion.y - oldXMouseY;175 int dx = event.xmotion.x - oldXMouseX; 176 int dy = event.xmotion.y - oldXMouseY; 177 177 178 178 //Store old values for next time to compute relative motion … … 180 180 oldXMouseY = event.xmotion.y; 181 181 182 mState.X.abs += mState.X.rel; 183 mState.Y.abs += mState.Y.rel; 182 mState.X.abs += dx; 183 mState.Y.abs += dy; 184 mState.X.rel += dx; 185 mState.Y.rel += dy; 184 186 185 187 //Check to see if we are grabbing the mouse to the window (requires clipping and warping) -
code/branches/kicklib2/src/external/ois/linux/LinuxPrereqs.h
r5781 r8284 32 32 33 33 //! Max number of elements to collect from buffered input 34 #define JOY_BUFFERSIZE 1034 #define JOY_BUFFERSIZE 64 35 35 36 36 namespace OIS -
code/branches/kicklib2/src/external/ois/mac/CMakeLists.txt
r5929 r8284 3 3 MacHIDManager.h 4 4 MacInputManager.h 5 MacJoyStick.h 5 6 MacKeyboard.h 6 7 MacMouse.h 7 8 MacPrereqs.h 8 9 9 COMPILATION_BEGIN OISMacCompilation.cpp10 #COMPILATION_BEGIN OISMacCompilation.cpp 10 11 MacHelpers.cpp 11 12 MacHIDManager.cpp 12 13 MacInputManager.cpp 14 MacJoyStick.cpp 13 15 MacKeyboard.cpp 14 16 MacMouse.cpp 15 COMPILATION_END17 #COMPILATION_END 16 18 ) -
code/branches/kicklib2/src/external/ois/mac/MacHIDManager.cpp
r5781 r8284 20 20 21 21 3. This notice may not be removed or altered from any source distribution. 22 */22 */ 23 23 #include "mac/MacHIDManager.h" 24 #include "mac/MacJoyStick.h" 24 25 #include "OISException.h" 25 26 #include "OISObject.h" … … 42 43 { 43 44 CFTypeRef temp = CFDictionaryGetValue(dict, OIS_CFString(keyName)); 44 45 45 46 if(temp && CFGetTypeID(temp) == CFArrayGetTypeID()) 46 47 return (CFArrayRef)temp; … … 53 54 { 54 55 CFTypeRef temp = CFDictionaryGetValue(dict, OIS_CFString(keyName)); 55 56 56 57 if(temp && CFGetTypeID(temp) == CFStringGetTypeID()) 57 58 return (CFStringRef)temp; … … 64 65 { 65 66 CFTypeRef temp = CFDictionaryGetValue(dict, OIS_CFString(keyName)); 66 67 67 68 if(temp && CFGetTypeID(temp) == CFNumberGetTypeID()) 68 69 return (CFNumberRef)temp; … … 83 84 { 84 85 CFTypeRef temp = CFArrayGetValueAtIndex(array, idx); 85 86 86 87 if(temp && CFGetTypeID(temp) == CFDictionaryGetTypeID()) 87 88 return (CFDictionaryRef)temp; … … 93 94 int getInt32(CFNumberRef ref) 94 95 { 95 96 97 98 96 int r = 0; 97 if (r) 98 CFNumberGetValue(ref, kCFNumberIntType, &r); 99 return r; 99 100 } 100 101 … … 111 112 //------------------------------------------------------------------------------------------------------// 112 113 void MacHIDManager::initialize() 114 { 115 //Make the search more specific by adding usage flags 116 int usage = kHIDUsage_GD_Joystick; 117 int page = kHIDPage_GenericDesktop; 118 119 io_iterator_t iterator = lookUpDevices(usage, page); 120 121 if(iterator) 122 iterateAndOpenDevices(iterator); 123 124 //Doesn't support multiple usage flags, iterate twice 125 usage = kHIDUsage_GD_GamePad; 126 iterator = lookUpDevices(usage, page); 127 128 if(iterator) 129 iterateAndOpenDevices(iterator); 130 } 131 132 //------------------------------------------------------------------------------------------------------// 133 io_iterator_t MacHIDManager::lookUpDevices(int usage, int page) 113 134 { 114 135 CFMutableDictionaryRef deviceLookupMap = IOServiceMatching(kIOHIDDeviceKey); 115 136 if(!deviceLookupMap) 116 137 OIS_EXCEPT(E_General, "Could not setup HID device search parameters"); 117 118 //Make the search more specific by adding usage flags 119 int usage = kHIDUsage_GD_GamePad | kHIDUsage_GD_Joystick, 120 page = kHIDPage_GenericDesktop; 121 122 CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage), 123 pageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); 124 138 139 CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); 140 CFNumberRef pageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); 141 125 142 CFDictionarySetValue(deviceLookupMap, CFSTR(kIOHIDPrimaryUsageKey), usageRef); 126 143 CFDictionarySetValue(deviceLookupMap, CFSTR(kIOHIDPrimaryUsagePageKey), pageRef); 127 144 128 145 //IOServiceGetMatchingServices consumes the map so we do not have to release it ourself 129 146 io_iterator_t iterator = 0; 130 147 IOReturn result = IOServiceGetMatchingServices(kIOMasterPortDefault, deviceLookupMap, &iterator); 131 if (result == kIOReturnSuccess && iterator) 132 { 133 io_object_t hidDevice = 0; 134 while ((hidDevice = IOIteratorNext(iterator)) !=0) 148 149 CFRelease(usageRef); 150 CFRelease(pageRef); 151 152 if(result == kIOReturnSuccess) 153 { 154 return iterator; 155 } 156 //TODO: Throw exception instead? 157 else 158 { 159 return 0; 160 } 161 } 162 163 //------------------------------------------------------------------------------------------------------// 164 void MacHIDManager::iterateAndOpenDevices(io_iterator_t iterator) 165 { 166 io_object_t hidDevice = 0; 167 while ((hidDevice = IOIteratorNext(iterator)) !=0) 168 { 169 //Get the current registry items property map 170 CFMutableDictionaryRef propertyMap = 0; 171 if (IORegistryEntryCreateCFProperties(hidDevice, &propertyMap, kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS && propertyMap) 135 172 { 136 //Get the current registry items property map 137 CFMutableDictionaryRef propertyMap = 0; 138 if (IORegistryEntryCreateCFProperties(hidDevice, &propertyMap, kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS && propertyMap) 173 //Go through device to find all needed info 174 HidInfo* hid = enumerateDeviceProperties(propertyMap); 175 176 if(hid) 139 177 { 140 //Go through device to find all needed info141 HidInfo* hid = enumerateDeviceProperties(propertyMap);142 if(hid)143 mDeviceList.push_back(hid);144 145 178 //todo - we need to hold an open interface so we do not have to enumerate again later 146 179 //should be able to watch for device removals also 147 148 /// Testing opening / closing interface 149 //IOCFPlugInInterface **pluginInterface = NULL; 150 //SInt32 score = 0; 151 //if (IOCreatePlugInInterfaceForService(hidDevice, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInterface, &score) == kIOReturnSuccess) 152 //{ 153 // IOHIDDeviceInterface **interface; 154 // HRESULT pluginResult = (*pluginInterface)->QueryInterface(pluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void **)&(interface)); 155 // if(pluginResult == S_OK) 156 // cout << "Successfully created plugin interface for device\n"; 157 // else 158 // cout << "Not able to create plugin interface\n"; 159 160 // IODestroyPlugInInterface(pluginInterface); 161 162 // if ((*interface)->open(interface, 0) == KERN_SUCCESS) 163 // cout << "Opened interface.\n"; 164 // else 165 // cout << "Failed to open\n"; 166 167 // (*interface)->close(interface); 168 //} 169 // 180 181 // Testing opening / closing interface 182 IOCFPlugInInterface **pluginInterface = NULL; 183 SInt32 score = 0; 184 if (IOCreatePlugInInterfaceForService(hidDevice, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInterface, &score) == kIOReturnSuccess) 185 { 186 IOHIDDeviceInterface **interface; 187 188 HRESULT pluginResult = (*pluginInterface)->QueryInterface(pluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void **)&(interface)); 189 190 if(pluginResult != S_OK) 191 OIS_EXCEPT(E_General, "Not able to create plugin interface"); 192 193 IODestroyPlugInInterface(pluginInterface); 194 195 hid->interface = interface; 196 197 //Check for duplicates - some devices have multiple usage 198 if(std::find(mDeviceList.begin(), mDeviceList.end(), hid) == mDeviceList.end()) 199 mDeviceList.push_back(hid); 200 } 170 201 } 171 202 } 172 173 IOObjectRelease(iterator); 174 } 175 176 CFRelease(usageRef); 177 CFRelease(pageRef); 203 } 204 205 IOObjectRelease(iterator); 178 206 } 179 207 … … 188 216 if (str) 189 217 info->vendor = CFStringGetCStringPtr(str, CFStringGetSystemEncoding()); 190 218 191 219 str = getDictionaryItemAsRef<CFStringRef>(propertyMap, kIOHIDProductKey); 192 220 if (str) 193 221 info->productKey = CFStringGetCStringPtr(str, CFStringGetSystemEncoding()); 194 222 195 223 info->combinedKey = info->vendor + " " + info->productKey; 196 224 197 225 //Go through all items in this device (i.e. buttons, hats, sticks, axes, etc) 198 226 CFArrayRef array = getDictionaryItemAsRef<CFArrayRef>(propertyMap, kIOHIDElementKey); … … 200 228 for (int i = 0; i < CFArrayGetCount(array); i++) 201 229 parseDeviceProperties(getArrayItemAsRef<CFDictionaryRef>(array, i)); 202 230 203 231 return info; 204 232 } … … 209 237 if(!properties) 210 238 return; 211 239 212 240 CFArrayRef array = getDictionaryItemAsRef<CFArrayRef>(properties, kIOHIDElementKey); 213 241 if (array) … … 227 255 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsagePageKey))) 228 256 { 229 case kHIDPage_GenericDesktop:230 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey)))257 case kHIDPage_GenericDesktop: 258 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey))) 231 259 { 232 case kHIDUsage_GD_Pointer: 233 cout << "\tkHIDUsage_GD_Pointer\n"; 234 parseDevicePropertiesGroup(element); 260 case kHIDUsage_GD_Pointer: 261 cout << "\tkHIDUsage_GD_Pointer\n"; 262 parseDevicePropertiesGroup(element); 263 break; 264 case kHIDUsage_GD_X: 265 case kHIDUsage_GD_Y: 266 case kHIDUsage_GD_Z: 267 case kHIDUsage_GD_Rx: 268 case kHIDUsage_GD_Ry: 269 case kHIDUsage_GD_Rz: 270 cout << "\tAxis\n"; 271 break; 272 case kHIDUsage_GD_Slider: 273 case kHIDUsage_GD_Dial: 274 case kHIDUsage_GD_Wheel: 275 cout << "\tUnsupported kHIDUsage_GD_Wheel\n"; 276 break; 277 case kHIDUsage_GD_Hatswitch: 278 cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n"; 279 break; 280 } 235 281 break; 236 case kHIDUsage_GD_X: 237 case kHIDUsage_GD_Y: 238 case kHIDUsage_GD_Z: 239 case kHIDUsage_GD_Rx: 240 case kHIDUsage_GD_Ry: 241 case kHIDUsage_GD_Rz: 242 cout << "\tAxis\n"; 282 case kHIDPage_Button: 283 cout << "\tkHIDPage_Button\n"; 243 284 break; 244 case kHIDUsage_GD_Slider:245 case kHIDUsage_GD_Dial:246 case kHIDUsage_GD_Wheel:247 cout << "\tUnsupported kHIDUsage_GD_Wheel\n";248 break;249 case kHIDUsage_GD_Hatswitch:250 cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n";251 break;252 }253 break;254 case kHIDPage_Button:255 cout << "\tkHIDPage_Button\n";256 break;257 285 } 258 286 } … … 267 295 if(!properties) 268 296 return; 269 297 270 298 CFArrayRef array = getDictionaryItemAsRef<CFArrayRef>(properties, kIOHIDElementKey); 271 299 if(array) … … 278 306 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsagePageKey))) 279 307 { 280 case kHIDPage_GenericDesktop:281 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey)))308 case kHIDPage_GenericDesktop: 309 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey))) 282 310 { 283 case kHIDUsage_GD_X: 284 case kHIDUsage_GD_Y: 285 case kHIDUsage_GD_Z: 286 case kHIDUsage_GD_Rx: 287 case kHIDUsage_GD_Ry: 288 case kHIDUsage_GD_Rz: 289 cout << "\t\tAxis\n"; 311 case kHIDUsage_GD_X: 312 case kHIDUsage_GD_Y: 313 case kHIDUsage_GD_Z: 314 case kHIDUsage_GD_Rx: 315 case kHIDUsage_GD_Ry: 316 case kHIDUsage_GD_Rz: 317 cout << "\t\tAxis\n"; 318 break; 319 case kHIDUsage_GD_Slider: 320 case kHIDUsage_GD_Dial: 321 case kHIDUsage_GD_Wheel: 322 cout << "\tUnsupported - kHIDUsage_GD_Wheel\n"; 323 break; 324 case kHIDUsage_GD_Hatswitch: 325 cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n"; 326 break; 327 } 290 328 break; 291 case kHIDUsage_GD_Slider: 292 case kHIDUsage_GD_Dial: 293 case kHIDUsage_GD_Wheel: 294 cout << "\tUnsupported - kHIDUsage_GD_Wheel\n"; 329 case kHIDPage_Button: 295 330 break; 296 case kHIDUsage_GD_Hatswitch:297 cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n";298 break;299 }300 break;301 case kHIDPage_Button:302 break;303 331 } 304 332 } … … 317 345 ret.insert(std::make_pair((*it)->type, (*it)->combinedKey)); 318 346 } 319 347 320 348 return ret; 321 349 } … … 326 354 int ret = 0; 327 355 HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end(); 328 356 329 357 for(; it != end; ++it) 330 358 { … … 341 369 int ret = 0; 342 370 HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end(); 343 371 344 372 for(; it != end; ++it) 345 373 { … … 347 375 ret++; 348 376 } 349 377 350 378 return ret; 351 379 } … … 355 383 { 356 384 HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end(); 357 385 358 386 for(; it != end; ++it) 359 387 { … … 367 395 //--------------------------------------------------------------------------------// 368 396 Object* MacHIDManager::createObject(InputManager* creator, Type iType, bool bufferMode, 369 397 const std::string & vendor) 370 398 { 371 399 Object *obj = 0; 372 400 373 401 HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end(); 374 402 for(; it != end; ++it) … … 376 404 if((*it)->inUse == false && (*it)->type == iType && (vendor == "" || (*it)->combinedKey == vendor)) 377 405 { 378 //create device 406 switch(iType) 407 { 408 case OISJoyStick: 409 { 410 int totalDevs = totalDevices(iType); 411 int freeDevs = freeDevices(iType); 412 int devID = totalDevs - freeDevs; 413 414 obj = new MacJoyStick((*it)->combinedKey, bufferMode, *it, creator, devID); 415 (*it)->inUse = true; 416 return obj; 417 } 418 case OISTablet: 419 //Create MacTablet 420 break; 421 default: 422 break; 423 } 379 424 } 380 425 } 381 382 if( obj == 0 ) 383 OIS_EXCEPT(E_InputDeviceNonExistant, "No devices match requested type."); 384 426 385 427 return obj; 386 428 } -
code/branches/kicklib2/src/external/ois/mac/MacHIDManager.h
r5781 r8284 70 70 71 71 void initialize(); 72 73 void iterateAndOpenDevices(io_iterator_t iterator); 74 io_iterator_t lookUpDevices(int usage, int page); 72 75 73 76 //FactoryCreator Overrides -
code/branches/kicklib2/src/external/ois/mac/MacInputManager.cpp
r5781 r8284 188 188 } 189 189 default: 190 { 191 obj = mHIDManager->createObject(creator, iType, bufferMode, vendor); 190 192 break; 193 } 191 194 } 192 195 -
code/branches/kicklib2/src/external/ois/mac/MacKeyboard.cpp
r5781 r8284 199 199 char macChar; 200 200 201 // TODO clean this up202 201 if (mTextMode == Unicode) 203 202 { 204 203 //get string size 205 204 UInt32 stringsize; 206 //status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, 0, &stringsize, NULL);207 //status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, sizeof(UniChar)*10, NULL, &text );208 205 status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, sizeof(UniChar) * 10, &stringsize, &text ); 209 std::cout << "String length: " << stringsize << std::endl;210 211 //wstring unitext;212 //for (int i=0;i<10;i++) unitext += (wchar_t)text[i];213 //wcout << "Unicode out: " << unitext << endl;214 206 215 207 if(stringsize > 0) -
code/branches/kicklib2/src/external/ois/win32/Win32ForceFeedback.cpp
r5929 r8284 21 21 3. This notice may not be removed or altered from any source distribution. 22 22 */ 23 #include " Win32/Win32ForceFeedback.h"23 #include "win32/Win32ForceFeedback.h" 24 24 #include "OISException.h" 25 #include < Math.h>25 #include <math.h> 26 26 27 27 // 0 = No trace; 1 = Important traces; 2 = Debug traces -
code/branches/kicklib2/src/external/ois/win32/Win32ForceFeedback.h
r5781 r8284 26 26 #include "OISPrereqs.h" 27 27 #include "OISForceFeedback.h" 28 #include " Win32/Win32Prereqs.h"28 #include "win32/Win32Prereqs.h" 29 29 30 30 namespace OIS -
code/branches/kicklib2/src/external/ois/win32/Win32InputManager.cpp
r5781 r8284 21 21 3. This notice may not be removed or altered from any source distribution. 22 22 */ 23 #include " Win32/Win32InputManager.h"24 #include " Win32/Win32Keyboard.h"25 #include " Win32/Win32Mouse.h"26 #include " Win32/Win32JoyStick.h"23 #include "win32/Win32InputManager.h" 24 #include "win32/Win32KeyBoard.h" 25 #include "win32/Win32Mouse.h" 26 #include "win32/Win32JoyStick.h" 27 27 #include "OISException.h" 28 28 … … 75 75 hInst = GetModuleHandle(0); 76 76 77 //Create the input system77 //Create the device 78 78 hr = DirectInput8Create( hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&mDirectInput, NULL ); 79 79 if (FAILED(hr)) … … 118 118 { 119 119 //Enumerate all attached devices 120 mDirectInput->EnumDevices(NULL , _DIEnumDevCallback, this, DIEDFL_ATTACHEDONLY); 120 mDirectInput->EnumDevices(NULL, _DIEnumDevCallback, this, DIEDFL_ATTACHEDONLY); 121 122 #ifdef OIS_WIN32_XINPUT_SUPPORT 123 //let's check how many possible XInput devices we may have (max 4)... 124 for(int i = 0; i < 3; ++i) 125 { 126 XINPUT_STATE state; 127 if(XInputGetState(i, &state) != ERROR_DEVICE_NOT_CONNECTED) 128 { //Once we found 1, just check our whole list against devices 129 Win32JoyStick::CheckXInputDevices(unusedJoyStickList); 130 break; 131 } 132 } 133 #endif 121 134 } 122 135 … … 134 147 { 135 148 JoyStickInfo jsInfo; 149 jsInfo.isXInput = false; 150 jsInfo.productGuid = lpddi->guidProduct; 136 151 jsInfo.deviceID = lpddi->guidInstance; 137 152 jsInfo.vendor = lpddi->tszInstanceName; -
code/branches/kicklib2/src/external/ois/win32/Win32InputManager.h
r5781 r8284 26 26 #include "OISInputManager.h" 27 27 #include "OISFactoryCreator.h" 28 #include " Win32/Win32Prereqs.h"28 #include "win32/Win32Prereqs.h" 29 29 30 30 namespace OIS -
code/branches/kicklib2/src/external/ois/win32/Win32JoyStick.cpp
r5781 r8284 21 21 3. This notice may not be removed or altered from any source distribution. 22 22 */ 23 #include " Win32/Win32JoyStick.h"24 #include " Win32/Win32InputManager.h"25 #include " Win32/Win32ForceFeedback.h"23 #include "win32/Win32JoyStick.h" 24 #include "win32/Win32InputManager.h" 25 #include "win32/Win32ForceFeedback.h" 26 26 #include "OISEvents.h" 27 27 #include "OISException.h" 28 28 29 // (Orxonox): Required for MinGW to compile properly 30 #ifdef __MINGW32__ 31 # include <oaidl.h> 32 # ifndef __MINGW_EXTENSION 33 # define __MINGW_EXTENSION __extension__ 34 # endif 35 #endif 36 29 37 #include <cassert> 38 #include <wbemidl.h> 39 #include <oleauto.h> 40 //#include <wmsstd.h> 41 #ifndef SAFE_RELEASE 42 #define SAFE_RELEASE(x) \ 43 if(x != NULL) \ 44 { \ 45 x->Release(); \ 46 x = NULL; \ 47 } 48 #endif 49 50 // (Orxonox): MinGW doesn't have swscanf_s 51 #ifdef __MINGW32__ 52 # define swscanf_s swscanf 53 #endif 54 55 #ifdef OIS_WIN32_XINPUT_SUPPORT 56 # pragma comment(lib, "xinput.lib") 57 #endif 30 58 31 59 //DX Only defines macros for the JOYSTICK not JOYSTICK2, so fix it … … 40 68 #define DIJOFS_SLIDER3(n) (FIELD_OFFSET(DIJOYSTATE2, rglFSlider)+(n) * sizeof(LONG)) 41 69 70 #define XINPUT_TRANSLATED_BUTTON_COUNT 12 71 #define XINPUT_TRANSLATED_AXIS_COUNT 6 72 42 73 using namespace OIS; 43 74 44 75 //--------------------------------------------------------------------------------------------------// 45 Win32JoyStick::Win32JoyStick( InputManager* creator, IDirectInput8* pDI, 46 bool buffered, DWORD coopSettings, const JoyStickInfo &info ) 47 : JoyStick(info.vendor, buffered, info.devId, creator) 48 { 49 mDirectInput = pDI; 50 coopSetting = coopSettings; 51 mJoyStick = 0; 52 53 deviceGuid = info.deviceID; 54 55 ff_device = 0; 76 Win32JoyStick::Win32JoyStick( InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings, const JoyStickInfo &info ) : 77 JoyStick(info.vendor, buffered, info.devId, creator), 78 mDirectInput(pDI), 79 coopSetting(coopSettings), 80 mJoyStick(0), 81 mJoyInfo(info), 82 mFfDevice(0) 83 { 56 84 } 57 85 … … 59 87 Win32JoyStick::~Win32JoyStick() 60 88 { 61 delete ff_device;89 delete mFfDevice; 62 90 63 91 if(mJoyStick) … … 69 97 70 98 //Return joystick to pool 71 JoyStickInfo js; 72 js.deviceID = deviceGuid; 73 js.devId = mDevID; 74 js.vendor = mVendor; 75 static_cast<Win32InputManager*>(mCreator)->_returnJoyStick(js); 99 static_cast<Win32InputManager*>(mCreator)->_returnJoyStick(mJoyInfo); 76 100 } 77 101 … … 79 103 void Win32JoyStick::_initialize() 80 104 { 81 //Clear old state 82 mState.mAxes.clear(); 83 84 if (ff_device) 85 { 86 delete ff_device; 87 ff_device = 0; 88 } 89 90 // Create direct input joystick device. 91 if(FAILED(mDirectInput->CreateDevice(deviceGuid, &mJoyStick, NULL))) 92 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> Could not initialize joy device!"); 93 94 // Set DIJoystick2 data format. 95 if(FAILED(mJoyStick->SetDataFormat(&c_dfDIJoystick2))) 96 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> data format error!"); 97 98 // Set cooperative level as specified when creating input manager. 99 HWND hwin = ((Win32InputManager*)mCreator)->getWindowHandle(); 100 if(FAILED(mJoyStick->SetCooperativeLevel( hwin, coopSetting))) 101 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> failed to set cooperation level!"); 102 103 // Set buffer size. 104 DIPROPDWORD dipdw; 105 dipdw.diph.dwSize = sizeof(DIPROPDWORD); 106 dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); 107 dipdw.diph.dwObj = 0; 108 dipdw.diph.dwHow = DIPH_DEVICE; 109 dipdw.dwData = JOYSTICK_DX_BUFFERSIZE; 110 111 if( FAILED(mJoyStick->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)) ) 112 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize >> Failed to set buffer size property" ); 113 114 // Enumerate all axes/buttons/sliders/force feedback/etc before aquiring 115 _enumerate(); 116 117 mState.clear(); 118 119 capture(); 105 if (mJoyInfo.isXInput) 106 { 107 _enumerate(); 108 } 109 else 110 { 111 //Clear old state 112 mState.mAxes.clear(); 113 114 delete mFfDevice; 115 mFfDevice = 0; 116 117 DIPROPDWORD dipdw; 118 119 dipdw.diph.dwSize = sizeof(DIPROPDWORD); 120 dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); 121 dipdw.diph.dwObj = 0; 122 dipdw.diph.dwHow = DIPH_DEVICE; 123 dipdw.dwData = JOYSTICK_DX_BUFFERSIZE; 124 125 if(FAILED(mDirectInput->CreateDevice(mJoyInfo.deviceID, &mJoyStick, NULL))) 126 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> Could not initialize joy device!"); 127 128 if(FAILED(mJoyStick->SetDataFormat(&c_dfDIJoystick2))) 129 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> data format error!"); 130 131 HWND hwin = ((Win32InputManager*)mCreator)->getWindowHandle(); 132 133 if(FAILED(mJoyStick->SetCooperativeLevel( hwin, coopSetting))) 134 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> failed to set cooperation level!"); 135 136 if( FAILED(mJoyStick->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)) ) 137 OIS_EXCEPT( E_General, "Win32Mouse::Win32Mouse >> Failed to set buffer size property" ); 138 139 //Enumerate all axes/buttons/sliders/etc before aquiring 140 _enumerate(); 141 142 mState.clear(); 143 144 capture(); 145 } 120 146 } 121 147 … … 123 149 void Win32JoyStick::_enumerate() 124 150 { 125 // Get joystick capabilities. 126 mDIJoyCaps.dwSize = sizeof(DIDEVCAPS); 127 if( FAILED(mJoyStick->GetCapabilities(&mDIJoyCaps)) ) 128 OIS_EXCEPT( E_General, "Win32JoyStick::_enumerate >> Failed to get capabilities" ); 129 130 // => Number of POVs 131 mPOVs = (short)mDIJoyCaps.dwPOVs; 132 133 // => Number of buttons and axes. 134 mState.mButtons.resize(mDIJoyCaps.dwButtons); 135 mState.mAxes.resize(mDIJoyCaps.dwAxes); 136 137 // Enumerate all Force Feedback effects (if any) 138 mJoyStick->EnumEffects(DIEnumEffectsCallback, this, DIEFT_ALL); 139 140 //Reset the axis mapping enumeration value 141 _AxisNumber = 0; 142 143 // Enumerate and set axis constraints (and check FF Axes) 144 mJoyStick->EnumObjects(DIEnumDeviceObjectsCallback, this, DIDFT_AXIS); 151 if (mJoyInfo.isXInput) 152 { 153 mPOVs = 1; 154 155 mState.mButtons.resize(XINPUT_TRANSLATED_BUTTON_COUNT); 156 mState.mAxes.resize(XINPUT_TRANSLATED_AXIS_COUNT); 157 } 158 else 159 { 160 // Get joystick capabilities. 161 mDIJoyCaps.dwSize = sizeof(DIDEVCAPS); 162 if( FAILED(mJoyStick->GetCapabilities(&mDIJoyCaps)) ) 163 OIS_EXCEPT( E_General, "Win32JoyStick::_enumerate >> Failed to get capabilities" ); 164 165 mPOVs = (short)mDIJoyCaps.dwPOVs; 166 167 mState.mButtons.resize(mDIJoyCaps.dwButtons); 168 mState.mAxes.resize(mDIJoyCaps.dwAxes); 169 170 //Reset the axis mapping enumeration value 171 _AxisNumber = 0; 172 173 //Enumerate Force Feedback (if any) 174 mJoyStick->EnumEffects(DIEnumEffectsCallback, this, DIEFT_ALL); 175 176 //Enumerate and set axis constraints (and check FF Axes) 177 mJoyStick->EnumObjects(DIEnumDeviceObjectsCallback, this, DIDFT_AXIS); 178 } 145 179 } 146 180 … … 191 225 if((lpddoi->dwFlags & DIDOI_FFACTUATOR) != 0 ) 192 226 { 193 if( _this-> ff_device )227 if( _this->mFfDevice ) 194 228 { 195 _this-> ff_device->_addFFAxis();229 _this->mFfDevice->_addFFAxis(); 196 230 } 197 231 } … … 200 234 //as DInput has no API to query the device for these capabilities 201 235 //(the only way to know is to try them ...) 202 if( _this-> ff_device )203 { 204 _this-> ff_device->_setGainSupport(true);205 _this-> ff_device->_setAutoCenterSupport(true);236 if( _this->mFfDevice ) 237 { 238 _this->mFfDevice->_setGainSupport(true); 239 _this->mFfDevice->_setAutoCenterSupport(true); 206 240 } 207 241 … … 215 249 216 250 //Create the FF instance only after we know there is at least one effect type 217 if( _this-> ff_device == 0 )218 _this->ff_device = new Win32ForceFeedback(_this->mJoyStick, &_this->mDIJoyCaps);219 220 _this-> ff_device->_addEffectSupport( pdei);251 if( _this->mFfDevice == 0 ) 252 _this->mFfDevice = new Win32ForceFeedback(_this->mJoyStick, &_this->mDIJoyCaps); 253 254 _this->mFfDevice->_addEffectSupport(pdei); 221 255 222 256 return DIENUM_CONTINUE; … … 226 260 void Win32JoyStick::capture() 227 261 { 262 #ifdef OIS_WIN32_XINPUT_SUPPORT 263 //handle xbox controller differently 264 if (mJoyInfo.isXInput) 265 { 266 captureXInput(); 267 return; 268 } 269 #endif 270 271 //handle directinput based devices 228 272 DIDEVICEOBJECTDATA diBuff[JOYSTICK_DX_BUFFERSIZE]; 229 273 DWORD entries = JOYSTICK_DX_BUFFERSIZE; … … 241 285 242 286 // Poll the device to read the current state 243 287 mJoyStick->Poll(); 244 288 hr = mJoyStick->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), diBuff, &entries, 0 ); 245 289 //Perhaps the user just tabbed away … … 353 397 354 398 //--------------------------------------------------------------------------------------------------// 399 void Win32JoyStick::captureXInput() 400 { 401 #ifdef OIS_WIN32_XINPUT_SUPPORT 402 XINPUT_STATE inputState; 403 if (XInputGetState((DWORD)mJoyInfo.xInputDev, &inputState) != ERROR_SUCCESS) 404 memset(&inputState, 0, sizeof(inputState)); 405 406 //Sticks and triggers 407 int value; 408 bool axisMoved[XINPUT_TRANSLATED_AXIS_COUNT] = {false,false,false,false,false,false}; 409 410 //LeftY 411 value = -(int)inputState.Gamepad.sThumbLY; 412 mState.mAxes[0].rel = value - mState.mAxes[0].abs; 413 mState.mAxes[0].abs = value; 414 if(mState.mAxes[0].rel != 0) 415 axisMoved[0] = true; 416 417 //LeftX 418 mState.mAxes[1].rel = inputState.Gamepad.sThumbLX - mState.mAxes[1].abs; 419 mState.mAxes[1].abs = inputState.Gamepad.sThumbLX; 420 421 if(mState.mAxes[1].rel != 0) 422 axisMoved[1] = true; 423 424 //RightY 425 value = -(int)inputState.Gamepad.sThumbRY; 426 mState.mAxes[2].rel = value - mState.mAxes[2].abs; 427 mState.mAxes[2].abs = value; 428 if(mState.mAxes[2].rel != 0) 429 axisMoved[2] = true; 430 431 //RightX 432 mState.mAxes[3].rel = inputState.Gamepad.sThumbRX - mState.mAxes[3].abs; 433 mState.mAxes[3].abs = inputState.Gamepad.sThumbRX; 434 if(mState.mAxes[3].rel != 0) 435 axisMoved[3] = true; 436 437 //Left trigger 438 value = inputState.Gamepad.bLeftTrigger * 129; 439 if(value > JoyStick::MAX_AXIS) 440 value = JoyStick::MAX_AXIS; 441 442 mState.mAxes[4].rel = value - mState.mAxes[4].abs; 443 mState.mAxes[4].abs = value; 444 if(mState.mAxes[4].rel != 0) 445 axisMoved[4] = true; 446 447 //Right trigger 448 value = (int)inputState.Gamepad.bRightTrigger * 129; 449 if(value > JoyStick::MAX_AXIS) 450 value = JoyStick::MAX_AXIS; 451 452 mState.mAxes[5].rel = value - mState.mAxes[5].abs; 453 mState.mAxes[5].abs = value; 454 if(mState.mAxes[5].rel != 0) 455 axisMoved[5] = true; 456 457 //POV 458 int previousPov = mState.mPOV[0].direction; 459 int& pov = mState.mPOV[0].direction; 460 pov = Pov::Centered; 461 if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) 462 pov |= Pov::North; 463 else if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) 464 pov |= Pov::South; 465 if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) 466 pov |= Pov::West; 467 else if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) 468 pov |= Pov::East; 469 470 //Buttons - The first 4 buttons don't need to be checked since they represent the dpad 471 bool previousButtons[XINPUT_TRANSLATED_BUTTON_COUNT]; 472 std::copy(mState.mButtons.begin(), mState.mButtons.end(), previousButtons); 473 for (size_t i = 0; i < XINPUT_TRANSLATED_BUTTON_COUNT; i++) 474 mState.mButtons[i] = (inputState.Gamepad.wButtons & (1 << (i + 4))) != 0; 475 476 //Send events 477 if (mBuffered && mListener) 478 { 479 JoyStickEvent joystickEvent(this, mState); 480 481 //Axes 482 for (int i = 0; i < XINPUT_TRANSLATED_AXIS_COUNT; i++) 483 { 484 if (axisMoved[i] && !mListener->axisMoved(joystickEvent, i)) 485 return; 486 } 487 488 //POV 489 if (previousPov != pov && !mListener->povMoved(joystickEvent, 0)) 490 return; 491 492 //Buttons 493 for (int i = 0; i < XINPUT_TRANSLATED_BUTTON_COUNT; i++) 494 { 495 if (!previousButtons[i] && mState.mButtons[i]) 496 { 497 if (!mListener->buttonPressed(joystickEvent, i)) 498 return; 499 } 500 else if (previousButtons[i] && !mState.mButtons[i]) 501 { 502 if (!mListener->buttonReleased(joystickEvent, i)) 503 return; 504 } 505 } 506 } 507 #endif 508 } 509 510 //--------------------------------------------------------------------------------------------------// 355 511 bool Win32JoyStick::_doButtonClick( int button, DIDEVICEOBJECTDATA& di ) 356 512 { … … 410 566 Interface* Win32JoyStick::queryInterface(Interface::IType type) 411 567 { 412 //Thought about using covariant return type here.. however, 413 //some devices may allow LED light changing, or other interface stuff 414 415 if( ff_device && type == Interface::ForceFeedback ) 416 return ff_device; 568 if( mFfDevice && type == Interface::ForceFeedback ) 569 return mFfDevice; 417 570 else 418 571 return 0; 419 572 } 573 574 //--------------------------------------------------------------------------------------------------// 575 void Win32JoyStick::CheckXInputDevices(JoyStickInfoList &joys) 576 { 577 IWbemLocator* pIWbemLocator = NULL; 578 IEnumWbemClassObject* pEnumDevices = NULL; 579 IWbemClassObject* pDevices[20] = {0}; 580 IWbemServices* pIWbemServices = NULL; 581 BSTR bstrNamespace = NULL; 582 BSTR bstrDeviceID = NULL; 583 BSTR bstrClassName = NULL; 584 DWORD uReturned = 0; 585 bool bIsXinputDevice= false; 586 DWORD iDevice = 0; 587 int xDevice = 0; 588 VARIANT var; 589 HRESULT hr; 590 591 if(joys.size() == 0) 592 return; 593 594 // CoInit if needed 595 hr = CoInitialize(NULL); 596 bool bCleanupCOM = SUCCEEDED(hr); 597 598 // Create WMI 599 // (Orxonox): Fix for MinGW 600 #ifdef __MINGW32__ 601 hr = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID*)&pIWbemLocator); 602 #else 603 hr = CoCreateInstance(__uuidof(WbemLocator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID*)&pIWbemLocator); 604 #endif 605 if( FAILED(hr) || pIWbemLocator == NULL ) 606 goto LCleanup; 607 608 bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" ); 609 if( bstrNamespace == NULL ) 610 goto LCleanup; 611 612 bstrClassName = SysAllocString( L"Win32_PNPEntity" ); 613 if( bstrClassName == NULL ) 614 goto LCleanup; 615 616 bstrDeviceID = SysAllocString( L"DeviceID" ); 617 if( bstrDeviceID == NULL ) 618 goto LCleanup; 619 620 // Connect to WMI 621 hr = pIWbemLocator->ConnectServer( bstrNamespace, NULL, NULL, 0L, 0L, NULL, NULL, &pIWbemServices ); 622 if( FAILED(hr) || pIWbemServices == NULL ) 623 goto LCleanup; 624 625 // Switch security level to IMPERSONATE. 626 CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); 627 628 hr = pIWbemServices->CreateInstanceEnum( bstrClassName, 0, NULL, &pEnumDevices ); 629 if( FAILED(hr) || pEnumDevices == NULL ) 630 goto LCleanup; 631 632 // Loop over all devices 633 for( ;; ) 634 { 635 // Get 20 at a time 636 hr = pEnumDevices->Next(5000, 20, pDevices, &uReturned); 637 if( FAILED(hr) ) 638 goto LCleanup; 639 640 if( uReturned == 0 ) 641 break; 642 643 for(iDevice = 0; iDevice < uReturned; iDevice++) 644 { 645 // For each device, get its device ID 646 hr = pDevices[iDevice]->Get(bstrDeviceID, 0L, &var, NULL, NULL); 647 if(SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != NULL) 648 { 649 // Check if the device ID contains "IG_". If it does, then it's an XInput device - This information can not be found from DirectInput 650 if(wcsstr(var.bstrVal, L"IG_")) 651 { 652 // If it does, then get the VID/PID from var.bstrVal 653 DWORD dwPid = 0, dwVid = 0; 654 WCHAR* strVid = wcsstr( var.bstrVal, L"VID_" ); 655 if(strVid && swscanf_s( strVid, L"VID_%4X", &dwVid ) != 1) 656 dwVid = 0; 657 658 WCHAR* strPid = wcsstr( var.bstrVal, L"PID_" ); 659 if(strPid && swscanf_s( strPid, L"PID_%4X", &dwPid ) != 1) 660 dwPid = 0; 661 662 // Compare the VID/PID to the DInput device 663 DWORD dwVidPid = MAKELONG(dwVid, dwPid); 664 for(JoyStickInfoList::iterator i = joys.begin(); i != joys.end(); ++i) 665 { 666 if(dwVidPid == i->productGuid.Data1) 667 { 668 i->isXInput = true; 669 i->xInputDev = xDevice; 670 } 671 } 672 673 if(joys.size() == 0) 674 goto LCleanup; 675 } 676 } 677 678 SAFE_RELEASE(pDevices[iDevice]); 679 } 680 } 681 682 LCleanup: 683 if(bstrNamespace) 684 SysFreeString(bstrNamespace); 685 686 if(bstrDeviceID) 687 SysFreeString(bstrDeviceID); 688 689 if(bstrClassName) 690 SysFreeString(bstrClassName); 691 692 for(iDevice=0; iDevice < 20; iDevice++) 693 SAFE_RELEASE(pDevices[iDevice]); 694 695 SAFE_RELEASE(pEnumDevices); 696 SAFE_RELEASE(pIWbemLocator); 697 SAFE_RELEASE(pIWbemServices); 698 699 if(bCleanupCOM) 700 CoUninitialize(); 701 } -
code/branches/kicklib2/src/external/ois/win32/Win32JoyStick.h
r5781 r8284 25 25 26 26 #include "OISJoyStick.h" 27 #include " Win32/Win32Prereqs.h"27 #include "win32/Win32Prereqs.h" 28 28 29 29 namespace OIS … … 41 41 virtual void capture(); 42 42 43 //! hanlde xinput 44 void captureXInput(); 45 43 46 /** @copydoc Object::queryInterface */ 44 47 virtual Interface* queryInterface(Interface::IType type); … … 46 49 /** @copydoc Object::_initialize */ 47 50 virtual void _initialize(); 51 52 /** 53 @remarks 54 Enum each PNP device using WMI and check each device ID to see if it contains 55 "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device 56 Unfortunately this information can not be found by just using DirectInput 57 */ 58 static void CheckXInputDevices(JoyStickInfoList &joys); 48 59 49 60 protected: … … 61 72 IDirectInputDevice8* mJoyStick; 62 73 DIDEVCAPS mDIJoyCaps; 74 DWORD coopSetting; 63 75 64 DWORD coopSetting; 65 GUID deviceGuid; 76 JoyStickInfo mJoyInfo; 66 77 67 78 //! A force feedback device 68 Win32ForceFeedback* ff_device;79 Win32ForceFeedback* mFfDevice; 69 80 70 81 //! Mapping -
code/branches/kicklib2/src/external/ois/win32/Win32KeyBoard.cpp
r5781 r8284 21 21 3. This notice may not be removed or altered from any source distribution. 22 22 */ 23 #include " Win32/Win32InputManager.h"24 #include " Win32/Win32KeyBoard.h"23 #include "win32/Win32InputManager.h" 24 #include "win32/Win32KeyBoard.h" 25 25 #include "OISException.h" 26 26 #include "OISEvents.h" … … 287 287 288 288 //--------------------------------------------------------------------------------------------------// 289 const std::string& Win32Keyboard::getAsString( KeyCode kc)289 const std::string& Win32Keyboard::getAsString(KeyCode kc) 290 290 { 291 291 char temp[256]; … … 297 297 prop.diph.dwHow = DIPH_BYOFFSET; 298 298 299 if ( SUCCEEDED( mKeyboard->GetProperty( DIPROP_KEYNAME, &prop.diph ) ))299 if (SUCCEEDED(mKeyboard->GetProperty(DIPROP_KEYNAME, &prop.diph))) 300 300 { 301 301 // convert the WCHAR in "wsz" to multibyte 302 if ( WideCharToMultiByte( CP_ACP, 0, prop.wsz, -1, temp, sizeof(temp), NULL, NULL))303 return mGetString.assign( temp);302 if (WideCharToMultiByte(CP_ACP, 0, prop.wsz, -1, temp, sizeof(temp), NULL, NULL)) 303 return mGetString.assign(temp); 304 304 } 305 305 306 306 std::stringstream ss; 307 307 ss << "Key_" << (int)kc; 308 return mGetString.assign( ss.str());308 return mGetString.assign(ss.str()); 309 309 } 310 310 -
code/branches/kicklib2/src/external/ois/win32/Win32KeyBoard.h
r5781 r8284 25 25 26 26 #include "OISKeyboard.h" 27 #include " Win32/Win32Prereqs.h"27 #include "win32/Win32Prereqs.h" 28 28 29 29 namespace OIS … … 42 42 A combination of DI Flags (see DX Help for info on input device settings) 43 43 */ 44 Win32Keyboard( InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings);44 Win32Keyboard(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings); 45 45 virtual ~Win32Keyboard(); 46 46 47 47 /** @copydoc Keyboard::isKeyDown */ 48 virtual bool isKeyDown( KeyCode key) const;48 virtual bool isKeyDown(KeyCode key) const; 49 49 50 50 /** @copydoc Keyboard::getAsString */ 51 virtual const std::string& getAsString( KeyCode kc);51 virtual const std::string& getAsString(KeyCode kc); 52 52 53 53 /** @copydoc Keyboard::copyKeyStates */ 54 virtual void copyKeyStates( char keys[256]) const;54 virtual void copyKeyStates(char keys[256]) const; 55 55 56 56 /** @copydoc Object::setBuffered */ -
code/branches/kicklib2/src/external/ois/win32/Win32Mouse.cpp
r5781 r8284 21 21 3. This notice may not be removed or altered from any source distribution. 22 22 */ 23 #include " Win32/Win32Mouse.h"24 #include " Win32/Win32InputManager.h"23 #include "win32/Win32Mouse.h" 24 #include "win32/Win32InputManager.h" 25 25 #include "OISException.h" 26 26 #include "OISEvents.h" -
code/branches/kicklib2/src/external/ois/win32/Win32Mouse.h
r5781 r8284 25 25 26 26 #include "OISMouse.h" 27 #include " Win32/Win32Prereqs.h"27 #include "win32/Win32Prereqs.h" 28 28 29 29 namespace OIS -
code/branches/kicklib2/src/external/ois/win32/Win32Prereqs.h
r5781 r8284 29 29 #include <dinput.h> 30 30 31 #ifdef OIS_WIN32_XINPUT_SUPPORT 32 # include <XInput.h> 33 #endif 34 31 35 //Max number of elements to collect from buffered DirectInput 32 36 #define KEYBOARD_DX_BUFFERSIZE 17 33 #define MOUSE_DX_BUFFERSIZE 6434 #define JOYSTICK_DX_BUFFERSIZE 12 437 #define MOUSE_DX_BUFFERSIZE 128 38 #define JOYSTICK_DX_BUFFERSIZE 129 35 39 36 40 //MinGW defines … … 55 59 int devId; 56 60 GUID deviceID; 61 GUID productGuid; 57 62 std::string vendor; 63 bool isXInput; 64 int xInputDev; 58 65 }; 59 66 60 typedef std::vector< JoyStickInfo> JoyStickInfoList;67 typedef std::vector<JoyStickInfo> JoyStickInfoList; 61 68 } 62 69
Note: See TracChangeset
for help on using the changeset viewer.