mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-09-14 06:57:20 +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)
|
public T FromHardwareId(long id)
|
||||||
{
|
{
|
||||||
if (Map.ContainsKey(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
|
public int Count
|
||||||
{
|
{
|
||||||
get { return Map.Count; }
|
get { return Map.Count; }
|
||||||
|
|
Loading…
Reference in a new issue