- Timestamp:
- Nov 18, 2013, 4:07:28 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wiimote/src/libraries/core/input/InputManager.cc
r9723 r9790 60 60 #include "WiiMote.h" 61 61 62 62 63 namespace orxonox 63 64 { … … 217 218 this->loadMouse(); 218 219 this->loadJoySticks(); 219 220 this->loadWiiMote(); 220 221 // Reorder states in case some joy sticks were added/removed 221 222 this->updateActiveStates(); 222 this->loadWiiMote(); 223 223 224 orxout(verbose, context::input) << "Input devices loaded." << endl; 224 225 } 226 225 227 void InputManager::loadWiiMote() 226 228 { 227 try 229 230 CWii wii; // Defaults to 4 remotes 231 std::vector< ::CWiimote>::iterator i; 232 int reloadWiimotes = 0; 233 int index; 234 235 // Find and connect to the wiimotes 236 std::vector<CWiimote>& wiimotes = wii.FindAndConnect(); 237 if (!wiimotes.size()) 228 238 { 229 devices_.push_back(new WiiMote(234)); 239 cout << "No wiimotes found." << endl; 240 } 241 242 // Setup the wiimotes 243 for(index = 0, i = wiimotes.begin(); i != wiimotes.end(); ++i, ++index) 244 { 245 // Use a reference to make working with the iterator handy. 246 CWiimote & wiimote = *i; 247 248 //Set Leds 249 int LED_MAP[4] = 250 {CWiimote::LED_1, CWiimote::LED_2, 251 CWiimote::LED_3, CWiimote::LED_4}; 252 wiimote.SetLEDs(LED_MAP[index]); 253 254 230 255 } 231 catch(std::exception& e) //gotta catch em all 232 { 233 orxout()<<"Exception loading WiiMote!!!1!11!"; 234 } 256 try 257 { 258 orxout()<<devices_.size(); 259 devices_.push_back(new WiiMote(devices_.size(), *(new CWiimote()))); 260 //devices_[2] = new WiiMote(devices_.size(), *(new CWiimote())); 261 262 } 263 catch(std::exception& e) //gotta catch em all 264 { 265 orxout()<<"Exception loading WiiMote!!!1!11!"; 266 } 267 235 268 } 236 269 //! Creates a new orxonox::Mouse … … 436 469 for (std::map<int, InputState*>::reverse_iterator rit = activeStates_.rbegin(); rit != activeStates_.rend(); ++rit) 437 470 { 438 if (rit->second->isInputDeviceEnabled(i) && (!occupied || rit->second->bAlwaysGetsInput_)) 471 orxout() << "Checking ID " << i <<std::endl; 472 orxout() << "Checking condition 1: " << rit->second->isInputDeviceEnabled(i) <<std::endl; 473 orxout() << "Checking condition 2: " << rit->second->bAlwaysGetsInput_ <<std::endl; 474 orxout() << "Checking condition 3: " << !occupied <<std::endl; 475 if (rit->second->isInputDeviceEnabled(i) && (!occupied || rit->second->bAlwaysGetsInput_)) 439 476 { 477 orxout() << "Success with ID " << i <<std::endl; 440 478 states.push_back(rit->second); 441 479 if (!rit->second->bTransparent_)
Note: See TracChangeset
for help on using the changeset viewer.