mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-25 13:46:55 +00:00
[Win] Implemented XInput vibration support
This commit is contained in:
parent
06e63946cc
commit
c3b289ee9b
|
@ -116,7 +116,14 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public bool SetVibration(int index, float left, float right)
|
public bool SetVibration(int index, float left, float right)
|
||||||
{
|
{
|
||||||
return false;
|
left = MathHelper.Clamp(left, 0.0f, 1.0f);
|
||||||
|
right = MathHelper.Clamp(right, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
XInputVibration vibration = new XInputVibration(
|
||||||
|
(ushort)(left * UInt16.MaxValue),
|
||||||
|
(ushort)(right * UInt16.MaxValue));
|
||||||
|
|
||||||
|
return xinput.SetState((XInputUserIndex)index, ref vibration) == XInputErrorCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -285,8 +292,14 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
struct XInputVibration
|
struct XInputVibration
|
||||||
{
|
{
|
||||||
public short LeftMotorSpeed;
|
public ushort LeftMotorSpeed;
|
||||||
public short RightMotorSpeed;
|
public ushort RightMotorSpeed;
|
||||||
|
|
||||||
|
public XInputVibration(ushort left, ushort right)
|
||||||
|
{
|
||||||
|
LeftMotorSpeed = left;
|
||||||
|
RightMotorSpeed = right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct XInputDeviceCapabilities
|
struct XInputDeviceCapabilities
|
||||||
|
|
Loading…
Reference in a new issue