[Input] Added From* overloads with out parameters

This commit is contained in:
thefiddler 2014-09-17 18:15:05 +02:00
parent 2a6579032e
commit 2c26df8d93

View file

@ -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; }