CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/SDL/SDLJoystick.h
Views: 1401
1
#pragma once
2
#ifdef _MSC_VER
3
#include "SDL/SDL.h"
4
#else
5
#if PPSSPP_PLATFORM(MAC)
6
#include "SDL2/SDL.h"
7
#else
8
#include "SDL.h"
9
#endif
10
#endif
11
#include <map>
12
13
#include "Common/Input/InputState.h"
14
#include "Common/Input/KeyCodes.h"
15
#include "Common/Net/Resolve.h"
16
17
class SDLJoystick{
18
public:
19
SDLJoystick(bool init_SDL = false);
20
~SDLJoystick();
21
22
void registerEventHandler();
23
void ProcessInput(const SDL_Event &event);
24
25
private:
26
void setUpController(int deviceIndex);
27
void setUpControllers();
28
InputKeyCode getKeycodeForButton(SDL_GameControllerButton button);
29
int getDeviceIndex(int instanceId);
30
31
bool registeredAsEventHandler;
32
std::vector<SDL_GameController *> controllers;
33
std::map<int, int> controllerDeviceMap;
34
35
// Deduplicate axis events. Pair is device, axis.
36
std::map<std::pair<InputDeviceID, InputAxis>, float> prevAxisValue_;
37
};
38
39