mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 15:26:50 +00:00
[SDL2] Added JoystickGetGUID method
This commit is contained in:
parent
1687518ef5
commit
cd143af60a
|
@ -300,6 +300,10 @@ namespace OpenTK.Platform.SDL2
|
|||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickGetButton", ExactSpelling = true)]
|
||||
public static extern byte JoystickGetButton(IntPtr joystick, int button);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickGetGuid", ExactSpelling = true)]
|
||||
public static extern JoystickGuid JoystickGetGUID(IntPtr joystick);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_JoystickName", ExactSpelling = true)]
|
||||
static extern IntPtr JoystickNameInternal(IntPtr joystick);
|
||||
|
@ -1404,6 +1408,26 @@ namespace OpenTK.Platform.SDL2
|
|||
byte padding2;
|
||||
}
|
||||
|
||||
struct JoystickGuid
|
||||
{
|
||||
unsafe fixed byte data[16];
|
||||
|
||||
public Guid ToGuid()
|
||||
{
|
||||
byte[] bytes = new byte[16];
|
||||
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* pdata = data)
|
||||
{
|
||||
Marshal.Copy(new IntPtr(pdata), bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
|
||||
return new Guid(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
struct KeyboardEvent
|
||||
{
|
||||
public EventType Type;
|
||||
|
|
Loading…
Reference in a new issue