mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-10 18:05:32 +00:00
[Input] Added IJoystickDriver2.GetGuid() API
This commit is contained in:
parent
cd143af60a
commit
b9a8e365de
|
@ -37,5 +37,6 @@ namespace OpenTK.Input
|
|||
{
|
||||
JoystickState GetState(int index);
|
||||
JoystickCapabilities GetCapabilities(int index);
|
||||
Guid GetGuid(int index);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,11 @@ namespace OpenTK.Input
|
|||
return implementation.GetState(index);
|
||||
}
|
||||
|
||||
internal static Guid GetGuid(int index)
|
||||
{
|
||||
return implementation.GetGuid(index);
|
||||
}
|
||||
|
||||
//public string GetName(int index)
|
||||
//{
|
||||
// return implementation.GetName(index);
|
||||
|
|
|
@ -381,6 +381,11 @@ namespace OpenTK.Platform.MacOS
|
|||
return new JoystickCapabilities();
|
||||
}
|
||||
|
||||
Guid IJoystickDriver2.GetGuid(int index)
|
||||
{
|
||||
return new Guid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NativeMethods
|
||||
|
|
|
@ -38,9 +38,10 @@ namespace OpenTK.Platform.SDL2
|
|||
readonly MappedGamePadDriver gamepad_driver = new MappedGamePadDriver();
|
||||
bool disposed;
|
||||
|
||||
struct Sdl2JoystickDetails
|
||||
class Sdl2JoystickDetails
|
||||
{
|
||||
public IntPtr Handle { get; set; }
|
||||
public Guid Guid { get; set; }
|
||||
public int HatCount { get; set; }
|
||||
public int BallCount { get; set; }
|
||||
public bool IsConnected { get; set; }
|
||||
|
@ -99,6 +100,7 @@ namespace OpenTK.Platform.SDL2
|
|||
joystick = new JoystickDevice<Sdl2JoystickDetails>(id, num_axes, num_buttons);
|
||||
joystick.Description = SDL.JoystickName(handle);
|
||||
joystick.Details.Handle = handle;
|
||||
joystick.Details.Guid = SDL.JoystickGetGUID(handle).ToGuid();
|
||||
joystick.Details.HatCount = num_hats;
|
||||
joystick.Details.BallCount = num_balls;
|
||||
|
||||
|
@ -606,6 +608,19 @@ namespace OpenTK.Platform.SDL2
|
|||
return new JoystickCapabilities();
|
||||
}
|
||||
|
||||
Guid IJoystickDriver2.GetGuid(int index)
|
||||
{
|
||||
Guid guid = new Guid();
|
||||
if (IsJoystickValid(index))
|
||||
{
|
||||
JoystickDevice<Sdl2JoystickDetails> joystick =
|
||||
(JoystickDevice<Sdl2JoystickDetails>)joysticks[index];
|
||||
|
||||
return joystick.Details.Guid;
|
||||
}
|
||||
return guid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
|
|
@ -333,6 +333,18 @@ namespace OpenTK.Platform.Windows
|
|||
return state;
|
||||
}
|
||||
|
||||
public Guid GetGuid(int index)
|
||||
{
|
||||
Guid guid = new Guid();
|
||||
|
||||
if (IsValid(index))
|
||||
{
|
||||
// Todo: implement WinMM Guid retrieval
|
||||
}
|
||||
|
||||
return guid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
|
|
@ -290,6 +290,11 @@ namespace OpenTK.Platform.X11
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Guid IJoystickDriver2.GetGuid(int index)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue