-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.cpp
74 lines (66 loc) · 1.81 KB
/
mainwindow.cpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(&GamepadServer::instance(), SIGNAL(stateUpdate(GamepadState, int)),
this, SLOT(catchGamepadState(GamepadState, int)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::catchGamepadState(const GamepadState & gps, const int & playerId) {
qDebug() << "Player " << playerId << ": ";
qDebug() << "Left Trigger: " << gps.m_lTrigger <<
"\tRight Trigger: " << gps.m_rTrigger;
qDebug() << "Left Thumb :: X Axis: " << gps.m_lThumb.xAxis <<
"\t Y Axis: " << gps.m_lThumb.yAxis;
qDebug() << "Right Thumb :: Y Axis: " << gps.m_rThumb.xAxis <<
"\t Y Axis: " << gps.m_rThumb.yAxis;
if (gps.m_pad_a) {
qDebug() << "A Pressed.";
}
if (gps.m_pad_b) {
qDebug() << "B Pressed.";
}
if (gps.m_pad_x) {
qDebug() << "X Pressed.";
}
if (gps.m_pad_y) {
qDebug() << "Y Pressed.";
}
if (gps.m_pad_up) {
qDebug() << "Up Pressed.";
}
if (gps.m_pad_down) {
qDebug() << "Down Pressed.";
}
if (gps.m_pad_left) {
qDebug() << "Left Pressed.";
}
if (gps.m_pad_right) {
qDebug() << "Right Pressed.";
}
if (gps.m_lShoulder) {
qDebug() << "Left Shoulder Pressed.";
}
if (gps.m_rShoulder) {
qDebug() << "Right Shoulder Pressed.";
}
if (gps.m_lThumb.pressed) {
qDebug() << "Left Thumb Pressed.";
}
if (gps.m_rThumb.pressed) {
qDebug() << "Right Thumb Pressed.";
}
if (gps.m_pad_start) {
qDebug() << "Start Pressed.";
}
if (gps.m_pad_back) {
qDebug() << "Back Pressed.";
}
}