2013-11-05 13:49:23 +01:00
|
|
|
#pragma once
|
|
|
|
|
2013-11-24 06:32:19 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
#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"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
int SDLJoystickThreadWrapper(void *SDLJoy);
|
|
|
|
}
|
|
|
|
|
|
|
|
class SDLJoystick{
|
|
|
|
friend int ::SDLJoystickThreadWrapper(void *);
|
|
|
|
public:
|
|
|
|
SDLJoystick(bool init_SDL = false);
|
|
|
|
~SDLJoystick();
|
|
|
|
|
|
|
|
void startEventLoop();
|
|
|
|
void ProcessInput(SDL_Event &event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void runLoop();
|
2016-09-18 23:23:36 +01:00
|
|
|
void setUpPlayer1();
|
|
|
|
keycode_t getKeycodeForButton(SDL_GameControllerButton button);
|
|
|
|
int getDeviceIndex(int instanceId);
|
2013-11-24 06:32:19 +01:00
|
|
|
SDL_Thread *thread ;
|
|
|
|
bool running ;
|
2016-09-18 23:23:36 +01:00
|
|
|
SDL_GameController *player1Controller;
|
|
|
|
SDL_JoystickID player1JoyInstanceID;
|
|
|
|
|
2013-11-05 13:49:23 +01:00
|
|
|
};
|