SuperTuxKart
Loading...
Searching...
No Matches
wiimote.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2013-2015 SuperTuxKart-Team
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef WIIMOTE_HPP
20#define WIIMOTE_HPP
21
22#ifdef ENABLE_WIIUSE
23
24#include "utils/synchronised.hpp"
25
26#include "IEventReceiver.h"
27
28struct wiimote_t;
29class GamepadConfig;
30class GamePadDevice;
31
33class Wiimote
34{
35private:
38 static const int WIIMOTE_START_IRR_ID = 32;
39
41 wiimote_t* m_wiimote_handle;
42
44 int m_wiimote_id;
45
47 GamePadDevice* m_gamepad_device;
48
50 Synchronised<irr::SEvent> m_irr_event;
51
53 bool m_connected;
54
55 void resetIrrEvent();
56 void printDebugInfo() const;
57
58public:
60 Wiimote(wiimote_t* wiimote_handle, int wiimote_id,
61 GamepadConfig* gamepad_config);
62 ~Wiimote();
63
65 void cleanup();
66 void update();
67 irr::SEvent getIrrEvent();
68
69 // -----------------------------------------------------------------------------
71 wiimote_t* getWiimoteHandle() const { return m_wiimote_handle; }
72 // -----------------------------------------------------------------------------
74 bool isConnected() const { return m_connected; }
75 // -----------------------------------------------------------------------------
77 void setConnected(bool connected) { m_connected=connected; }
78 // -----------------------------------------------------------------------------
81 int getIrrId() { return m_wiimote_id + WIIMOTE_START_IRR_ID; }
82
83}; // class Wiimote
84
85#endif
86
87#endif // WIIMOTE_HPP
specialisation of Inputdevice for gamepad type devices
Definition: gamepad_device.hpp:33
specialisation of DeviceConfig for gamepad type devices
Definition: gamepad_config.hpp:43
A variable that is automatically synchronised using pthreads mutex.
Definition: synchronised.hpp:28
void update(float dt)
Updates all widgets that need to be updated.
Definition: engine.cpp:872