Skip to content

Controller improvements

ewew ukek requested to merge ewewukek/ManaVerse:improved_controller into master

This PR aims to start a discussion about proposed changes:

  • Remove joystick calibration feature and replace it with a slider to set the tolerance directly. All calibration did is set the amount of stick movement required to move the player. It was hard to configure desired sensitivity using calibration, a single slider should be easier to use in my opinion. As I understand SDL always translates axis values to -32767, 32767 so the new tolerance value is used for all axes and is shared between all joysticks.
  • Add "virtual" buttons for d-pad and axes (sticks and triggers) to allow binding actions to them. Currently axis0 (left stick on my controller) is reserved for movement but I could add a checkbox in the settings screen to allow binding actions to it too. Also, I had to implement a small hack for triggers because their values change from -32767 (resting position) to 32767 (not 0 to 32767 as I assumed previously). Currently extra "buttons" stored in config file as "j65" or "j81" because I didn't implement different naming scheme for d-pad and axes. That could be changed too.
  • Basic GUI support for controller. GUI code did not handle joystick input at all previously. I didn't set any default button scheme so you'll need to assign them manually.

Tested on Xbox wireless controller. I'll be glad if someone tests this with other controllers)

Merge request reports