Remove unneeded axis checking after SDL2 is used

This commit is contained in:
Benau
2020-04-21 20:05:50 +08:00
parent 0e023cae78
commit 957fe41f3d
2 changed files with 0 additions and 36 deletions

View File

@@ -41,17 +41,11 @@ GamePadDevice::GamePadDevice(const int irr_index, const std::string &name,
}
m_prev_axis_directions.resize(axis_count);
m_prev_axis_value.resize(axis_count);
m_axis_ok.resize(axis_count);
m_irr_index = irr_index;
m_name = name;
for (int i = 0; i < axis_count; i++)
{
m_prev_axis_directions[i] = Input::AD_NEUTRAL;
m_prev_axis_value[i] = -1;
m_axis_ok[i] = false;
}
m_button_pressed.resize(button_count);
for(int n=0; n<button_count; n++)
@@ -204,20 +198,6 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
if (*value > 0) m_prev_axis_directions[id] = Input::AD_POSITIVE;
else if(*value < 0) m_prev_axis_directions[id] = Input::AD_NEGATIVE;
if (!m_axis_ok[id])
{
if (m_prev_axis_value[id] == -1)
{
// first value we get from this axis
m_prev_axis_value[id] = *value;
}
else if (m_prev_axis_value[id] != *value)
{
// second different value we get from this axis, consider it OK
m_axis_ok[id] = true;
}
}
int dz = static_cast<GamepadConfig*>(m_configuration)->getDeadzone();
// check if within deadzone
if(*value > -dz && *value < dz && getPlayer())
@@ -244,9 +224,6 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
return false;
}
// If axis did not send proper values yet, ignore it.
if (!m_axis_ok[id]) return false;
}

View File

@@ -36,19 +36,6 @@ class GamePadDevice : public InputDevice
std::vector<Input::AxisDirection> m_prev_axis_directions;
/** used to determine if an axis is valid; an axis is considered valid
* when at least 2 different values are read from this axis (if an axis
* keeps on sending the exact same value continuously, chances are that
* it's not meant by the user - for instance some gamepads have hats or
* analog switches that get reported as axis, we even had a report that
* on linux some hard disks may be reported as gamepads with
* uninteresting axis values)
*/
std::vector<int> m_prev_axis_value;
/** \see m_prev_axis_value */
std::vector<bool> m_axis_ok;
/** Irrlicht index of this gamepad. */
int m_irr_index;