Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9911


Ignore:
Timestamp:
Dec 16, 2013, 3:06:08 PM (10 years ago)
Author:
georgr
Message:

watch out for sensitivity! IR input now working, still trying to fix roll

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  
    254254               CWiimote::LED_3, CWiimote::LED_4};
    255255            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);
    256260            try
    257261                   {
     
    267271                         orxout()<<"Exception loading WiiMote!!!1!11!";
    268272                   }
    269 
    270 
    271 
    272         }
     273            }
    273274
    274275
  • code/branches/wiimote/src/libraries/core/input/Mouse.cc

    r9667 r9911  
    7979            IntVector2 abs(e.state.X.abs, e.state.Y.abs);
    8080            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;
    8183            IntVector2 clippingSize(e.state.width, e.state.height);
    8284            for (unsigned int i = 0; i < inputStates_.size(); ++i)
  • code/branches/wiimote/src/libraries/core/input/WiiMote.cc

    r9890 r9911  
    1414                if(p == NULL)
    1515              exit(0);
    16                 PWii->RefreshWiimotes();
    17                 Orientation o;
    18                 Orientation toMove;
     16                IntVector2 o(0,0);
     17                float r = 0; //roll variable
    1918                for (int i=0; i<4; i++)
    2019                {
    2120                        if(PWii->Poll())
    2221                                {
    23                                         //orxout()<<"test11"<<endl;
    2422                                        switch (p->GetEvent())
    2523                                        {
     
    2725                                                {
    2826                                                        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;
    3741                                                        break;
    3842                                                }
     
    4852                                }
    4953                }
    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
    5663                IntVector2 abs(0,0);
    57                 IntVector2 rel(x,y);
     64                IntVector2 rel(0,0);
    5865                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;
    5981
    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 states
    65                         }
    66                 lastOrientation = o;
    6782        }
    6883        void WiiMote::clearBuffers()
     
    8196                lastOrientation.roll = 0;
    8297                lastOrientation.pitch = 0;
    83 
     98                lastCursor.x = 0;
     99                lastCursor.y = 0;
    84100        }
    85101}
  • code/branches/wiimote/src/libraries/core/input/WiiMote.h

    r9890 r9911  
    3939                 CWiimote * p;
    4040                 CWii * PWii; //parent "wii" the wiimote is registered to
     41                 IntVector2 lastCursor;
    4142        };
    4243};
Note: See TracChangeset for help on using the changeset viewer.