Implemented GamePad vibration

This commit is contained in:
Tom Lint 2014-08-18 15:05:32 +02:00
parent 66c6978d43
commit 50bd58fc29

View File

@ -92,12 +92,24 @@ public class GamePad
* @return
* true if successful, false otherwise.
*/
public static boolean SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
public synchronized static boolean SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
{
Controller ctrl = Controllers.getController(playerIndex.ordinal());
//TODO: Implement
int rumblrCount = ctrl.getRumblerCount();
return true;
if (rumblrCount > 0)
{
ctrl.setRumblerStrength(0, leftMotor);
if (rumblrCount > 1)
{
ctrl.setRumblerStrength(1, rightMotor);
}
return true;
}
return false;
}
}