From 2c26df8d934de800f52fa9554092adcfa0cafa7a Mon Sep 17 00:00:00 2001 From: thefiddler Date: Wed, 17 Sep 2014 18:15:05 +0200 Subject: [PATCH] [Input] Added From* overloads with out parameters --- Source/OpenTK/Platform/DeviceCollection.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Source/OpenTK/Platform/DeviceCollection.cs b/Source/OpenTK/Platform/DeviceCollection.cs index 04ac101..804dac9 100644 --- a/Source/OpenTK/Platform/DeviceCollection.cs +++ b/Source/OpenTK/Platform/DeviceCollection.cs @@ -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; } -- 2.7.4