ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
GamepadInput.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 // ##########################################################################
10 // # #
11 // # CLOUDCOMPARE #
12 // # #
13 // # This program is free software; you can redistribute it and/or modify #
14 // # it under the terms of the GNU General Public License as published by #
15 // # the Free Software Foundation; version 2 or later of the License. #
16 // # #
17 // # This program is distributed in the hope that it will be useful, #
18 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
19 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
20 // # GNU General Public License for more details. #
21 // # #
22 // # COPYRIGHT: Daniel Girardeau-Montaut #
23 // # #
24 // ##########################################################################
25 
26 #include "CVAppCommon.h"
27 
28 // cloudViewer
29 #include <CVConst.h>
30 
31 // qCC_db
32 #include <ecvGLMatrix.h>
33 
34 // Qt
35 #include <QGamepad>
36 #include <QTimer>
37 
38 class QMainWindow;
39 
41 class CVAPPCOMMON_LIB_API GamepadInput : public QGamepad {
42  Q_OBJECT
43 
44 public:
46  explicit GamepadInput(QObject* parent = nullptr);
48  virtual ~GamepadInput();
49 
50  void start();
51  void stop();
52 
54  void update(QMainWindow* win);
55 
56 Q_SIGNALS:
57 
58  void updated();
59 
60 protected:
61  void updateInternalState();
62 
63 private:
65  QTimer m_timer;
66 
68  CCVector3 m_panning;
69  bool m_hasPanning;
70  CCVector3 m_translation;
71  bool m_hasTranslation;
72  ccGLMatrixd m_rotation;
73  bool m_hasRotation;
74  float m_zoom;
75 };
#define CVAPPCOMMON_LIB_API
Definition: CVAppCommon.h:15
Gaempad handler.
Definition: GamepadInput.h:41
void updated()
Double version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:56