Skip to content
JoystickSDL.h 783 B
Newer Older
Gregory Dymarek's avatar
Gregory Dymarek committed
#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, MultiVehicleManager* multiVehicleManager);
Gregory Dymarek's avatar
Gregory Dymarek committed

    static QMap<QString, Joystick*> discover(MultiVehicleManager* _multiVehicleManager); 

private:
Gregory Dymarek's avatar
Gregory Dymarek committed
    bool _open() final;
    void _close() final;
    bool _update() final;
Gregory Dymarek's avatar
Gregory Dymarek committed

Gregory Dymarek's avatar
Gregory Dymarek committed
    bool _getButton(int i) final;
    int _getAxis(int i) final;
    uint8_t _getHat(int hat,int i) final;
Gregory Dymarek's avatar
Gregory Dymarek committed

    SDL_Joystick *sdlJoystick;
    int     _index;      ///< Index for SDL_JoystickOpen
};

#endif // JOYSTICKSDL_H