[Input] Added SetVibration() API skeleton

This commit is contained in:
thefiddler 2014-01-02 19:52:00 +01:00
parent ec43b9ff85
commit 8649e4a044
6 changed files with 46 additions and 7 deletions

View file

@ -65,5 +65,22 @@ namespace OpenTK.Input
{
return driver.GetState(index);
}
/// <summary>
/// Sets the vibration intensity for the left and right motors of this <see cref="GamePad"/>
/// </summary>
/// <returns>
/// <c>true</c>, if vibration was set, <c>false</c> otherwise. This method can return false
/// if the <c>GamePad</c> hardware does not support vibration or if it cannot respond to
/// the command for any reason. Do not loop until this becomes true, but rather ignore
/// a return value of false.
/// </returns>
/// <param name="index">A zero-based device index for the <c>GamePad</c> device to affect</param>
/// <param name="left">The vibration intensity for the left motor, between 0.0 and 1.0.</param>
/// <param name="right">The vibration intensity for the right motor, between 0.0 and 1.0.</param>
public static bool SetVibration(int index, float left, float right)
{
return driver.SetVibration(index, left, right);
}
}
}

View file

@ -19,5 +19,7 @@ namespace OpenTK.Input
/// <remarks>
/// <para>If no device exists at the specified index, the return value is <see cref="System.String.Empty"/>.</para></remarks>
string GetName(int index);
bool SetVibration(int index, float left, float right);
}
}

View file

@ -168,6 +168,11 @@ namespace OpenTK.Platform
return name;
}
public bool SetVibration(int index, float left, float right)
{
return false;
}
#region Private Members
GamePadConfiguration GetConfiguration(Guid guid)

View file

@ -567,6 +567,11 @@ namespace OpenTK.Platform.SDL2
{
return gamepad_driver.GetName(index);
}
public bool SetVibration(int index, float left, float right)
{
return false;
}
#endif
#endregion

View file

@ -87,7 +87,12 @@ namespace OpenTK.Platform.Windows
public string GetName(int index)
{
throw new NotImplementedException();
return String.Empty;
}
public bool SetVibration(int index, float left, float right)
{
return false;
}
#endregion

View file

@ -263,17 +263,22 @@ namespace OpenTK.Platform.X11
public GamePadCapabilities GetCapabilities(int index)
{
throw new NotImplementedException();
return new GamePadCapabilities();
}
public GamePadState GetState(int index)
{
throw new NotImplementedException();
return new GamePadState();
}
public string GetName(int index)
{
throw new NotImplementedException();
return String.Empty;
}
public bool SetVibration(int index, float left, float right)
{
return false;
}
#endregion
@ -282,17 +287,17 @@ namespace OpenTK.Platform.X11
JoystickState IJoystickDriver2.GetState(int index)
{
throw new NotImplementedException();
return new JoystickState();
}
JoystickCapabilities IJoystickDriver2.GetCapabilities(int index)
{
throw new NotImplementedException();
return new JoystickCapabilities();
}
Guid IJoystickDriver2.GetGuid(int index)
{
throw new NotImplementedException();
return new Guid();
}
#endregion