Fix an issue with sdl input binding

This commit is contained in:
ergo720 2020-09-19 20:27:01 +02:00
parent d091a0ee8f
commit 92b6a9800d
2 changed files with 2 additions and 26 deletions

View File

@ -146,31 +146,6 @@ public:
m_Bindings[XButton] = Control;
}
protected:
class FullAnalogSurface : public Input
{
public:
FullAnalogSurface(Input* Low, Input* High) : m_Low(*Low), m_High(*High) {}
ControlState GetState() const override
{
return (1 + m_High.GetState() - m_Low.GetState()) / 2;
}
std::string GetName() const override { return m_Low.GetName() + *m_High.GetName().rbegin(); }
private:
Input& m_Low;
Input& m_High;
};
void AddAnalogInputs(Input* Low, Input* High)
{
AddInput(Low);
AddInput(High);
AddInput(new FullAnalogSurface(Low, High));
AddInput(new FullAnalogSurface(High, Low));
}
private:
// arbitrary ID assigned by to the device
int m_ID;

View File

@ -301,7 +301,8 @@ namespace Sdl
// get axes
for (i = 0; i != NumAxes; ++i) {
// each axis gets a negative and a positive input instance associated with it
AddAnalogInputs(new Axis(i, m_Joystick, -32768), new Axis(i, m_Joystick, 32767));
AddInput(new Axis(i, m_Joystick, -32768));
AddInput(new Axis(i, m_Joystick, 32767));
}
// try to get supported ff effects