00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef OVR_KeyCodes_h
00017 #define OVR_KeyCodes_h
00018
00019 namespace OVR {
00020
00021
00022
00023
00024
00025
00026
00027 enum KeyCode
00028 {
00029
00030 Key_None = 0,
00031
00032
00033 Key_A = 65,
00034 Key_B,
00035 Key_C,
00036 Key_D,
00037 Key_E,
00038 Key_F,
00039 Key_G,
00040 Key_H,
00041 Key_I,
00042 Key_J,
00043 Key_K,
00044 Key_L,
00045 Key_M,
00046 Key_N,
00047 Key_O,
00048 Key_P,
00049 Key_Q,
00050 Key_R,
00051 Key_S,
00052 Key_T,
00053 Key_U,
00054 Key_V,
00055 Key_W,
00056 Key_X,
00057 Key_Y,
00058 Key_Z,
00059 Key_Num0 = 48,
00060 Key_Num1,
00061 Key_Num2,
00062 Key_Num3,
00063 Key_Num4,
00064 Key_Num5,
00065 Key_Num6,
00066 Key_Num7,
00067 Key_Num8,
00068 Key_Num9,
00069
00070
00071 Key_KP_0 = 0xa0,
00072 Key_KP_1,
00073 Key_KP_2,
00074 Key_KP_3,
00075 Key_KP_4,
00076 Key_KP_5,
00077 Key_KP_6,
00078 Key_KP_7,
00079 Key_KP_8,
00080 Key_KP_9,
00081 Key_KP_Multiply,
00082 Key_KP_Add,
00083 Key_KP_Enter,
00084 Key_KP_Subtract,
00085 Key_KP_Decimal,
00086 Key_KP_Divide,
00087
00088
00089 Key_F1 = 0xb0,
00090 Key_F2,
00091 Key_F3,
00092 Key_F4,
00093 Key_F5,
00094 Key_F6,
00095 Key_F7,
00096 Key_F8,
00097 Key_F9,
00098 Key_F10,
00099 Key_F11,
00100 Key_F12,
00101 Key_F13,
00102 Key_F14,
00103 Key_F15,
00104
00105
00106 Key_Backspace = 8,
00107 Key_Tab,
00108 Key_Clear = 12,
00109 Key_Return,
00110 Key_Shift = 16,
00111 Key_Control,
00112 Key_Alt,
00113 Key_Pause,
00114 Key_CapsLock = 20,
00115 Key_Escape = 27,
00116 Key_Space = 32,
00117 Key_Quote = 39,
00118 Key_PageUp = 0xc0,
00119 Key_PageDown,
00120 Key_End,
00121 Key_Home,
00122 Key_Left,
00123 Key_Up,
00124 Key_Right,
00125 Key_Down,
00126 Key_Insert,
00127 Key_Delete,
00128 Key_Help,
00129
00130 Key_Comma = 44,
00131 Key_Minus,
00132 Key_Slash = 47,
00133 Key_Period,
00134 Key_NumLock = 144,
00135 Key_ScrollLock = 145,
00136
00137 Key_Semicolon = 59,
00138 Key_Equal = 61,
00139 Key_Bar = 192,
00140 Key_BracketLeft = 91,
00141 Key_Backslash,
00142 Key_BracketRight,
00143
00144 Key_OEM_AX = 0xE1,
00145 Key_OEM_102 = 0xE2,
00146 Key_ICO_HELP = 0xE3,
00147 Key_ICO_00 = 0xE4,
00148
00149 Key_Meta,
00150
00151
00152 Key_CodeCount
00153 };
00154
00155
00156
00157
00158 class KeyModifiers
00159 {
00160 public:
00161 enum
00162 {
00163 Key_ShiftPressed = 0x01,
00164 Key_CtrlPressed = 0x02,
00165 Key_AltPressed = 0x04,
00166 Key_MetaPressed = 0x08,
00167 Key_CapsToggled = 0x10,
00168 Key_NumToggled = 0x20,
00169 Key_ScrollToggled = 0x40,
00170
00171 Initialized_Bit = 0x80,
00172 Initialized_Mask = 0xFF
00173 };
00174 unsigned char States;
00175
00176 KeyModifiers() : States(0) { }
00177 KeyModifiers(unsigned char st) : States((unsigned char)(st | Initialized_Bit)) { }
00178
00179 void Reset() { States = 0; }
00180
00181 bool IsShiftPressed() const { return (States & Key_ShiftPressed) != 0; }
00182 bool IsCtrlPressed() const { return (States & Key_CtrlPressed) != 0; }
00183 bool IsAltPressed() const { return (States & Key_AltPressed) != 0; }
00184 bool IsMetaPressed() const { return (States & Key_MetaPressed) != 0; }
00185 bool IsCapsToggled() const { return (States & Key_CapsToggled) != 0; }
00186 bool IsNumToggled() const { return (States & Key_NumToggled) != 0; }
00187 bool IsScrollToggled() const{ return (States & Key_ScrollToggled) != 0; }
00188
00189 void SetShiftPressed(bool v = true) { (v) ? States |= Key_ShiftPressed : States &= ~Key_ShiftPressed; }
00190 void SetCtrlPressed(bool v = true) { (v) ? States |= Key_CtrlPressed : States &= ~Key_CtrlPressed; }
00191 void SetAltPressed(bool v = true) { (v) ? States |= Key_AltPressed : States &= ~Key_AltPressed; }
00192 void SetMetaPressed(bool v = true) { (v) ? States |= Key_MetaPressed : States &= ~Key_MetaPressed; }
00193 void SetCapsToggled(bool v = true) { (v) ? States |= Key_CapsToggled : States &= ~Key_CapsToggled; }
00194 void SetNumToggled(bool v = true) { (v) ? States |= Key_NumToggled : States &= ~Key_NumToggled; }
00195 void SetScrollToggled(bool v = true) { (v) ? States |= Key_ScrollToggled: States &= ~Key_ScrollToggled; }
00196
00197 bool IsInitialized() const { return (States & Initialized_Mask) != 0; }
00198 };
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 }
00239
00240 #endif