2013-11-05 13:49:23 +01:00
|
|
|
#pragma once
|
2018-03-23 03:18:13 +01:00
|
|
|
#ifdef _MSC_VER
|
2013-11-24 06:32:19 +01:00
|
|
|
#include "SDL/SDL.h"
|
|
|
|
#include "SDL/SDL_thread.h"
|
|
|
|
#else
|
2013-11-05 13:49:23 +01:00
|
|
|
#include "SDL.h"
|
|
|
|
#include "SDL_thread.h"
|
2013-11-24 06:32:19 +01:00
|
|
|
#endif
|
2013-11-05 13:49:23 +01:00
|
|
|
|
|
|
|
#include "input/input_state.h"
|
|
|
|
#include "input/keycodes.h"
|
|
|
|
#include "net/resolve.h"
|
|
|
|
#include "base/NativeApp.h"
|
|
|
|
|
|
|
|
class SDLJoystick{
|
|
|
|
public:
|
|
|
|
SDLJoystick(bool init_SDL = false);
|
|
|
|
~SDLJoystick();
|
|
|
|
|
2017-02-01 14:19:18 +08:00
|
|
|
void registerEventHandler();
|
2013-11-05 13:49:23 +01:00
|
|
|
void ProcessInput(SDL_Event &event);
|
|
|
|
|
|
|
|
private:
|
2016-09-20 00:28:28 +01:00
|
|
|
void setUpController(int deviceIndex);
|
|
|
|
void setUpControllers();
|
2016-09-18 23:23:36 +01:00
|
|
|
keycode_t getKeycodeForButton(SDL_GameControllerButton button);
|
|
|
|
int getDeviceIndex(int instanceId);
|
2017-02-01 14:19:18 +08:00
|
|
|
bool registeredAsEventHandler;
|
2016-09-20 00:28:28 +01:00
|
|
|
std::vector<SDL_GameController *> controllers;
|
|
|
|
std::map<int, int> controllerDeviceMap;
|
2013-11-05 13:49:23 +01:00
|
|
|
};
|