mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-25 05:06:48 +00:00
[Input] Added From* overloads with out parameters
This commit is contained in:
parent
2a6579032e
commit
2c26df8d93
|
@ -115,6 +115,20 @@ namespace OpenTK.Platform
|
|||
}
|
||||
}
|
||||
|
||||
public bool FromIndex(int index, out T device)
|
||||
{
|
||||
if (index >= 0 && index < Devices.Count)
|
||||
{
|
||||
device = Devices[index];
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
device = default(T);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public T FromHardwareId(long id)
|
||||
{
|
||||
if (Map.ContainsKey(id))
|
||||
|
@ -127,6 +141,20 @@ namespace OpenTK.Platform
|
|||
}
|
||||
}
|
||||
|
||||
public bool FromHardwareId(long id, out T device)
|
||||
{
|
||||
if (Map.ContainsKey(id))
|
||||
{
|
||||
device = FromIndex(Map[id]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
device = default(T);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return Map.Count; }
|
||||
|
|
Loading…
Reference in a new issue