This commit is contained in:
parent
d1dda1651f
commit
8a95788ad4
@ -67,7 +67,7 @@ namespace ANX.InputSystem.Windows.XInput
|
|||||||
|
|
||||||
public XInput()
|
public XInput()
|
||||||
{
|
{
|
||||||
controller = new Controller[5];
|
controller = new Controller[4];
|
||||||
controller[0] = new Controller(UserIndex.One);
|
controller[0] = new Controller(UserIndex.One);
|
||||||
controller[1] = new Controller(UserIndex.Two);
|
controller[1] = new Controller(UserIndex.Two);
|
||||||
controller[2] = new Controller(UserIndex.Three);
|
controller[2] = new Controller(UserIndex.Three);
|
||||||
@ -118,11 +118,30 @@ namespace ANX.InputSystem.Windows.XInput
|
|||||||
|
|
||||||
public bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
|
public bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
|
||||||
{
|
{
|
||||||
|
short left;
|
||||||
|
short right;
|
||||||
|
if (Math.Abs(leftMotor)>1)
|
||||||
|
{
|
||||||
|
left = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
left = Convert.ToInt16(Math.Abs(leftMotor) * short.MaxValue);
|
||||||
|
}
|
||||||
|
if (Math.Abs(rightMotor) > 1)
|
||||||
|
{
|
||||||
|
right = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
right = Convert.ToInt16(Math.Abs(rightMotor) * short.MaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (controller[(int)playerIndex].IsConnected)
|
if (controller[(int)playerIndex].IsConnected)
|
||||||
{
|
{
|
||||||
Vibration vib = new Vibration();
|
Vibration vib = new Vibration();
|
||||||
vib.LeftMotorSpeed = Convert.ToInt16(leftMotor * short.MaxValue);
|
vib.LeftMotorSpeed = left;
|
||||||
vib.RightMotorSpeed = Convert.ToInt16(rightMotor * short.MaxValue);
|
vib.RightMotorSpeed = right;
|
||||||
controller[(int)playerIndex].SetVibration(vib);
|
controller[(int)playerIndex].SetVibration(vib);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user