Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

bug fix

File size: 1.1 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                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.getDeltaTime());
19                int y = (int)((o.pitch-lastOrientation.pitch)*time.getDeltaTime());
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
30        }
31        void WiiMote::clearBuffers()
32        {
33
34        }
35        void WiiMote::test(int x, int y)
36        {
37
38        }
39        WiiMote::WiiMote(unsigned int id, CWiimote & parent)  : InputDevice(id)
40        {
41                p = &parent;
42
43                lastOrientation.yaw = 0;
44                lastOrientation.roll = 0;
45                lastOrientation.pitch = 0;
46
47        }
48}
Note: See TracBrowser for help on using the repository browser.