[Input] Fixed button/hat->trigger mapping scale

This commit is contained in:
thefiddler 2014-09-03 00:11:00 +02:00
parent 0735700d50
commit 742149412e

View file

@ -108,7 +108,12 @@ namespace OpenTK.Platform
// Todo: if SDL2 GameController config is ever updated to // Todo: if SDL2 GameController config is ever updated to
// distinguish between negative/positive axes, then update // distinguish between negative/positive axes, then update
// the following line to support both. // the following line to support both.
pad.SetAxis(map.Target.Axis, pressed ? short.MaxValue : (short)0); short value = pressed ?
short.MaxValue :
map.Target.Axis == GamePadAxes.LeftTrigger || map.Target.Axis == GamePadAxes.RightTrigger ?
short.MinValue :
(short)0;
pad.SetAxis(map.Target.Axis, value);
break; break;
case ConfigurationType.Button: case ConfigurationType.Button:
@ -150,7 +155,12 @@ namespace OpenTK.Platform
// Todo: if SDL2 GameController config is ever updated to // Todo: if SDL2 GameController config is ever updated to
// distinguish between negative/positive axes, then update // distinguish between negative/positive axes, then update
// the following line to support both. // the following line to support both.
pad.SetAxis(map.Target.Axis, pressed ? short.MaxValue : (short)0); short value = pressed ?
short.MaxValue :
map.Target.Axis == GamePadAxes.LeftTrigger || map.Target.Axis == GamePadAxes.RightTrigger ?
short.MinValue :
(short)0;
pad.SetAxis(map.Target.Axis, value);
break; break;
case ConfigurationType.Button: case ConfigurationType.Button: