[Input] Use Key.LastKey instead of Enum.GetValues

This avoids unnecessary memory allocations in the KeyboardDevice
constructor.
This commit is contained in:
thefiddler 2014-04-25 14:15:06 +02:00
parent 58e41a2b97
commit 3658fac263

View file

@ -21,7 +21,7 @@ namespace OpenTK.Input
public sealed class KeyboardDevice : IInputDevice public sealed class KeyboardDevice : IInputDevice
{ {
//private IKeyboard keyboard; //private IKeyboard keyboard;
private bool[] keys = new bool[Enum.GetValues(typeof(Key)).Length]; private bool[] keys = new bool[(int)Key.LastKey];
private bool[] scancodes = new bool[256]; private bool[] scancodes = new bool[256];
private string description; private string description;
private int numKeys, numFKeys, numLeds; private int numKeys, numFKeys, numLeds;