Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR_KeyCodes.h
Go to the documentation of this file.
1 /************************************************************************************
2 
3 PublicHeader: OVR.h
4 Filename : OVR_KeyCodes.h
5 Content : Common keyboard constants
6 Created : September 19, 2012
7 
8 Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
9 
10 Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
11 you may not use the Oculus VR Rift SDK except in compliance with the License,
12 which is provided at the time of installation or download, or which
13 otherwise accompanies this software in either electronic or hard copy form.
14 
15 You may obtain a copy of the License at
16 
17 http://www.oculusvr.com/licenses/LICENSE-3.1
18 
19 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
20 distributed under the License is distributed on an "AS IS" BASIS,
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 See the License for the specific language governing permissions and
23 limitations under the License.
24 
25 ************************************************************************************/
26 
27 #ifndef OVR_KeyCodes_h
28 #define OVR_KeyCodes_h
29 
30 namespace OVR {
31 
32 //-----------------------------------------------------------------------------------
33 // ***** KeyCode
34 
35 // KeyCode enumeration defines platform-independent keyboard key constants.
36 // Note that Key_A through Key_Z are mapped to capital ascii constants.
37 
38 enum KeyCode
39 {
40  // Key_None indicates that no key was specified.
41  Key_None = 0,
42 
43  // A through Z and numbers 0 through 9.
44  Key_A = 65,
70  Key_Num0 = 48,
80 
81  // Numeric keypad.
82  Key_KP_0 = 0xa0,
98 
99  // Function keys.
100  Key_F1 = 0xb0,
115 
116  // Other keys.
119  Key_Clear = 12,
121  Key_Shift = 16,
125  Key_CapsLock = 20, // Toggle
127  Key_Space = 32,
128  Key_Quote = 39,
129  Key_PageUp = 0xc0,
140 
141  Key_Comma = 44,
143  Key_Slash = 47,
145  Key_NumLock = 144, // Toggle
146  Key_ScrollLock = 145, // Toggle
147 
149  Key_Equal = 61,
150  Key_Backtick = 96, // ` and tilda~ when shifted (US keyboard)
154 
155  Key_OEM_AX = 0xE1, // 'AX' key on Japanese AX keyboard
156  Key_OEM_102 = 0xE2, // "<>" or "\|" on RT 102-key keyboard.
157  Key_ICO_HELP = 0xE3, // Help key on ICO
158  Key_ICO_00 = 0xE4, // 00 key on ICO
159 
161 
162  // Total number of keys.
164 };
165 
166 
167 //-----------------------------------------------------------------------------------
168 
170 {
171 public:
172  enum
173  {
181 
184  };
185  unsigned char States;
186 
187  KeyModifiers() : States(0) { }
188  KeyModifiers(unsigned char st) : States((unsigned char)(st | Initialized_Bit)) { }
189 
190  void Reset() { States = 0; }
191 
192  bool IsShiftPressed() const { return (States & Key_ShiftPressed) != 0; }
193  bool IsCtrlPressed() const { return (States & Key_CtrlPressed) != 0; }
194  bool IsAltPressed() const { return (States & Key_AltPressed) != 0; }
195  bool IsMetaPressed() const { return (States & Key_MetaPressed) != 0; }
196  bool IsCapsToggled() const { return (States & Key_CapsToggled) != 0; }
197  bool IsNumToggled() const { return (States & Key_NumToggled) != 0; }
198  bool IsScrollToggled() const{ return (States & Key_ScrollToggled) != 0; }
199 
200  void SetShiftPressed(bool v = true) { (v) ? States |= Key_ShiftPressed : States &= ~Key_ShiftPressed; }
201  void SetCtrlPressed(bool v = true) { (v) ? States |= Key_CtrlPressed : States &= ~Key_CtrlPressed; }
202  void SetAltPressed(bool v = true) { (v) ? States |= Key_AltPressed : States &= ~Key_AltPressed; }
203  void SetMetaPressed(bool v = true) { (v) ? States |= Key_MetaPressed : States &= ~Key_MetaPressed; }
204  void SetCapsToggled(bool v = true) { (v) ? States |= Key_CapsToggled : States &= ~Key_CapsToggled; }
205  void SetNumToggled(bool v = true) { (v) ? States |= Key_NumToggled : States &= ~Key_NumToggled; }
206  void SetScrollToggled(bool v = true) { (v) ? States |= Key_ScrollToggled: States &= ~Key_ScrollToggled; }
207 
208  bool IsInitialized() const { return (States & Initialized_Mask) != 0; }
209 };
210 
211 
212 //-----------------------------------------------------------------------------------
213 
214 /*
215 enum PadKeyCode
216 {
217  Pad_None, // Indicates absence of key code.
218  Pad_Back,
219  Pad_Start,
220  Pad_A,
221  Pad_B,
222  Pad_X,
223  Pad_Y,
224  Pad_R1, // RightShoulder;
225  Pad_L1, // LeftShoulder;
226  Pad_R2, // RightTrigger;
227  Pad_L2, // LeftTrigger;
228  Pad_Up,
229  Pad_Down,
230  Pad_Right,
231  Pad_Left,
232  Pad_Plus,
233  Pad_Minus,
234  Pad_1,
235  Pad_2,
236  Pad_H,
237  Pad_C,
238  Pad_Z,
239  Pad_O,
240  Pad_T,
241  Pad_S,
242  Pad_Select,
243  Pad_Home,
244  Pad_RT, // RightThumb;
245  Pad_LT // LeftThumb;
246 };
247 */
248 
249 } // OVR
250 
251 #endif
void SetShiftPressed(bool v=true)
Definition: OVR_KeyCodes.h:200
unsigned char States
Definition: OVR_KeyCodes.h:185
bool IsCtrlPressed() const
Definition: OVR_KeyCodes.h:193
void SetCapsToggled(bool v=true)
Definition: OVR_KeyCodes.h:204
bool IsAltPressed() const
Definition: OVR_KeyCodes.h:194
bool IsMetaPressed() const
Definition: OVR_KeyCodes.h:195
void SetNumToggled(bool v=true)
Definition: OVR_KeyCodes.h:205
void SetAltPressed(bool v=true)
Definition: OVR_KeyCodes.h:202
bool IsCapsToggled() const
Definition: OVR_KeyCodes.h:196
bool IsInitialized() const
Definition: OVR_KeyCodes.h:208
void SetCtrlPressed(bool v=true)
Definition: OVR_KeyCodes.h:201
bool IsShiftPressed() const
Definition: OVR_KeyCodes.h:192
void SetScrollToggled(bool v=true)
Definition: OVR_KeyCodes.h:206
bool IsScrollToggled() const
Definition: OVR_KeyCodes.h:198
void SetMetaPressed(bool v=true)
Definition: OVR_KeyCodes.h:203
KeyModifiers(unsigned char st)
Definition: OVR_KeyCodes.h:188
bool IsNumToggled() const
Definition: OVR_KeyCodes.h:197