mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-15 07:07:14 +02:00
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
//
|
|
// JoystickScriptingInterface.h
|
|
// interface/src/devices
|
|
//
|
|
// Created by Andrzej Kapolka on 5/15/14.
|
|
// Copyright 2014 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
#ifndef hifi_JoystickScriptingInterface_h
|
|
#define hifi_JoystickScriptingInterface_h
|
|
|
|
#include <QObject>
|
|
#include <QVector>
|
|
|
|
#include "devices/Joystick.h"
|
|
|
|
/// Handles joystick input through SDL.
|
|
class JoystickScriptingInterface : public QObject {
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QStringList availableJoystickNames READ getAvailableJoystickNames)
|
|
public:
|
|
static JoystickScriptingInterface& getInstance();
|
|
|
|
const QStringList& getAvailableJoystickNames() const { return _availableDeviceNames; }
|
|
|
|
void update();
|
|
|
|
public slots:
|
|
Joystick* joystickWithName(const QString& name);
|
|
void reset();
|
|
|
|
private:
|
|
#ifdef HAVE_SDL
|
|
SDL_Joystick* openSDLJoystickWithName(const QString& name);
|
|
#endif
|
|
|
|
JoystickScriptingInterface();
|
|
~JoystickScriptingInterface();
|
|
|
|
QMap<QString, Joystick*> _openJoysticks;
|
|
QStringList _availableDeviceNames;
|
|
bool _isInitialized;
|
|
};
|
|
|
|
#endif // hifi_JoystickScriptingInterface_h
|