Changeset 9911
- Timestamp:
- Dec 16, 2013, 3:06:08 PM (11 years ago)
- Location:
- code/branches/wiimote/src/libraries/core/input
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wiimote/src/libraries/core/input/InputManager.cc
r9890 r9911 254 254 CWiimote::LED_3, CWiimote::LED_4}; 255 255 wiimote.SetLEDs(LED_MAP[index]); 256 wiimote.IR.SetMode(CIR::ON); 257 wiimote.IR.SetAspectRatio(CIR::ASPECT_16_9); 258 wiimote.IR.SetBarPosition(CIR::BAR_ABOVE); 259 wiimote.IR.SetVres(1920,1080); 256 260 try 257 261 { … … 267 271 orxout()<<"Exception loading WiiMote!!!1!11!"; 268 272 } 269 270 271 272 } 273 } 273 274 274 275 -
code/branches/wiimote/src/libraries/core/input/Mouse.cc
r9667 r9911 79 79 IntVector2 abs(e.state.X.abs, e.state.Y.abs); 80 80 IntVector2 rel(e.state.X.rel, e.state.Y.rel); 81 orxout()<<"absolute x,y: " << abs.x<< ", " << abs.y << endl; 82 orxout()<<"relative x,y: " << rel.x<< ", " << rel.y << endl; 81 83 IntVector2 clippingSize(e.state.width, e.state.height); 82 84 for (unsigned int i = 0; i < inputStates_.size(); ++i) -
code/branches/wiimote/src/libraries/core/input/WiiMote.cc
r9890 r9911 14 14 if(p == NULL) 15 15 exit(0); 16 PWii->RefreshWiimotes(); 17 Orientation o; 18 Orientation toMove; 16 IntVector2 o(0,0); 17 float r = 0; //roll variable 19 18 for (int i=0; i<4; i++) 20 19 { 21 20 if(PWii->Poll()) 22 21 { 23 //orxout()<<"test11"<<endl;24 22 switch (p->GetEvent()) 25 23 { … … 27 25 { 28 26 if(p->Buttons.isPressed(CButtons::BUTTON_A)||p->Buttons.isJustPressed(CButtons::BUTTON_A)) //ugly hack to just do something on button press easily 29 { 30 orxout()<<"fak u dolan"<<endl; 31 CommandExecutor::execute("fire 0", 0, 0); 32 } 33 if (i==0) 34 p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw); 35 //orxout()<<time.getDeltaTime()<<std::endl; 36 27 { 28 //orxout()<<"fak u dolan"<<endl; 29 CommandExecutor::execute("fire 0", 0, 0); 30 } 31 // if(p->ExpansionDevice.GetType()==CExpansionDevice::TYPE_NUNCHUK) 32 // { 33 // if(p->ExpansionDevice.Nunchuk.Buttons.isPressed(CNunchukButtons::BUTTON_C)) 34 // CommandExecutor::execute("NewHumanController accelerate"); 35 // if(p->ExpansionDevice.Nunchuk.Buttons.isPressed(CNunchukButtons::BUTTON_Z)) 36 // CommandExecutor::execute("NewHumanController decelerate"); 37 // } 38 // float dummyPitch, dummyYaw, dummyRoll; 39 // p->Accelerometer.GetOrientation(dummyPitch, dummyRoll, dummyYaw); 40 // r += dummyRoll; 37 41 break; 38 42 } … … 48 52 } 49 53 } 50 //orxout() << time.getDeltaTime()<<endl; 51 orxout() << o.pitch << endl; 52 // int x = (int)(-10*(o.yaw-lastOrientation.yaw)); //get difference in orientation, divide by time to make faster movements result in faster orientation change 53 int y = (int)(4*(o.pitch-lastOrientation.pitch));//-lastOrientation.pitch)/time.getDeltaTime()); 54 int x=0; 55 //orxout() << x<< endl << y << endl; 54 // r/=4; 55 // std::stringstream temp; 56 // temp << "scale "; 57 // temp << (r-lastOrientation.roll); 58 // temp << " rotateRoll"; 59 // string com = temp.str(); 60 // orxout()<<com<<endl; 61 // //CommandExecutor::execute(com, 0, 0); 62 56 63 IntVector2 abs(0,0); 57 IntVector2 rel( x,y);64 IntVector2 rel(0,0); 58 65 IntVector2 clippingSize(1920, 1080); 66 p->IR.GetCursorPosition(o.x, o.y); 67 // orxout() << "y: " << o.y << " x: " << o.x << endl; 68 // orxout() << p->IR.GetNumDots() << endl; 69 rel.x = (o.x-lastCursor.x); 70 rel.y = (o.y-lastCursor.y); 71 abs.x = o.x; 72 abs.y = o.y; 73 if((rel.x!=0 || rel.y!=0)) 74 { 75 for (unsigned int i = 0; i < inputStates_.size(); ++i) 76 inputStates_[i]->mouseMoved(abs, rel, clippingSize); //pass random mouse movements to all input states 77 } 78 lastCursor.x = o.x; 79 lastCursor.y = o.y; 80 lastOrientation.roll = r; 59 81 60 61 if((x!=0 || y!=0)&&(o.pitch!=0))62 {63 for (unsigned int i = 0; i < inputStates_.size(); ++i)64 inputStates_[i]->mouseMoved(abs, rel, clippingSize); //pass random mouse movements to all input states65 }66 lastOrientation = o;67 82 } 68 83 void WiiMote::clearBuffers() … … 81 96 lastOrientation.roll = 0; 82 97 lastOrientation.pitch = 0; 83 98 lastCursor.x = 0; 99 lastCursor.y = 0; 84 100 } 85 101 } -
code/branches/wiimote/src/libraries/core/input/WiiMote.h
r9890 r9911 39 39 CWiimote * p; 40 40 CWii * PWii; //parent "wii" the wiimote is registered to 41 IntVector2 lastCursor; 41 42 }; 42 43 };
Note: See TracChangeset
for help on using the changeset viewer.