SDL: Fix erratic analog pointer + control options

Fixes erratic speeds in analog pointer motion
Implemented option to set analog/keyboard pointer speed
and control the analog joystick deadzone. The deadzone option appears
only if the build supports analog joystick (via JOY_ANALOG define)
This commit is contained in:
rsn8887 2017-02-19 20:14:51 -06:00
parent 085332a3dc
commit 45bd7a8b75
15 changed files with 353 additions and 53 deletions

View file

@ -179,6 +179,10 @@ bool OSystem_SDL::hasFeature(Feature f) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
if (f == kFeatureClipboardSupport) return true;
#endif
#ifdef JOY_ANALOG
if (f == kFeatureJoystickDeadzone) return true;
#endif
if (f == kFeatureKbdMouseSpeed) return true;
return ModularBackend::hasFeature(f);
}
@ -274,6 +278,16 @@ void OSystem_SDL::initBackend() {
_inited = true;
if (!ConfMan.hasKey("kbdmouse_speed")) {
ConfMan.registerDefault("kbdmouse_speed", 3);
ConfMan.setInt("kbdmouse_speed", 3);
}
#ifdef JOY_ANALOG
if (!ConfMan.hasKey("joystick_deadzone")) {
ConfMan.registerDefault("joystick_deadzone", 3);
ConfMan.setInt("joystick_deadzone", 3);
}
#endif
ModularBackend::initBackend();
// We have to initialize the graphics manager before the event manager