- Timestamp:
- Aug 22, 2009, 11:16:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource2/src/ois/linux/LinuxJoyStickEvents.cpp
r1505 r5668 37 37 38 38 #include <sstream> 39 # include <iostream> 40 using namespace std; 39 41 40 42 using namespace OIS; 41 43 42 44 //#define OIS_LINUX_JOY_DEBUG 43 44 #ifdef OIS_LINUX_JOY_DEBUG45 # include <iostream>46 using namespace std;47 #endif48 45 49 46 //-------------------------------------------------------------------// … … 114 111 115 112 #ifdef OIS_LINUX_JOY_DEBUG 116 std::cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << std::endl;113 cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl; 117 114 #endif 118 115 … … 132 129 break; 133 130 } 134 case EV_ABS: //Absoulte Axis 131 132 case EV_ABS: //Absolute Axis 135 133 { 136 134 //A Stick (BrakeDefine is the highest possible Axis) … … 138 136 { 139 137 int axis = mAxisMap[js[i].code]; 140 assert( axis < 32 && "Too many axes , not supported. Report this to OIS forums!" );141 138 assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" ); 139 142 140 axisMoved[axis] = true; 143 141 … … 190 188 break; 191 189 } 192 //Relative Axes (Do any joysticks actually have a relative axis?) 193 case EV_REL: 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; 194 197 default: break; 195 198 } … … 243 246 for(int i = 0; i < 64; ++i ) 244 247 { 245 st d::stringstream s;248 stringstream s; 246 249 s << "/dev/input/event" << i; 247 int fd = open( s.str().c_str(), O_RD ONLY|O_NONBLOCK );250 int fd = open( s.str().c_str(), O_RDWR |O_NONBLOCK ); 248 251 if(fd == -1) 249 252 continue; 250 253 251 254 #ifdef OIS_LINUX_JOY_DEBUG 252 std::cout << "\nOpening " << s.str() << "...";255 cout << "Opening " << s.str() << "..." << endl; 253 256 #endif 254 257 try … … 259 262 joys.push_back(js); 260 263 #ifdef OIS_LINUX_JOY_DEBUG 261 std::cout << "\n__Joystick added to list";264 cout << "=> Joystick added to list." << endl; 262 265 #endif 263 266 } … … 265 268 { 266 269 #ifdef OIS_LINUX_JOY_DEBUG 267 std::cout << "\n__Not a joystick!!";270 cout << "=> Not a joystick." << endl; 268 271 #endif 269 272 close(fd); … … 273 276 { 274 277 #ifdef OIS_LINUX_JOY_DEBUG 275 std::cout << "\nException caught!!";278 cout << "Exception caught!!" << endl; 276 279 #endif 277 280 close(fd);
Note: See TracChangeset
for help on using the changeset viewer.