forked from powersst/Maple-Tree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamepad.h
51 lines (41 loc) · 1.05 KB
/
gamepad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef GAMEPAD_H
#define GAMEPAD_H
#include <QObject>
#include <QtConcurrent>
#include <QtGamepad>
#include <QGamepadManager>
class QGamepad;
class Gamepad : public QObject
{
Q_OBJECT
public:
explicit Gamepad(QObject *parent = nullptr);
~Gamepad();
void init();
void closeGame();
static void button(int deviceId, QGamepadManager::GamepadButton button, double value);
static void release(int deviceId, QGamepadManager::GamepadButton button);
static void enable();
static void disable();
static void terminate();
static Gamepad *instance;
static bool isEnabled;
signals:
void gameStart(bool pressed);
void gameClose(bool pressed);
void gameUp(bool pressed);
void gameDown(bool pressed);
void nextTab(bool pressed);
void prevTab(bool pressed);
public slots:
private:
QGamepad *m_gamepad;
QMap<int, QGamepad*> m_gamepads;
QGamepadManager* manager;
bool l1 = false;
bool l2 = false;
bool r1 = false;
bool r2 = false;
bool select = false;
};
#endif // GAMEPAD_H