Changeset 9790 for code/branches/wiimote/src/libraries/core
- Timestamp:
- Nov 18, 2013, 4:07:28 PM (11 years ago)
- Location:
- code/branches/wiimote/src/libraries/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wiimote/src/libraries/core/CMakeLists.txt
r9667 r9790 99 99 cpptcl_orxonox 100 100 ois_orxonox 101 wiic_orxonox 102 wiicpp_orxonox 101 103 tinyxml_orxonox 102 104 util -
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_) -
code/branches/wiimote/src/libraries/core/input/InputState.cc
r8729 r9790 55 55 { 56 56 if (device < handlers_.size()) 57 { orxout() << "Test we made it into the if clause" << std::endl; 57 58 return handlers_[device] != NULL; 59 } 58 60 else 59 61 return false; -
code/branches/wiimote/src/libraries/core/input/WiiMote.cc
r9780 r9790 10 10 void WiiMote::update(const Clock& time) 11 11 { 12 orxout()<<"fegit\n"; 13 12 orxout(user_warning) << this->inputStates_.size() << std::endl; 14 13 } 15 14 void WiiMote::clearBuffers() … … 21 20 22 21 } 23 WiiMote::WiiMote(unsigned int id ) : InputDevice(id)22 WiiMote::WiiMote(unsigned int id, CWiimote & parent) : InputDevice(id) 24 23 { 24 p = &parent; 25 25 } 26 26 } -
code/branches/wiimote/src/libraries/core/input/WiiMote.h
r9723 r9790 1 1 2 2 #include "InputDevice.h" 3 //#include "InputState.h"4 3 //#include "InputManager.h" 4 5 #include <wiicpp/wiicpp/wiicpp.h> 5 6 6 7 … … 8 9 namespace orxonox 9 10 { 11 12 13 14 10 15 class WiiMote : public InputDevice 11 16 { 17 12 18 public: 13 19 //! Only resets the members 14 WiiMote(unsigned int id );20 WiiMote(unsigned int id, CWiimote & parent); 15 21 ~WiiMote() { } 16 22 //! Returns the device class (derived) name as string … … 26 32 //! List of all input states that receive events from this device 27 33 std::vector<InputState*> inputStates_; 34 28 35 private: 29 36 static const std::string deviceName; 30 37 void test(int x, int y); 38 CWiimote * p; 31 39 }; 32 40 };
Note: See TracChangeset
for help on using the changeset viewer.