Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9813


Ignore:
Timestamp:
Nov 25, 2013, 3:38:51 PM (10 years ago)
Author:
georgr
Message:

Added some simple wobbling action. To be tested.

Location:
code/branches/wiimote/src/libraries/core/input
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/wiimote/src/libraries/core/input/InputManager.cc

    r9805 r9813  
    234234
    235235        // Find and connect to the wiimotes
    236         std::vector<CWiimote>& wiimotes = wii.FindAndConnect();
     236        std::vector<CWiimote>& wiimotes = wii.FindAndConnect(30);
    237237        if (!wiimotes.size())
    238238        {
    239239                cout << "No wiimotes found." << endl;
     240                return;
    240241                }
    241242
  • code/branches/wiimote/src/libraries/core/input/WiiMote.cc

    r9790 r9813  
    1111        {
    1212                orxout(user_warning) << this->inputStates_.size() << std::endl;
     13                CWiimote::EventTypes e = p->GetEvent();
     14                if(p->Buttons.isPressed(CButtons::BUTTON_A))
     15                        orxout()<<"ZOMG!!1!"<<endl;
     16                Orientation o;
     17                p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw);
     18                int x = (int)(o.yaw-lastOrientation.yaw)*time.tickDt_;
     19                int y = (int)(o.pitch-lastOrientation.pitch)*time.tickDt_;
     20                IntVector2 abs(0, 0);
     21                IntVector2 rel(x, y);
     22                IntVector2 clippingSize(1920, 1080);
     23                if(x!=0&&y!=0)
     24                {
     25                        for (unsigned int i = 0; i < inputStates_.size(); ++i)
     26                                        inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     27                }
     28
     29
    1330        }
    1431        void WiiMote::clearBuffers()
     
    2340        {
    2441                p = &parent;
     42
     43                lastOrientation.yaw = 0;
     44                lastOrientation.roll = 0;
     45                lastOrientation.pitch = 0;
     46
    2547        }
    2648}
  • code/branches/wiimote/src/libraries/core/input/WiiMote.h

    r9805 r9813  
    1111
    1212
    13 
     13        struct Orientation
     14    {
     15        float roll, pitch, yaw;
     16    };
    1417
    1518        class WiiMote : public InputDevice
     
    3033                 void calibrationStarted() { }
    3134                 void calibrationStopped() { }
     35                 Orientation lastOrientation;
    3236                 //! List of all input states that receive events from this device
    3337                 //std::vector<InputState*> inputStates_;
Note: See TracChangeset for help on using the changeset viewer.