1 /*
2  *  OpenSCAD (www.openscad.org)
3  *  Copyright (C) 2009-2017 Clifford Wolf <clifford@clifford.at> and
4  *                          Marius Kintel <marius@kintel.net>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  As a special exception, you have permission to link this program
12  *  with the CGAL library and distribute executables, as long as you
13  *  follow the requirements of the GNU GPL in regard to all of the
14  *  software in the executable aside from CGAL.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  *
25  */
26 #pragma once
27 
28 #include "InputDriver.h"
29 
30 #include <memory>
31 #include <QtGamepad/QGamepad>
32 
33 class QGamepadInputDriver : public InputDriver
34 {
35 public:
36     QGamepadInputDriver();
37     ~QGamepadInputDriver();
38     void run() override;
39     bool open() override;
40     void close() override;
41     bool isOpen() const;
42 
43     const std::string & get_name() const override;
44     std::string get_info() const override;
45 
getButtonCount()46     int getButtonCount() const override{
47         return 16;
48     }
getAxisCount()49     int getAxisCount() const override{
50         return 6;
51     }
52 
53 private:
54 	std::unique_ptr<QGamepad> gamepad;
55 };
56