Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/wiimote/src/libraries/core/input/WiiMote.cc @ 9838

Last change on this file since 9838 was 9838, checked in by georgr, 10 years ago

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

File size: 1.3 KB
Line 
1#include "WiiMote.h"
2#include "core/CoreIncludes.h"
3#include "core/command/ConsoleCommand.h"
4#include <wiicpp/wiicpp/wiicpp.h>
5
6namespace orxonox
7{
8
9        const std::string WiiMote::deviceName = "WiiMote";
10        void WiiMote::update(const Clock& time)
11        {
12                orxout(user_warning) << this->inputStates_.size() << std::endl;
13                if(p == NULL)
14              exit(0);
15                else
16                  orxout(user_warning) << "pointer is not null, yay" << std::endl;
17                if (PWii->Poll())
18                {
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                        }
34                }
35
36
37        }
38        void WiiMote::clearBuffers()
39        {
40
41        }
42        void WiiMote::test(int x, int y)
43        {
44
45        }
46        WiiMote::WiiMote(unsigned int id, CWiimote & parent, CWii & parentWii)  : InputDevice(id)
47        {
48                p = &parent;
49                PWii = &parentWii;
50                lastOrientation.yaw = 0;
51                lastOrientation.roll = 0;
52                lastOrientation.pitch = 0;
53
54        }
55}
Note: See TracBrowser for help on using the repository browser.