ovr_sdk

diff LibOVR/Src/Kernel/OVR_KeyCodes.h @ 0:1b39a1b46319

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