2007-07-27 03:37:12 +02:00
|
|
|
|
#region --- License ---
|
|
|
|
|
/* Copyright (c) 2007 Stefanos Apostolopoulos
|
|
|
|
|
* See license.txt for license info
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region --- Using directives ---
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
#endregion
|
2007-07-27 00:56:55 +02:00
|
|
|
|
|
|
|
|
|
namespace OpenTK.Input
|
|
|
|
|
{
|
|
|
|
|
public class Keyboard : IKeyboard
|
|
|
|
|
{
|
|
|
|
|
private IKeyboard keyboard;
|
|
|
|
|
|
2007-08-03 02:14:31 +02:00
|
|
|
|
#region --- Constructors ---
|
|
|
|
|
|
2007-07-27 00:56:55 +02:00
|
|
|
|
public Keyboard()
|
|
|
|
|
{
|
|
|
|
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
|
|
|
|
|
Environment.OSVersion.Platform == PlatformID.Win32Windows)
|
|
|
|
|
{
|
2007-07-27 03:20:55 +02:00
|
|
|
|
keyboard = new OpenTK.Platform.Windows.WinRawKeyboard();
|
2007-07-27 00:56:55 +02:00
|
|
|
|
}
|
|
|
|
|
else if (Environment.OSVersion.Platform == PlatformID.Unix ||
|
|
|
|
|
Environment.OSVersion.Platform == (PlatformID)128) // some older versions of Mono reported 128.
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new PlatformNotSupportedException(
|
|
|
|
|
"Your operating system is not currently supported. We are sorry for the inconvenience."
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-03 02:14:31 +02:00
|
|
|
|
#endregion
|
|
|
|
|
|
2007-07-27 03:20:55 +02:00
|
|
|
|
#region --- IKeyboard members ---
|
|
|
|
|
|
2007-07-27 00:56:55 +02:00
|
|
|
|
public bool this[Keys k]
|
|
|
|
|
{
|
|
|
|
|
get { return keyboard[k]; }
|
2007-07-31 23:50:29 +02:00
|
|
|
|
//set { keyboard[k] = value; }
|
2007-07-27 00:56:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
2007-07-27 03:20:55 +02:00
|
|
|
|
#endregion
|
2007-08-03 02:14:31 +02:00
|
|
|
|
|
|
|
|
|
#region --- IInputDevice Members ---
|
|
|
|
|
|
|
|
|
|
public string Description
|
|
|
|
|
{
|
|
|
|
|
get { return keyboard.Description; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InputDeviceType DeviceType
|
|
|
|
|
{
|
|
|
|
|
get { return keyboard.DeviceType; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2007-07-27 00:56:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-03 02:14:31 +02:00
|
|
|
|
#region public enum Keys : int
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The available keyboard keys.
|
|
|
|
|
/// </summary>
|
2007-07-27 00:56:55 +02:00
|
|
|
|
public enum Keys : int
|
|
|
|
|
{
|
|
|
|
|
// Modifiers
|
|
|
|
|
LeftShift = 0,
|
|
|
|
|
RightShift,
|
|
|
|
|
LeftControl,
|
|
|
|
|
RightControl,
|
|
|
|
|
LeftAlt,
|
|
|
|
|
RightAlt,
|
2007-08-03 02:14:31 +02:00
|
|
|
|
LeftApp,
|
|
|
|
|
RightApp,
|
|
|
|
|
Menu,
|
2007-07-27 00:56:55 +02:00
|
|
|
|
|
|
|
|
|
// Function keys (hopefully enough for most keyboards - mine has 26)
|
|
|
|
|
F1, F2, F3, F4,
|
|
|
|
|
F5, F6, F7, F8,
|
|
|
|
|
F9, F10, F11, F12,
|
|
|
|
|
F13, F14, F15, F16,
|
|
|
|
|
F17, F18, F19, F20,
|
|
|
|
|
F21, F22, F23, F24,
|
|
|
|
|
F25, F26, F27, F28,
|
|
|
|
|
F29, F30, F31, F32,
|
|
|
|
|
|
|
|
|
|
// Direction arrows
|
|
|
|
|
Up,
|
|
|
|
|
Down,
|
|
|
|
|
Left,
|
|
|
|
|
Right,
|
|
|
|
|
|
|
|
|
|
Enter,
|
|
|
|
|
Escape,
|
|
|
|
|
Space,
|
|
|
|
|
Tab,
|
|
|
|
|
Backspace,
|
|
|
|
|
Insert,
|
|
|
|
|
Delete,
|
|
|
|
|
PageUp,
|
|
|
|
|
PageDown,
|
|
|
|
|
Home,
|
|
|
|
|
End,
|
|
|
|
|
CapsLock,
|
2007-08-03 02:14:31 +02:00
|
|
|
|
PrintScreen,
|
|
|
|
|
Pause,
|
|
|
|
|
NumLock,
|
|
|
|
|
|
|
|
|
|
// Special keys
|
|
|
|
|
Sleep,
|
|
|
|
|
/*LogOff,
|
|
|
|
|
Help,
|
|
|
|
|
Undo,
|
|
|
|
|
Redo,
|
|
|
|
|
New,
|
|
|
|
|
Open,
|
|
|
|
|
Close,
|
|
|
|
|
Reply,
|
|
|
|
|
Forward,
|
|
|
|
|
Send,
|
|
|
|
|
Spell,
|
|
|
|
|
Save,
|
|
|
|
|
Calculator,
|
|
|
|
|
|
|
|
|
|
// Folders and applications
|
|
|
|
|
Documents,
|
|
|
|
|
Pictures,
|
|
|
|
|
Music,
|
|
|
|
|
MediaPlayer,
|
|
|
|
|
Mail,
|
|
|
|
|
Browser,
|
|
|
|
|
Messenger,
|
|
|
|
|
|
|
|
|
|
// Multimedia keys
|
|
|
|
|
Mute,
|
|
|
|
|
PlayPause,
|
|
|
|
|
Stop,
|
|
|
|
|
VolumeUp,
|
|
|
|
|
VOlumeDown,
|
|
|
|
|
PreviousTrack,
|
|
|
|
|
NextTrack,*/
|
2007-07-27 00:56:55 +02:00
|
|
|
|
|
|
|
|
|
// Keypad keys
|
|
|
|
|
Keypad0,
|
|
|
|
|
Keypad1,
|
|
|
|
|
Keypad2,
|
|
|
|
|
Keypad3,
|
|
|
|
|
Keypad4,
|
|
|
|
|
Keypad5,
|
|
|
|
|
Keypad6,
|
|
|
|
|
Keypad7,
|
|
|
|
|
Keypad8,
|
|
|
|
|
Keypad9,
|
|
|
|
|
KeypadDivide,
|
|
|
|
|
KeypadMultiply,
|
|
|
|
|
KeypadSubtract,
|
|
|
|
|
KeypadAdd,
|
|
|
|
|
KeypadDecimal,
|
2007-08-03 02:14:31 +02:00
|
|
|
|
//KeypadEnter,
|
2007-07-27 00:56:55 +02:00
|
|
|
|
|
|
|
|
|
// Letters
|
|
|
|
|
A, B, C, D, E, F, G,
|
|
|
|
|
H, I, J, K, L, M, N,
|
|
|
|
|
O, P, Q, R, S, T, U,
|
|
|
|
|
V, W, X, Y, Z,
|
|
|
|
|
|
|
|
|
|
// Numbers
|
|
|
|
|
Number0,
|
|
|
|
|
Number1,
|
|
|
|
|
Number2,
|
|
|
|
|
Number3,
|
|
|
|
|
Number4,
|
|
|
|
|
Number5,
|
|
|
|
|
Number6,
|
|
|
|
|
Number7,
|
|
|
|
|
Number8,
|
|
|
|
|
Number9,
|
|
|
|
|
|
|
|
|
|
// Symbols
|
2007-08-03 02:14:31 +02:00
|
|
|
|
Tilde,
|
2007-07-27 00:56:55 +02:00
|
|
|
|
Minus,
|
2007-08-03 02:14:31 +02:00
|
|
|
|
//Equal,
|
|
|
|
|
Plus,
|
2007-07-27 00:56:55 +02:00
|
|
|
|
LeftBracket,
|
|
|
|
|
RightBracket,
|
|
|
|
|
Semicolon,
|
2007-08-03 02:14:31 +02:00
|
|
|
|
Quote,
|
2007-07-27 00:56:55 +02:00
|
|
|
|
Comma,
|
2007-08-03 02:14:31 +02:00
|
|
|
|
Period,
|
2007-07-27 00:56:55 +02:00
|
|
|
|
Slash,
|
|
|
|
|
BackSlash,
|
|
|
|
|
|
|
|
|
|
MaxKeys
|
|
|
|
|
}
|
2007-08-03 02:14:31 +02:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|