Removed Key.None and Key.MaxKeys.

Added XML documentation to all OpenTK.Input.Key tokens.
Added typical Key names found in Windows.Forms and XNA: LControl, RControl, ...
This commit is contained in:
the_fiddler 2009-06-28 10:27:17 +00:00
parent 70f68a302f
commit 09a24a17d7

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[(int)Key.MaxKeys]; private bool[] keys = new bool[Enum.GetValues(typeof(Key)).Length];
private string description; private string description;
private int numKeys, numFKeys, numLeds; private int numKeys, numFKeys, numLeds;
private IntPtr devID; private IntPtr devID;
@ -183,7 +183,7 @@ namespace OpenTK.Input
internal void ClearKeys() internal void ClearKeys()
{ {
for (int i = 0; i < (int)Key.MaxKeys; i++) for (int i = 0; i < keys.Length; i++)
if (this[(Key)i]) // Make sure KeyUp events are *not* raised for keys that are up, even if key repeat is on. if (this[(Key)i]) // Make sure KeyUp events are *not* raised for keys that are up, even if key repeat is on.
this[(Key)i] = false; this[(Key)i] = false;
} }
@ -203,56 +203,167 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public enum Key : int public enum Key : int
{ {
None = 0, /// <summary>A key outside the known keys.</summary>
Unknown = 0,
// Modifiers // Modifiers
/// <summary>The left shift key.</summary>
ShiftLeft, ShiftLeft,
/// <summary>The left shift key (equivalent to ShiftLeft).</summary>
LShift = ShiftLeft,
/// <summary>The right shift key.</summary>
ShiftRight, ShiftRight,
/// <summary>The right shift key (equivalent to ShiftRight).</summary>
RShift = ShiftRight,
/// <summary>The left control key.</summary>
ControlLeft, ControlLeft,
/// <summary>The left control key (equivalent to ControlLeft).</summary>
LControl = ControlLeft,
/// <summary>The right control key.</summary>
ControlRight, ControlRight,
/// <summary>The right control key (equivalent to ControlRight).</summary>
RControl = ControlRight,
/// <summary>The left alt key.</summary>
AltLeft, AltLeft,
/// <summary>The left alt key (equivalent to AltLeft.</summary>
LAlt = AltLeft,
/// <summary>The right alt key.</summary>
AltRight, AltRight,
/// <summary>The right alt key (equivalent to AltRight).</summary>
RAlt = AltRight,
/// <summary>The left win key.</summary>
WinLeft, WinLeft,
/// <summary>The left win key (equivalent to WinLeft).</summary>
LWin = WinLeft,
/// <summary>The right win key.</summary>
WinRight, WinRight,
/// <summary>The right win key (equivalent to WinRight).</summary>
RWin = WinRight,
/// <summary>The menu key.</summary>
Menu, Menu,
// Function keys (hopefully enough for most keyboards - mine has 26) // Function keys (hopefully enough for most keyboards - mine has 26)
// <keysymdef.h> on X11 reports up to 35 function keys. // <keysymdef.h> on X11 reports up to 35 function keys.
F1, F2, F3, F4, /// <summary>The F1 key.</summary>
F5, F6, F7, F8, F1,
F9, F10, F11, F12, /// <summary>The F2 key.</summary>
F13, F14, F15, F16, F2,
F17, F18, F19, F20, /// <summary>The F3 key.</summary>
F21, F22, F23, F24, F3,
F25, F26, F27, F28, /// <summary>The F4 key.</summary>
F29, F30, F31, F32, F4,
F33, F34, F35, /// <summary>The F5 key.</summary>
F5,
/// <summary>The F6 key.</summary>
F6,
/// <summary>The F7 key.</summary>
F7,
/// <summary>The F8 key.</summary>
F8,
/// <summary>The F9 key.</summary>
F9,
/// <summary>The F10 key.</summary>
F10,
/// <summary>The F11 key.</summary>
F11,
/// <summary>The F12 key.</summary>
F12,
/// <summary>The F13 key.</summary>
F13,
/// <summary>The F14 key.</summary>
F14,
/// <summary>The F15 key.</summary>
F15,
/// <summary>The F16 key.</summary>
F16,
/// <summary>The F17 key.</summary>
F17,
/// <summary>The F18 key.</summary>
F18,
/// <summary>The F19 key.</summary>
F19,
/// <summary>The F20 key.</summary>
F20,
/// <summary>The F21 key.</summary>
F21,
/// <summary>The F22 key.</summary>
F22,
/// <summary>The F23 key.</summary>
F23,
/// <summary>The F24 key.</summary>
F24,
/// <summary>The F25 key.</summary>
F25,
/// <summary>The F26 key.</summary>
F26,
/// <summary>The F27 key.</summary>
F27,
/// <summary>The F28 key.</summary>
F28,
/// <summary>The F29 key.</summary>
F29,
/// <summary>The F30 key.</summary>
F30,
/// <summary>The F31 key.</summary>
F31,
/// <summary>The F32 key.</summary>
F32,
/// <summary>The F33 key.</summary>
F33,
/// <summary>The F34 key.</summary>
F34,
/// <summary>The F35 key.</summary>
F35,
// Direction arrows // Direction arrows
/// <summary>The up arrow key.</summary>
Up, Up,
/// <summary>The down arrow key.</summary>
Down, Down,
/// <summary>The left arrow key.</summary>
Left, Left,
/// <summary>The right arrow key.</summary>
Right, Right,
/// <summary>The enter key.</summary>
Enter, Enter,
/// <summary>The escape key.</summary>
Escape, Escape,
/// <summary>The space key.</summary>
Space, Space,
/// <summary>The tab key.</summary>
Tab, Tab,
/// <summary>The backspace key.</summary>
BackSpace, BackSpace,
/// <summary>The backspace key (equivalent to BackSpace).</summary>
Back = BackSpace,
/// <summary>The insert key.</summary>
Insert, Insert,
/// <summary>The delete key.</summary>
Delete, Delete,
/// <summary>The page up key.</summary>
PageUp, PageUp,
/// <summary>The page down key.</summary>
PageDown, PageDown,
/// <summary>The home key.</summary>
Home, Home,
/// <summary>The end key.</summary>
End, End,
/// <summary>The caps lock key.</summary>
CapsLock, CapsLock,
/// <summary>The scroll lock key.</summary>
ScrollLock, ScrollLock,
/// <summary>The print screen key.</summary>
PrintScreen, PrintScreen,
/// <summary>The pause key.</summary>
Pause, Pause,
/// <summary>The num lock key.</summary>
NumLock, NumLock,
// Special keys // Special keys
Clear, // Keypad5 with NumLock off. /// <summary>The clear key (Keypad5 with NumLock disabled, on typical keyboards).</summary>
Clear,
/// <summary>The sleep key.</summary>
Sleep, Sleep,
/*LogOff, /*LogOff,
Help, Help,
@ -287,56 +398,147 @@ namespace OpenTK.Input
TrackNext,*/ TrackNext,*/
// Keypad keys // Keypad keys
/// <summary>The keypad 0 key.</summary>
Keypad0, Keypad0,
/// <summary>The keypad 1 key.</summary>
Keypad1, Keypad1,
/// <summary>The keypad 2 key.</summary>
Keypad2, Keypad2,
/// <summary>The keypad 3 key.</summary>
Keypad3, Keypad3,
/// <summary>The keypad 4 key.</summary>
Keypad4, Keypad4,
/// <summary>The keypad 5 key.</summary>
Keypad5, Keypad5,
/// <summary>The keypad 6 key.</summary>
Keypad6, Keypad6,
/// <summary>The keypad 7 key.</summary>
Keypad7, Keypad7,
/// <summary>The keypad 8 key.</summary>
Keypad8, Keypad8,
/// <summary>The keypad 9 key.</summary>
Keypad9, Keypad9,
/// <summary>The keypad divide key.</summary>
KeypadDivide, KeypadDivide,
/// <summary>The keypad multiply key.</summary>
KeypadMultiply, KeypadMultiply,
/// <summary>The keypad subtract key.</summary>
KeypadSubtract, KeypadSubtract,
/// <summary>The keypad minus key (equivalent to KeypadSubtract).</summary>
KeypadMinus = KeypadSubtract,
/// <summary>The keypad add key.</summary>
KeypadAdd, KeypadAdd,
/// <summary>The keypad plus key (equivalent to KeypadAdd).</summary>
KeypadPlus = KeypadAdd,
/// <summary>The keypad decimal key.</summary>
KeypadDecimal, KeypadDecimal,
/// <summary>The keypad enter key.</summary>
KeypadEnter, KeypadEnter,
// Letters // Letters
A, B, C, D, E, F, G, /// <summary>The A key.</summary>
H, I, J, K, L, M, N, A,
O, P, Q, R, S, T, U, /// <summary>The B key.</summary>
V, W, X, Y, Z, B,
/// <summary>The C key.</summary>
C,
/// <summary>The D key.</summary>
D,
/// <summary>The E key.</summary>
E,
/// <summary>The F key.</summary>
F,
/// <summary>The G key.</summary>
G,
/// <summary>The H key.</summary>
H,
/// <summary>The I key.</summary>
I,
/// <summary>The J key.</summary>
J,
/// <summary>The K key.</summary>
K,
/// <summary>The L key.</summary>
L,
/// <summary>The M key.</summary>
M,
/// <summary>The N key.</summary>
N,
/// <summary>The O key.</summary>
O,
/// <summary>The P key.</summary>
P,
/// <summary>The Q key.</summary>
Q,
/// <summary>The R key.</summary>
R,
/// <summary>The S key.</summary>
S,
/// <summary>The T key.</summary>
T,
/// <summary>The U key.</summary>
U,
/// <summary>The V key.</summary>
V,
/// <summary>The W key.</summary>
W,
/// <summary>The X key.</summary>
X,
/// <summary>The Y key.</summary>
Y,
/// <summary>The Z key.</summary>
Z,
// Numbers // Numbers
/// <summary>The number 0 key.</summary>
Number0, Number0,
/// <summary>The number 1 key.</summary>
Number1, Number1,
/// <summary>The number 2 key.</summary>
Number2, Number2,
/// <summary>The number 3 key.</summary>
Number3, Number3,
/// <summary>The number 4 key.</summary>
Number4, Number4,
/// <summary>The number 5 key.</summary>
Number5, Number5,
/// <summary>The number 6 key.</summary>
Number6, Number6,
/// <summary>The number 7 key.</summary>
Number7, Number7,
/// <summary>The number 8 key.</summary>
Number8, Number8,
/// <summary>The number 9 key.</summary>
Number9, Number9,
// Symbols // Symbols
/// <summary>The tilde key.</summary>
Tilde, Tilde,
/// <summary>The minus key.</summary>
Minus, Minus,
//Equal, //Equal,
/// <summary>The plus key.</summary>
Plus, Plus,
/// <summary>The left bracket key.</summary>
BracketLeft, BracketLeft,
/// <summary>The left bracket key (equivalent to BracketLeft).</summary>
LBracket = BracketLeft,
/// <summary>The right bracket key.</summary>
BracketRight, BracketRight,
/// <summary>The right bracket key (equivalent to BracketRight).</summary>
RBracket = BracketRight,
/// <summary>The semicolon key.</summary>
Semicolon, Semicolon,
/// <summary>The quote key.</summary>
Quote, Quote,
/// <summary>The comma key.</summary>
Comma, Comma,
/// <summary>The period key.</summary>
Period, Period,
/// <summary>The slash key.</summary>
Slash, Slash,
/// <summary>The backslash key.</summary>
BackSlash, BackSlash,
MaxKeys
} }
#endregion #endregion