ControllerInterface: Make axis-to-button deadzone customizable

This commit is contained in:
Albert Liu
2020-06-22 19:30:19 -07:00
parent 6b7c068f83
commit 293c2f50cd
4 changed files with 22 additions and 4 deletions

View File

@ -32,6 +32,9 @@ public:
// Set scaling that will be applied on axis-to-axis mappings
bool SetControllerAxisScale(int controller_index, float scale = 1.00f) override;
// Set deadzone that will be applied on axis-to-button mappings
bool SetControllerDeadzone(int controller_index, float size = 0.25f) override;
void PollEvents() override;
bool ProcessSDLEvent(const SDL_Event* event);
@ -47,6 +50,7 @@ private:
// Scaling value of 1.30f to 1.40f recommended when using recent controllers
float axis_scale = 1.00f;
float deadzone = 0.25f;
std::array<AxisCallback, MAX_NUM_AXISES> axis_mapping;
std::array<ButtonCallback, MAX_NUM_BUTTONS> button_mapping;