mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-21 15:48:51 -05:00
d24c8453db
subrepo: subdir: "libultraship" merged: "a484cda98" upstream: origin: "https://github.com/HarbourMasters/libultraship.git" branch: "main" commit: "a484cda98" git-subrepo: version: "0.4.1" origin: "???" commit: "???"
37 lines
971 B
C++
37 lines
971 B
C++
#pragma once
|
|
#include "Controller.h"
|
|
#include <SDL2/SDL.h>
|
|
|
|
#define INVALID_SDL_CONTROLLER_GUID (std::string("00000000000000000000000000000000"))
|
|
|
|
namespace Ship {
|
|
class SDLController : public Controller {
|
|
public:
|
|
SDLController(int32_t dwControllerNumber);
|
|
~SDLController();
|
|
|
|
void ReadFromSource();
|
|
void WriteToSource(ControllerCallback* controller);
|
|
|
|
std::string GetGuid() { return guid; };
|
|
|
|
protected:
|
|
std::string GetControllerType();
|
|
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
|
|
std::string GetConfSection();
|
|
std::string GetBindingConfSection();
|
|
void CreateDefaultBinding();
|
|
static bool IsGuidInUse(const std::string& guid);
|
|
|
|
private:
|
|
std::string guid;
|
|
SDL_GameController* Cont;
|
|
std::map<int32_t, int16_t> ThresholdMapping;
|
|
|
|
void LoadAxisThresholds();
|
|
void NormalizeStickAxis(int16_t wAxisValueX, int16_t wAxisValueY, int16_t wAxisThreshold);
|
|
bool Open();
|
|
bool Close();
|
|
};
|
|
}
|