JoystickSDL.h 727 Bytes
Newer Older
Gregory Dymarek's avatar
Gregory Dymarek committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#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 index, MultiVehicleManager* multiVehicleManager);

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

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

Gregory Dymarek's avatar
Gregory Dymarek committed
27 28
    bool _getButton(int i) final;
    int _getAxis(int i) final;
Gregory Dymarek's avatar
Gregory Dymarek committed
29 30 31 32 33 34

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

#endif // JOYSTICKSDL_H