You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
924 B
39 lines
924 B
#ifndef JOYSTICKSDL_H |
|
#define JOYSTICKSDL_H |
|
|
|
#include "Joystick.h" |
|
#include "Vehicle.h" |
|
#include "MultiVehicleManager.h" |
|
|
|
#ifdef Q_OS_MAC |
|
#include <SDL.h> |
|
#else |
|
#include <SDL/SDL.h> |
|
#endif |
|
|
|
|
|
class JoystickSDL : public Joystick |
|
{ |
|
public: |
|
JoystickSDL(const QString& name, int axisCount, int buttonCount, int hatCount, int index, bool isGameController, MultiVehicleManager* multiVehicleManager); |
|
|
|
static QMap<QString, Joystick*> discover(MultiVehicleManager* _multiVehicleManager); |
|
|
|
private: |
|
static void _loadGameControllerMappings(); |
|
|
|
bool _open() final; |
|
void _close() final; |
|
bool _update() final; |
|
|
|
bool _getButton(int i) final; |
|
int _getAxis(int i) final; |
|
uint8_t _getHat(int hat,int i) final; |
|
|
|
SDL_Joystick *sdlJoystick; |
|
SDL_GameController *sdlController; |
|
bool _isGameController; |
|
int _index; ///< Index for SDL_JoystickOpen |
|
}; |
|
|
|
#endif // JOYSTICKSDL_H
|
|
|