QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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:
64
68 QgsGamepad2DMapController( int gamepadDeviceId, QObject *parent SIP_TRANSFERTHIS = nullptr );
69
70 QgsGamepad2DMapController *clone() const override SIP_FACTORY;
71 QString deviceId() const override;
72
73 // proxy QGamepad signals and properties here, as QGamepad isn't accessible from Python.
74 // Ideally we would share these with QgsGamepad3DMapController, but that would create a diamond
75 // inheritance
76
80 bool isConnected() const;
81
85 QString name() const;
86
90 double axisLeftX() const;
91
95 double axisLeftY() const;
96
100 double axisRightX() const;
101
105 double axisRightY() const;
106
110 bool buttonA() const;
111
115 bool buttonB() const;
116
120 bool buttonX() const;
121
125 bool buttonY() const;
126
130 bool buttonL1() const;
131
135 bool buttonR1() const;
136
140 double buttonL2() const;
141
145 double buttonR2() const;
146
152 bool buttonSelect() const;
153
159 bool buttonStart() const;
160
166 bool buttonL3() const;
167
173 bool buttonR3() const;
174
178 bool buttonUp() const;
179
183 bool buttonDown() const;
184
188 bool buttonLeft() const;
189
193 bool buttonRight() const;
194
198 bool buttonCenter() const;
199
205 bool buttonGuide() const;
206
207 signals:
208
212 void connectedChanged( bool value );
213
219 void axisLeftXChanged( double value );
220
226 void axisLeftYChanged( double value );
227
233 void axisRightXChanged( double value );
234
240 void axisRightYChanged( double value );
241
247 void buttonAChanged( bool value );
248
254 void buttonBChanged( bool value );
255
261 void buttonXChanged( bool value );
262
268 void buttonYChanged( bool value );
269
275 void buttonL1Changed( bool value );
276
282 void buttonR1Changed( bool value );
283
289 void buttonL2Changed( double value );
290
296 void buttonR2Changed( double value );
297
303 void buttonSelectChanged( bool value );
304
310 void buttonStartChanged( bool value );
311
317 void buttonL3Changed( bool value );
318
324 void buttonR3Changed( bool value );
325
331 void buttonUpChanged( bool value );
332
338 void buttonDownChanged( bool value );
339
345 void buttonLeftChanged( bool value );
346
352 void buttonRightChanged( bool value );
353
359 void buttonCenterChanged( bool value );
360
366 void buttonGuideChanged( bool value );
367
368 private:
369 int mGamepadDeviceId = -1;
370 QPointer< QGamepad> mGamepad;
371};
372
373#endif
374
375#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