Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9838


Ignore:
Timestamp:
Dec 2, 2013, 2:09:41 PM (10 years ago)
Author:
georgr
Message:

developing on 2 PCs is a lot of fun, bluetooth is a rare commodity… wiimote should connect properly now

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

Legend:

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

    r9819 r9838  
    255255                       {
    256256                         orxout()<< "Size of devices vector before wiimote insertion:" << devices_.size() << std::endl;
    257                          devices_.push_back(new WiiMote(devices_.size(), *i));
     257                         devices_.push_back(new WiiMote((unsigned int)devices_.size(), *i, wii));
    258258                         //devices_[2] = new WiiMote(devices_.size(), *(new CWiimote()));
    259259                         orxout()<< "Size of devices vector after wiimote insertion:" << devices_.size() << std::endl;
  • code/branches/wiimote/src/libraries/core/input/WiiMote.cc

    r9819 r9838  
    1414              exit(0);
    1515                else
    16                   orxout(user_warning) << 'pointer is not null, yay' << std::endl;
    17                 CWiimote::EventTypes e = p->GetEvent();
    18                 if(p->Buttons.isPressed(CButtons::BUTTON_A))
    19                         orxout()<<"ZOMG!!1!"<<endl;
    20                 Orientation o;
    21                 p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw);
    22                 int x = (int)((o.yaw-lastOrientation.yaw)*time.getDeltaTime());
    23                 int y = (int)((o.pitch-lastOrientation.pitch)*time.getDeltaTime());
    24                 IntVector2 abs(0, 0);
    25                 IntVector2 rel(x, y);
    26                 IntVector2 clippingSize(1920, 1080);
    27                 if(x!=0&&y!=0)
     16                  orxout(user_warning) << "pointer is not null, yay" << std::endl;
     17                if (PWii->Poll())
    2818                {
    29                         for (unsigned int i = 0; i < inputStates_.size(); ++i)
    30                                         inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     19                        CWiimote::EventTypes e = p->GetEvent();
     20                        if(p->Buttons.isPressed(CButtons::BUTTON_A))
     21                                orxout()<<"ZOMG!!1!"<<endl;
     22                        Orientation o;
     23                        p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw);
     24                        int x = (int)((o.yaw-lastOrientation.yaw)*time.getDeltaTime());
     25                        int y = (int)((o.pitch-lastOrientation.pitch)*time.getDeltaTime());
     26                        IntVector2 abs(0, 0);
     27                        IntVector2 rel(x, y);
     28                        IntVector2 clippingSize(1920, 1080);
     29                        if(x!=0&&y!=0)
     30                        {
     31                                for (unsigned int i = 0; i < inputStates_.size(); ++i)
     32                                                                inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     33                        }
    3134                }
    3235
     
    4144
    4245        }
    43         WiiMote::WiiMote(unsigned int id, CWiimote & parent)  : InputDevice(id)
     46        WiiMote::WiiMote(unsigned int id, CWiimote & parent, CWii & parentWii)  : InputDevice(id)
    4447        {
    4548                p = &parent;
    46 
     49                PWii = &parentWii;
    4750                lastOrientation.yaw = 0;
    4851                lastOrientation.roll = 0;
  • code/branches/wiimote/src/libraries/core/input/WiiMote.h

    r9813 r9838  
    2121         public:
    2222                        //! Only resets the members
    23                 WiiMote(unsigned int id, CWiimote & parent);
     23                WiiMote(unsigned int id, CWiimote & parent, CWii & parentWii);
    2424                ~WiiMote() { }
    2525                //! Returns the device class (derived) name as string
     
    4141                 void test(int x, int y);
    4242                 CWiimote * p;
     43                 CWii * PWii; //parent "wii" the wiimote is registered to
    4344        };
    4445};
Note: See TracChangeset for help on using the changeset viewer.