Haptic effects seem to work now.
This commit is contained in:
parent
8876cc0117
commit
2658498408
157
src/SDL2.cs
157
src/SDL2.cs
@ -3889,7 +3889,7 @@ namespace SDL2
|
|||||||
|
|
||||||
#region SDL_haptic.h
|
#region SDL_haptic.h
|
||||||
|
|
||||||
/* SDL_HapticCondition type */
|
/* SDL_HapticEffect type */
|
||||||
public const ushort SDL_HAPTIC_CONSTANT = (1 << 0);
|
public const ushort SDL_HAPTIC_CONSTANT = (1 << 0);
|
||||||
public const ushort SDL_HAPTIC_SINE = (1 << 1);
|
public const ushort SDL_HAPTIC_SINE = (1 << 1);
|
||||||
public const ushort SDL_HAPTIC_SQUARE = (1 << 2);
|
public const ushort SDL_HAPTIC_SQUARE = (1 << 2);
|
||||||
@ -3915,30 +3915,10 @@ namespace SDL2
|
|||||||
public const uint SDL_HAPTIC_INFINITY = 4292967295U;
|
public const uint SDL_HAPTIC_INFINITY = 4292967295U;
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct SDL_HapticCondition
|
public unsafe struct SDL_HapticDirection
|
||||||
{
|
{
|
||||||
// Header
|
public byte type;
|
||||||
public ushort type;
|
public fixed int dir[3];
|
||||||
public SDL_HapticDirection direction;
|
|
||||||
// Replay
|
|
||||||
public uint length;
|
|
||||||
public ushort delay;
|
|
||||||
// Trigger
|
|
||||||
public ushort button;
|
|
||||||
public ushort interval;
|
|
||||||
// Condition
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
||||||
public ushort[] right_sat;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
||||||
public ushort[] left_sat;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
||||||
public short[] right_coeff;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
||||||
public short[] left_coeff;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
||||||
public ushort[] deadband;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
||||||
public short[] center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@ -3962,6 +3942,73 @@ namespace SDL2
|
|||||||
public ushort fade_level;
|
public ushort fade_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct SDL_HapticPeriodic
|
||||||
|
{
|
||||||
|
// Header
|
||||||
|
public ushort type;
|
||||||
|
public SDL_HapticDirection direction;
|
||||||
|
// Replay
|
||||||
|
public uint length;
|
||||||
|
public ushort delay;
|
||||||
|
// Trigger
|
||||||
|
public ushort button;
|
||||||
|
public ushort interval;
|
||||||
|
// Periodic
|
||||||
|
public ushort period;
|
||||||
|
public short magnitude;
|
||||||
|
public short offset;
|
||||||
|
public ushort phase;
|
||||||
|
// Envelope
|
||||||
|
public ushort attack_length;
|
||||||
|
public ushort attack_level;
|
||||||
|
public ushort fade_length;
|
||||||
|
public ushort fade_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public unsafe struct SDL_HapticCondition
|
||||||
|
{
|
||||||
|
// Header
|
||||||
|
public ushort type;
|
||||||
|
public SDL_HapticDirection direction;
|
||||||
|
// Replay
|
||||||
|
public uint length;
|
||||||
|
public ushort delay;
|
||||||
|
// Trigger
|
||||||
|
public ushort button;
|
||||||
|
public ushort interval;
|
||||||
|
// Condition
|
||||||
|
public fixed ushort right_sat[3];
|
||||||
|
public fixed ushort left_sat[3];
|
||||||
|
public fixed short right_coeff[3];
|
||||||
|
public fixed short left_coeff[3];
|
||||||
|
public fixed ushort deadband[3];
|
||||||
|
public fixed short center[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct SDL_HapticRamp
|
||||||
|
{
|
||||||
|
// Header
|
||||||
|
public ushort type;
|
||||||
|
public SDL_HapticDirection direction;
|
||||||
|
// Replay
|
||||||
|
public uint length;
|
||||||
|
public ushort delay;
|
||||||
|
// Trigger
|
||||||
|
public ushort button;
|
||||||
|
public ushort interval;
|
||||||
|
// Ramp
|
||||||
|
public short start;
|
||||||
|
public short end;
|
||||||
|
// Envelope
|
||||||
|
public ushort attack_length;
|
||||||
|
public ushort attack_level;
|
||||||
|
public ushort fade_length;
|
||||||
|
public ushort fade_level;
|
||||||
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct SDL_HapticCustom
|
public struct SDL_HapticCustom
|
||||||
{
|
{
|
||||||
@ -3986,71 +4033,23 @@ namespace SDL2
|
|||||||
public ushort fade_level;
|
public ushort fade_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public struct SDL_HapticDirection
|
|
||||||
{
|
|
||||||
public byte type;
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=3)]
|
|
||||||
public int[] dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct SDL_HapticEffect
|
public struct SDL_HapticEffect
|
||||||
{
|
{
|
||||||
|
[FieldOffset(0)]
|
||||||
public ushort type;
|
public ushort type;
|
||||||
|
[FieldOffset(0)]
|
||||||
public SDL_HapticConstant constant;
|
public SDL_HapticConstant constant;
|
||||||
|
[FieldOffset(0)]
|
||||||
public SDL_HapticPeriodic periodic;
|
public SDL_HapticPeriodic periodic;
|
||||||
|
[FieldOffset(0)]
|
||||||
public SDL_HapticCondition condition;
|
public SDL_HapticCondition condition;
|
||||||
|
[FieldOffset(0)]
|
||||||
public SDL_HapticRamp ramp;
|
public SDL_HapticRamp ramp;
|
||||||
|
[FieldOffset(0)]
|
||||||
public SDL_HapticCustom custom;
|
public SDL_HapticCustom custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct SDL_HapticPeriodic
|
|
||||||
{
|
|
||||||
// Header
|
|
||||||
public ushort type;
|
|
||||||
public SDL_HapticDirection direction;
|
|
||||||
// Replay
|
|
||||||
public uint length;
|
|
||||||
public ushort delay;
|
|
||||||
// Trigger
|
|
||||||
public ushort button;
|
|
||||||
public ushort interval;
|
|
||||||
// Periodic
|
|
||||||
public ushort period;
|
|
||||||
public short magnitude;
|
|
||||||
public short offset;
|
|
||||||
public ushort phase;
|
|
||||||
// Envelope
|
|
||||||
public ushort attack_length;
|
|
||||||
public ushort attack_level;
|
|
||||||
public ushort fade_length;
|
|
||||||
public ushort fade_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct SDL_HapticRamp
|
|
||||||
{
|
|
||||||
// Header
|
|
||||||
public ushort type;
|
|
||||||
public SDL_HapticDirection direction;
|
|
||||||
// Replay
|
|
||||||
public uint length;
|
|
||||||
public ushort delay;
|
|
||||||
// Trigger
|
|
||||||
public ushort button;
|
|
||||||
public ushort interval;
|
|
||||||
// Ramp
|
|
||||||
public short start;
|
|
||||||
public short end;
|
|
||||||
// Envelope
|
|
||||||
public ushort attack_length;
|
|
||||||
public ushort attack_level;
|
|
||||||
public ushort fade_length;
|
|
||||||
public ushort fade_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* haptic refers to an SDL_Haptic* */
|
/* haptic refers to an SDL_Haptic* */
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SDL_HapticClose(IntPtr haptic);
|
public static extern void SDL_HapticClose(IntPtr haptic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user