nuclear@0: /************************************************************************************ nuclear@0: nuclear@0: PublicHeader: OVR_Kernel.h nuclear@0: Filename : OVR_KeyCodes.h nuclear@0: Content : Common keyboard constants nuclear@0: Created : September 19, 2012 nuclear@0: nuclear@0: Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. nuclear@0: nuclear@0: Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); nuclear@0: you may not use the Oculus VR Rift SDK except in compliance with the License, nuclear@0: which is provided at the time of installation or download, or which nuclear@0: otherwise accompanies this software in either electronic or hard copy form. nuclear@0: nuclear@0: You may obtain a copy of the License at nuclear@0: nuclear@0: http://www.oculusvr.com/licenses/LICENSE-3.2 nuclear@0: nuclear@0: Unless required by applicable law or agreed to in writing, the Oculus VR SDK nuclear@0: distributed under the License is distributed on an "AS IS" BASIS, nuclear@0: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. nuclear@0: See the License for the specific language governing permissions and nuclear@0: limitations under the License. nuclear@0: nuclear@0: ************************************************************************************/ nuclear@0: nuclear@0: #ifndef OVR_KeyCodes_h nuclear@0: #define OVR_KeyCodes_h nuclear@0: nuclear@0: namespace OVR { nuclear@0: nuclear@0: //----------------------------------------------------------------------------------- nuclear@0: // ***** KeyCode nuclear@0: nuclear@0: // KeyCode enumeration defines platform-independent keyboard key constants. nuclear@0: // Note that Key_A through Key_Z are mapped to capital ascii constants. nuclear@0: nuclear@0: enum KeyCode nuclear@0: { nuclear@0: // Key_None indicates that no key was specified. nuclear@0: Key_None = 0, nuclear@0: nuclear@0: // A through Z and numbers 0 through 9. nuclear@0: Key_A = 65, nuclear@0: Key_B, nuclear@0: Key_C, nuclear@0: Key_D, nuclear@0: Key_E, nuclear@0: Key_F, nuclear@0: Key_G, nuclear@0: Key_H, nuclear@0: Key_I, nuclear@0: Key_J, nuclear@0: Key_K, nuclear@0: Key_L, nuclear@0: Key_M, nuclear@0: Key_N, nuclear@0: Key_O, nuclear@0: Key_P, nuclear@0: Key_Q, nuclear@0: Key_R, nuclear@0: Key_S, nuclear@0: Key_T, nuclear@0: Key_U, nuclear@0: Key_V, nuclear@0: Key_W, nuclear@0: Key_X, nuclear@0: Key_Y, nuclear@0: Key_Z, nuclear@0: Key_Num0 = 48, nuclear@0: Key_Num1, nuclear@0: Key_Num2, nuclear@0: Key_Num3, nuclear@0: Key_Num4, nuclear@0: Key_Num5, nuclear@0: Key_Num6, nuclear@0: Key_Num7, nuclear@0: Key_Num8, nuclear@0: Key_Num9, nuclear@0: nuclear@0: // Numeric keypad. nuclear@0: Key_KP_0 = 0xa0, nuclear@0: Key_KP_1, nuclear@0: Key_KP_2, nuclear@0: Key_KP_3, nuclear@0: Key_KP_4, nuclear@0: Key_KP_5, nuclear@0: Key_KP_6, nuclear@0: Key_KP_7, nuclear@0: Key_KP_8, nuclear@0: Key_KP_9, nuclear@0: Key_KP_Multiply, nuclear@0: Key_KP_Add, nuclear@0: Key_KP_Enter, nuclear@0: Key_KP_Subtract, nuclear@0: Key_KP_Decimal, nuclear@0: Key_KP_Divide, nuclear@0: nuclear@0: // Function keys. nuclear@0: Key_F1 = 0xb0, nuclear@0: Key_F2, nuclear@0: Key_F3, nuclear@0: Key_F4, nuclear@0: Key_F5, nuclear@0: Key_F6, nuclear@0: Key_F7, nuclear@0: Key_F8, nuclear@0: Key_F9, nuclear@0: Key_F10, nuclear@0: Key_F11, nuclear@0: Key_F12, nuclear@0: Key_F13, nuclear@0: Key_F14, nuclear@0: Key_F15, nuclear@0: nuclear@0: // Other keys. nuclear@0: Key_Backspace = 8, nuclear@0: Key_Tab, nuclear@0: Key_Clear = 12, nuclear@0: Key_Return, nuclear@0: Key_Shift = 16, nuclear@0: Key_Control, nuclear@0: Key_Alt, nuclear@0: Key_Pause, nuclear@0: Key_CapsLock = 20, // Toggle nuclear@0: Key_Escape = 27, nuclear@0: Key_Space = 32, nuclear@0: Key_Quote = 39, nuclear@0: Key_PageUp = 0xc0, nuclear@0: Key_PageDown, nuclear@0: Key_End, nuclear@0: Key_Home, nuclear@0: Key_Left, nuclear@0: Key_Up, nuclear@0: Key_Right, nuclear@0: Key_Down, nuclear@0: Key_Insert, nuclear@0: Key_Delete, nuclear@0: Key_Help, nuclear@0: nuclear@0: Key_Comma = 44, nuclear@0: Key_Minus, nuclear@0: Key_Slash = 47, nuclear@0: Key_Period, nuclear@0: Key_NumLock = 144, // Toggle nuclear@0: Key_ScrollLock = 145, // Toggle nuclear@0: nuclear@0: Key_Semicolon = 59, nuclear@0: Key_Equal = 61, nuclear@0: Key_Backtick = 96, // ` and tilda~ when shifted (US keyboard) nuclear@0: Key_BracketLeft = 91, nuclear@0: Key_Backslash, nuclear@0: Key_BracketRight, nuclear@0: nuclear@0: Key_OEM_AX = 0xE1, // 'AX' key on Japanese AX keyboard nuclear@0: Key_OEM_102 = 0xE2, // "<>" or "\|" on RT 102-key keyboard. nuclear@0: Key_ICO_HELP = 0xE3, // Help key on ICO nuclear@0: Key_ICO_00 = 0xE4, // 00 key on ICO nuclear@0: nuclear@0: Key_Meta, nuclear@0: nuclear@0: // Total number of keys. nuclear@0: Key_CodeCount nuclear@0: }; nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------------- nuclear@0: nuclear@0: class KeyModifiers nuclear@0: { nuclear@0: public: nuclear@0: enum nuclear@0: { nuclear@0: Key_ShiftPressed = 0x01, nuclear@0: Key_CtrlPressed = 0x02, nuclear@0: Key_AltPressed = 0x04, nuclear@0: Key_MetaPressed = 0x08, nuclear@0: Key_CapsToggled = 0x10, nuclear@0: Key_NumToggled = 0x20, nuclear@0: Key_ScrollToggled = 0x40, nuclear@0: nuclear@0: Initialized_Bit = 0x80, nuclear@0: Initialized_Mask = 0xFF nuclear@0: }; nuclear@0: unsigned char States; nuclear@0: nuclear@0: KeyModifiers() : States(0) { } nuclear@0: KeyModifiers(unsigned char st) : States((unsigned char)(st | Initialized_Bit)) { } nuclear@0: nuclear@0: void Reset() { States = 0; } nuclear@0: nuclear@0: bool IsShiftPressed() const { return (States & Key_ShiftPressed) != 0; } nuclear@0: bool IsCtrlPressed() const { return (States & Key_CtrlPressed) != 0; } nuclear@0: bool IsAltPressed() const { return (States & Key_AltPressed) != 0; } nuclear@0: bool IsMetaPressed() const { return (States & Key_MetaPressed) != 0; } nuclear@0: bool IsCapsToggled() const { return (States & Key_CapsToggled) != 0; } nuclear@0: bool IsNumToggled() const { return (States & Key_NumToggled) != 0; } nuclear@0: bool IsScrollToggled() const{ return (States & Key_ScrollToggled) != 0; } nuclear@0: nuclear@0: void SetShiftPressed(bool v = true) { (v) ? States |= Key_ShiftPressed : States &= ~Key_ShiftPressed; } nuclear@0: void SetCtrlPressed(bool v = true) { (v) ? States |= Key_CtrlPressed : States &= ~Key_CtrlPressed; } nuclear@0: void SetAltPressed(bool v = true) { (v) ? States |= Key_AltPressed : States &= ~Key_AltPressed; } nuclear@0: void SetMetaPressed(bool v = true) { (v) ? States |= Key_MetaPressed : States &= ~Key_MetaPressed; } nuclear@0: void SetCapsToggled(bool v = true) { (v) ? States |= Key_CapsToggled : States &= ~Key_CapsToggled; } nuclear@0: void SetNumToggled(bool v = true) { (v) ? States |= Key_NumToggled : States &= ~Key_NumToggled; } nuclear@0: void SetScrollToggled(bool v = true) { (v) ? States |= Key_ScrollToggled: States &= ~Key_ScrollToggled; } nuclear@0: nuclear@0: bool IsInitialized() const { return (States & Initialized_Mask) != 0; } nuclear@0: }; nuclear@0: nuclear@0: nuclear@0: //----------------------------------------------------------------------------------- nuclear@0: nuclear@0: /* nuclear@0: enum PadKeyCode nuclear@0: { nuclear@0: Pad_None, // Indicates absence of key code. nuclear@0: Pad_Back, nuclear@0: Pad_Start, nuclear@0: Pad_A, nuclear@0: Pad_B, nuclear@0: Pad_X, nuclear@0: Pad_Y, nuclear@0: Pad_R1, // RightShoulder; nuclear@0: Pad_L1, // LeftShoulder; nuclear@0: Pad_R2, // RightTrigger; nuclear@0: Pad_L2, // LeftTrigger; nuclear@0: Pad_Up, nuclear@0: Pad_Down, nuclear@0: Pad_Right, nuclear@0: Pad_Left, nuclear@0: Pad_Plus, nuclear@0: Pad_Minus, nuclear@0: Pad_1, nuclear@0: Pad_2, nuclear@0: Pad_H, nuclear@0: Pad_C, nuclear@0: Pad_Z, nuclear@0: Pad_O, nuclear@0: Pad_T, nuclear@0: Pad_S, nuclear@0: Pad_Select, nuclear@0: Pad_Home, nuclear@0: Pad_RT, // RightThumb; nuclear@0: Pad_LT // LeftThumb; nuclear@0: }; nuclear@0: */ nuclear@0: nuclear@0: } // OVR nuclear@0: nuclear@0: #endif