History

move JoystickManager to JoystickScriptingInterface, add Joystick class for SDL Joystick

Stephen Birarda committed 12 years ago

Commit 00b08061 parent 900daf413 files · +216 −218Browse files

Showing the changes to interface/src/scripting/JoystickScriptingInterface.h (1 of 13 files). Show all

Unified · Split

interface/src/scripting/JoystickScriptingInterface.h+43−0
@@ -0,0 +1,43 @@
1+//
2+// JoystickScriptingInterface.h
3+// interface/src/devices
4+//
5+// Created by Andrzej Kapolka on 5/15/14.
6+// Copyright 2014 High Fidelity, Inc.
7+//
8+// Distributed under the Apache License, Version 2.0.
9+// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10+//
11+
12+#ifndef hifi_JoystickScriptingInterface_h
13+#define hifi_JoystickScriptingInterface_h
14+
15+#include <QObject>
16+#include <QVector>
17+
18+#include "devices/Joystick.h"
19+
20+/// Handles joystick input through SDL.
21+class JoystickScriptingInterface : public QObject {
22+ Q_OBJECT
23+
24+ Q_PROPERTY(QStringList availableJoystickNames READ getAvailableJoystickNames)
25+public:
26+ static JoystickScriptingInterface& getInstance();
27+
28+ const QStringList& getAvailableJoystickNames() const { return _availableDeviceNames; }
29+
30+ void update();
31+
32+public slots:
33+ Joystick* joystickWithName(const QString& name);
34+
35+private:
36+ JoystickScriptingInterface();
37+ ~JoystickScriptingInterface();
38+
39+ QMap<QString, Joystick*> _openJoysticks;
40+ QStringList _availableDeviceNames;
41+};
42+
43+#endif // hifi_JoystickScriptingInterface_h