SDL: Cleanup joystick deadzone handling
This commit is contained in:
parent
1fb748e974
commit
ee4ff8ca08
4 changed files with 11 additions and 30 deletions
|
@ -32,7 +32,6 @@
|
|||
|
||||
// FIXME move joystick defines out and replace with confile file options
|
||||
// we should really allow users to map any key to a joystick button
|
||||
#define JOY_DEADZONE 3200
|
||||
|
||||
// #define JOY_INVERT_Y
|
||||
#define JOY_XAXIS 0
|
||||
|
@ -1022,9 +1021,7 @@ bool SdlEventSource::handleAxisToMouseMotion(int16 xAxis, int16 yAxis) {
|
|||
|
||||
float analogX = (float)xAxis;
|
||||
float analogY = (float)yAxis;
|
||||
float deadZone = (float)JOY_DEADZONE;
|
||||
if (g_system->hasFeature(OSystem::kFeatureJoystickDeadzone))
|
||||
deadZone = (float)ConfMan.getInt("joystick_deadzone") * 1000.0f;
|
||||
float deadZone = (float)ConfMan.getInt("joystick_deadzone") * 1000.0f;
|
||||
|
||||
float magnitude = sqrt(analogX * analogX + analogY * analogY);
|
||||
|
||||
|
|
|
@ -94,12 +94,6 @@ void OSystem_PSP2::initBackend() {
|
|||
if (!ConfMan.hasKey("filtering")) {
|
||||
ConfMan.setBool("filtering", true);
|
||||
}
|
||||
if (!ConfMan.hasKey("kbdmouse_speed")) {
|
||||
ConfMan.setInt("kbdmouse_speed", 3);
|
||||
}
|
||||
if (!ConfMan.hasKey("joystick_deadzone")) {
|
||||
ConfMan.setInt("joystick_deadzone", 2);
|
||||
}
|
||||
if (!ConfMan.hasKey("shader")) {
|
||||
ConfMan.setInt("shader", 2);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ OSystem_SDL::OSystem_SDL()
|
|||
_eventSource(0),
|
||||
_window(0) {
|
||||
|
||||
ConfMan.registerDefault("kbdmouse_speed", 3);
|
||||
ConfMan.registerDefault("joystick_deadzone", 3);
|
||||
}
|
||||
|
||||
OSystem_SDL::~OSystem_SDL() {
|
||||
|
@ -287,14 +289,6 @@ void OSystem_SDL::initBackend() {
|
|||
|
||||
_inited = true;
|
||||
|
||||
if (!ConfMan.hasKey("kbdmouse_speed")) {
|
||||
ConfMan.registerDefault("kbdmouse_speed", 3);
|
||||
ConfMan.setInt("kbdmouse_speed", 3);
|
||||
}
|
||||
if (!ConfMan.hasKey("joystick_deadzone")) {
|
||||
ConfMan.registerDefault("joystick_deadzone", 3);
|
||||
ConfMan.setInt("joystick_deadzone", 3);
|
||||
}
|
||||
ModularBackend::initBackend();
|
||||
|
||||
// We have to initialize the graphics manager before the event manager
|
||||
|
|
|
@ -240,23 +240,19 @@ void OptionsDialog::build() {
|
|||
}
|
||||
}
|
||||
if (g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed)) {
|
||||
if (ConfMan.hasKey("kbdmouse_speed", _domain)) {
|
||||
int value = ConfMan.getInt("kbdmouse_speed", _domain);
|
||||
if (_kbdMouseSpeedSlider && value < ARRAYSIZE(kbdMouseSpeedLabels) - 1 && value >= 0) {
|
||||
_kbdMouseSpeedSlider->setValue(value);
|
||||
_kbdMouseSpeedLabel->setLabel(_(kbdMouseSpeedLabels[value]));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g_system->hasFeature(OSystem::kFeatureJoystickDeadzone)) {
|
||||
if (ConfMan.hasKey("joystick_deadzone", _domain)) {
|
||||
int value = ConfMan.getInt("joystick_deadzone", _domain);
|
||||
if (_joystickDeadzoneSlider != 0) {
|
||||
_joystickDeadzoneSlider->setValue(value);
|
||||
_joystickDeadzoneLabel->setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Graphic options
|
||||
if (_fullscreenCheckbox) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue