QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgs2dgamepadcontroller.h
Go to the documentation of this file.
1/***************************************************************************
2 qgs2dgamepadcontroller.h
3 ---------------------
4 begin : March 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGS2DGAMEPADCONTROLLER_H
17#define QGS2DGAMEPADCONTROLLER_H
18
19#include "qgis_sip.h"
20#include "qgsconfig.h"
21
22SIP_IF_MODULE( HAVE_QTGAMEPAD )
23
24#ifdef HAVE_QTGAMEPAD
25
26#include "qgis_gui.h"
27#include "qgis.h"
28#include "qgs2dmapcontroller.h"
29
30#include <QPointer>
31
32#ifdef SIP_RUN
33// this is needed for the "convert to subclass" code below to compile
34//%ModuleHeaderCode
36//%End
37#endif
38
39class QGamepad;
40
41
49class GUI_EXPORT QgsGamepad2DMapController : public QgsAbstract2DMapController
50{
51 Q_OBJECT
52
53#ifdef SIP_RUN
55 if ( qobject_cast<QgsGamepad2DMapController *>( sipCpp ) )
56
57 sipType = sipType_QgsGamepad2DMapController;
58 else
59 sipType = nullptr;
61#endif
62
63 public:
67 QgsGamepad2DMapController( int gamepadDeviceId, QObject *parent SIP_TRANSFERTHIS = nullptr );
68
69 QgsGamepad2DMapController *clone() const override SIP_FACTORY;
70 QString deviceId() const override;
71
72 // proxy QGamepad signals and properties here, as QGamepad isn't accessible from Python.
73 // Ideally we would share these with QgsGamepad3DMapController, but that would create a diamond
74 // inheritance
75
79 bool isConnected() const;
80
84 QString name() const;
85
89 double axisLeftX() const;
90
94 double axisLeftY() const;
95
99 double axisRightX() const;
100
104 double axisRightY() const;
105
109 bool buttonA() const;
110
114 bool buttonB() const;
115
119 bool buttonX() const;
120
124 bool buttonY() const;
125
129 bool buttonL1() const;
130
134 bool buttonR1() const;
135
139 double buttonL2() const;
140
144 double buttonR2() const;
145
151 bool buttonSelect() const;
152
158 bool buttonStart() const;
159
165 bool buttonL3() const;
166
172 bool buttonR3() const;
173
177 bool buttonUp() const;
178
182 bool buttonDown() const;
183
187 bool buttonLeft() const;
188
192 bool buttonRight() const;
193
197 bool buttonCenter() const;
198
204 bool buttonGuide() const;
205
206 signals:
207
211 void connectedChanged( bool value );
212
218 void axisLeftXChanged( double value );
219
225 void axisLeftYChanged( double value );
226
232 void axisRightXChanged( double value );
233
239 void axisRightYChanged( double value );
240
246 void buttonAChanged( bool value );
247
253 void buttonBChanged( bool value );
254
260 void buttonXChanged( bool value );
261
267 void buttonYChanged( bool value );
268
274 void buttonL1Changed( bool value );
275
281 void buttonR1Changed( bool value );
282
288 void buttonL2Changed( double value );
289
295 void buttonR2Changed( double value );
296
302 void buttonSelectChanged( bool value );
303
309 void buttonStartChanged( bool value );
310
316 void buttonL3Changed( bool value );
317
323 void buttonR3Changed( bool value );
324
330 void buttonUpChanged( bool value );
331
337 void buttonDownChanged( bool value );
338
344 void buttonLeftChanged( bool value );
345
351 void buttonRightChanged( bool value );
352
358 void buttonCenterChanged( bool value );
359
365 void buttonGuideChanged( bool value );
366
367 private:
368 int mGamepadDeviceId = -1;
369 QPointer<QGamepad> mGamepad;
370};
371
372#endif
373
374#endif // QGS2DGAMEPADCONTROLLER_H
Abstract base class for all 2D map controllers.
virtual QgsAbstractInputController * clone() const =0
Returns a new copy of the controller.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_IF_MODULE(condition)
Definition qgis_sip.h:28
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_END
Definition qgis_sip.h:208