QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgs3dgamepadcontroller.h
Go to the documentation of this file.
1/***************************************************************************
2 qgs3dgamepadcontroller.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 QGS3DGAMEPADCONTROLLER_H
17#define QGS3DGAMEPADCONTROLLER_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 "qgs3dmapcontroller.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 QgsGamepad3DMapController : public QgsAbstract3DMapController
50{
51 Q_OBJECT
52
53#ifdef SIP_RUN
55 if ( qobject_cast< QgsGamepad3DMapController * >( sipCpp ) )
56
57 sipType = sipType_QgsGamepad3DMapController;
58 else
59 sipType = nullptr;
61#endif
62
63 public:
64
68 QgsGamepad3DMapController( int gamepadDeviceId, QObject *parent SIP_TRANSFERTHIS = nullptr );
69
70 QgsGamepad3DMapController *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
208 signals:
209
210
214 void connectedChanged( bool value );
215
221 void axisLeftXChanged( double value );
222
228 void axisLeftYChanged( double value );
229
235 void axisRightXChanged( double value );
236
242 void axisRightYChanged( double value );
243
249 void buttonAChanged( bool value );
250
256 void buttonBChanged( bool value );
257
263 void buttonXChanged( bool value );
264
270 void buttonYChanged( bool value );
271
277 void buttonL1Changed( bool value );
278
284 void buttonR1Changed( bool value );
285
291 void buttonL2Changed( double value );
292
298 void buttonR2Changed( double value );
299
305 void buttonSelectChanged( bool value );
306
312 void buttonStartChanged( bool value );
313
319 void buttonL3Changed( bool value );
320
326 void buttonR3Changed( bool value );
327
333 void buttonUpChanged( bool value );
334
340 void buttonDownChanged( bool value );
341
347 void buttonLeftChanged( bool value );
348
354 void buttonRightChanged( bool value );
355
361 void buttonCenterChanged( bool value );
362
368 void buttonGuideChanged( bool value );
369
370 private:
371
372 int mGamepadDeviceId = -1;
373 QPointer< QGamepad> mGamepad;
374};
375
376
377#endif
378
379#endif // QGS3DGAMEPADCONTROLLER_H
Abstract base class for all 3D 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