oculus1
diff libovr/Src/Kernel/OVR_KeyCodes.h @ 1:e2f9e4603129
added LibOVR and started a simple vr wrapper.
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 14 Sep 2013 16:14:59 +0300 |
parents | |
children | b069a5c27388 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libovr/Src/Kernel/OVR_KeyCodes.h Sat Sep 14 16:14:59 2013 +0300 1.3 @@ -0,0 +1,1 @@ 1.4 +/************************************************************************************ 1.5 1.6 PublicHeader: OVR.h 1.7 Filename : OVR_KeyCodes.h 1.8 Content : Common keyboard constants 1.9 Created : September 19, 2012 1.10 1.11 Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. 1.12 1.13 Use of this software is subject to the terms of the Oculus license 1.14 agreement provided at the time of installation or download, or which 1.15 otherwise accompanies this software in either electronic or hard copy form. 1.16 1.17 ************************************************************************************/ 1.18 1.19 #ifndef OVR_KeyCodes_h 1.20 #define OVR_KeyCodes_h 1.21 1.22 namespace OVR { 1.23 1.24 //----------------------------------------------------------------------------------- 1.25 // ***** KeyCode 1.26 1.27 // KeyCode enumeration defines platform-independent keyboard key constants. 1.28 // Note that Key_A through Key_Z are mapped to capital ascii constants. 1.29 1.30 enum KeyCode 1.31 { 1.32 // Key_None indicates that no key was specified. 1.33 Key_None = 0, 1.34 1.35 // A through Z and numbers 0 through 9. 1.36 Key_A = 65, 1.37 Key_B, 1.38 Key_C, 1.39 Key_D, 1.40 Key_E, 1.41 Key_F, 1.42 Key_G, 1.43 Key_H, 1.44 Key_I, 1.45 Key_J, 1.46 Key_K, 1.47 Key_L, 1.48 Key_M, 1.49 Key_N, 1.50 Key_O, 1.51 Key_P, 1.52 Key_Q, 1.53 Key_R, 1.54 Key_S, 1.55 Key_T, 1.56 Key_U, 1.57 Key_V, 1.58 Key_W, 1.59 Key_X, 1.60 Key_Y, 1.61 Key_Z, 1.62 Key_Num0 = 48, 1.63 Key_Num1, 1.64 Key_Num2, 1.65 Key_Num3, 1.66 Key_Num4, 1.67 Key_Num5, 1.68 Key_Num6, 1.69 Key_Num7, 1.70 Key_Num8, 1.71 Key_Num9, 1.72 1.73 // Numeric keypad. 1.74 Key_KP_0 = 0xa0, 1.75 Key_KP_1, 1.76 Key_KP_2, 1.77 Key_KP_3, 1.78 Key_KP_4, 1.79 Key_KP_5, 1.80 Key_KP_6, 1.81 Key_KP_7, 1.82 Key_KP_8, 1.83 Key_KP_9, 1.84 Key_KP_Multiply, 1.85 Key_KP_Add, 1.86 Key_KP_Enter, 1.87 Key_KP_Subtract, 1.88 Key_KP_Decimal, 1.89 Key_KP_Divide, 1.90 1.91 // Function keys. 1.92 Key_F1 = 0xb0, 1.93 Key_F2, 1.94 Key_F3, 1.95 Key_F4, 1.96 Key_F5, 1.97 Key_F6, 1.98 Key_F7, 1.99 Key_F8, 1.100 Key_F9, 1.101 Key_F10, 1.102 Key_F11, 1.103 Key_F12, 1.104 Key_F13, 1.105 Key_F14, 1.106 Key_F15, 1.107 1.108 // Other keys. 1.109 Key_Backspace = 8, 1.110 Key_Tab, 1.111 Key_Clear = 12, 1.112 Key_Return, 1.113 Key_Shift = 16, 1.114 Key_Control, 1.115 Key_Alt, 1.116 Key_Pause, 1.117 Key_CapsLock = 20, // Toggle 1.118 Key_Escape = 27, 1.119 Key_Space = 32, 1.120 Key_Quote = 39, 1.121 Key_PageUp = 0xc0, 1.122 Key_PageDown, 1.123 Key_End, 1.124 Key_Home, 1.125 Key_Left, 1.126 Key_Up, 1.127 Key_Right, 1.128 Key_Down, 1.129 Key_Insert, 1.130 Key_Delete, 1.131 Key_Help, 1.132 1.133 Key_Comma = 44, 1.134 Key_Minus, 1.135 Key_Slash = 47, 1.136 Key_Period, 1.137 Key_NumLock = 144, // Toggle 1.138 Key_ScrollLock = 145, // Toggle 1.139 1.140 Key_Semicolon = 59, 1.141 Key_Equal = 61, 1.142 Key_Bar = 192, 1.143 Key_BracketLeft = 91, 1.144 Key_Backslash, 1.145 Key_BracketRight, 1.146 1.147 Key_OEM_AX = 0xE1, // 'AX' key on Japanese AX keyboard 1.148 Key_OEM_102 = 0xE2, // "<>" or "\|" on RT 102-key keyboard. 1.149 Key_ICO_HELP = 0xE3, // Help key on ICO 1.150 Key_ICO_00 = 0xE4, // 00 key on ICO 1.151 1.152 Key_Meta, 1.153 1.154 // Total number of keys. 1.155 Key_CodeCount 1.156 }; 1.157 1.158 1.159 //----------------------------------------------------------------------------------- 1.160 1.161 class KeyModifiers 1.162 { 1.163 public: 1.164 enum 1.165 { 1.166 Key_ShiftPressed = 0x01, 1.167 Key_CtrlPressed = 0x02, 1.168 Key_AltPressed = 0x04, 1.169 Key_MetaPressed = 0x08, 1.170 Key_CapsToggled = 0x10, 1.171 Key_NumToggled = 0x20, 1.172 Key_ScrollToggled = 0x40, 1.173 1.174 Initialized_Bit = 0x80, 1.175 Initialized_Mask = 0xFF 1.176 }; 1.177 unsigned char States; 1.178 1.179 KeyModifiers() : States(0) { } 1.180 KeyModifiers(unsigned char st) : States((unsigned char)(st | Initialized_Bit)) { } 1.181 1.182 void Reset() { States = 0; } 1.183 1.184 bool IsShiftPressed() const { return (States & Key_ShiftPressed) != 0; } 1.185 bool IsCtrlPressed() const { return (States & Key_CtrlPressed) != 0; } 1.186 bool IsAltPressed() const { return (States & Key_AltPressed) != 0; } 1.187 bool IsMetaPressed() const { return (States & Key_MetaPressed) != 0; } 1.188 bool IsCapsToggled() const { return (States & Key_CapsToggled) != 0; } 1.189 bool IsNumToggled() const { return (States & Key_NumToggled) != 0; } 1.190 bool IsScrollToggled() const{ return (States & Key_ScrollToggled) != 0; } 1.191 1.192 void SetShiftPressed(bool v = true) { (v) ? States |= Key_ShiftPressed : States &= ~Key_ShiftPressed; } 1.193 void SetCtrlPressed(bool v = true) { (v) ? States |= Key_CtrlPressed : States &= ~Key_CtrlPressed; } 1.194 void SetAltPressed(bool v = true) { (v) ? States |= Key_AltPressed : States &= ~Key_AltPressed; } 1.195 void SetMetaPressed(bool v = true) { (v) ? States |= Key_MetaPressed : States &= ~Key_MetaPressed; } 1.196 void SetCapsToggled(bool v = true) { (v) ? States |= Key_CapsToggled : States &= ~Key_CapsToggled; } 1.197 void SetNumToggled(bool v = true) { (v) ? States |= Key_NumToggled : States &= ~Key_NumToggled; } 1.198 void SetScrollToggled(bool v = true) { (v) ? States |= Key_ScrollToggled: States &= ~Key_ScrollToggled; } 1.199 1.200 bool IsInitialized() const { return (States & Initialized_Mask) != 0; } 1.201 }; 1.202 1.203 1.204 //----------------------------------------------------------------------------------- 1.205 1.206 /* 1.207 enum PadKeyCode 1.208 { 1.209 Pad_None, // Indicates absence of key code. 1.210 Pad_Back, 1.211 Pad_Start, 1.212 Pad_A, 1.213 Pad_B, 1.214 Pad_X, 1.215 Pad_Y, 1.216 Pad_R1, // RightShoulder; 1.217 Pad_L1, // LeftShoulder; 1.218 Pad_R2, // RightTrigger; 1.219 Pad_L2, // LeftTrigger; 1.220 Pad_Up, 1.221 Pad_Down, 1.222 Pad_Right, 1.223 Pad_Left, 1.224 Pad_Plus, 1.225 Pad_Minus, 1.226 Pad_1, 1.227 Pad_2, 1.228 Pad_H, 1.229 Pad_C, 1.230 Pad_Z, 1.231 Pad_O, 1.232 Pad_T, 1.233 Pad_S, 1.234 Pad_Select, 1.235 Pad_Home, 1.236 Pad_RT, // RightThumb; 1.237 Pad_LT // LeftThumb; 1.238 }; 1.239 */ 1.240 1.241 } // OVR 1.242 1.243 #endif 1.244 \ No newline at end of file