Fix an issue with sdl input binding
This commit is contained in:
parent
d091a0ee8f
commit
92b6a9800d
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue