XInput SetVibration

This commit is contained in:
SND\rene87_cp 2011-10-31 16:22:39 +00:00
parent b4881a2c70
commit 31b9e4ce34
2 changed files with 14 additions and 1 deletions

View File

@ -44,6 +44,10 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsGame", "Samples\WindowsGame\WindowsGame.csproj", "{A08575E0-7B21-4822-9D4C-6B9EEB7EFFF7}"
EndProject
Global
GlobalSection(SubversionScc) = preSolution
Svn-Managed = True
Manager = AnkhSVN - Subversion Support for Visual Studio
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms

View File

@ -118,7 +118,16 @@ namespace ANX.InputSystem.Windows.XInput
public bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
{
throw new NotImplementedException();
if (controller[(int)playerIndex].IsConnected)
{
Vibration vib = new Vibration();
vib.LeftMotorSpeed = Convert.ToInt16(leftMotor * short.MaxValue);
vib.RightMotorSpeed = Convert.ToInt16(rightMotor * short.MaxValue);
controller[(int)playerIndex].SetVibration(vib);
return true;
}
return false;
}
}
}