.. _stdlib_input_consts: ============ Input consts ============ This module contains key codes for constants used to handle input states from buttons on the keyboard and gamepad (Xbox controller). There is also a type, `KeyboardShifts`, for uniform processing of duplicate keys such as SHIFT, CTRL, and ALT. To add this module to your project, add the following line to your project file:: require engine.input_core // or require engine.core ++++++++++++ Type aliases ++++++++++++ .. _alias-GamepadButton: .. das:attribute:: bitfield GamepadButton Button codes for gamepad (Xbox) controller :Fields: * **Up** (0x1) - ``Up`` on Xbox controller * **Down** (0x2) - ``Down`` on Xbox controller * **Left** (0x4) - ``Left`` on Xbox controller * **Right** (0x8) - ``Right`` on Xbox controller * **Start** (0x10) - ``Start`` on Xbox controller, hidden for engine use, do not bind actions to this button * **Back** (0x20) - ``Back`` on Xbox controller * **L3** (0x40) - ``L3`` (``LSB`` or ``Left Stick``) on Xbox controller * **R3** (0x80) - ``R3`` (``RSB`` or ``Right Stick``) on Xbox controller * **LeftBumper** (0x100) - ``LB`` on Xbox controller * **RightBumper** (0x200) - ``RB`` on Xbox controller * **RESERVED1** (0x400) - unused placeholder * **RESERVED2** (0x800) - unused placeholder * **A** (0x1000) - ``A`` on Xbox controller * **B** (0x2000) - ``B`` on Xbox controller * **X** (0x4000) - ``X`` on Xbox controller * **Y** (0x8000) - ``Y`` on Xbox controller * **LeftTrigger** (0x10000) - ``LT`` (or ``Left Trigger``) on Xbox controller * **RightTrigger** (0x20000) - ``RT`` (or ``Right Trigger``) on Xbox controller .. _alias-KeyboardShifts: .. das:attribute:: bitfield KeyboardShifts : uint8 Raw keyboard shift states :Fields: * **LShift** (0x1) - Left shift * **RShift** (0x2) - Right shift * **LCtrl** (0x4) - Left control * **RCtrl** (0x8) - Right control * **LAlt** (0x10) - Left alt * **RAlt** (0x20) - Right alt * **Shift** (0x3) - Left or right shift * **Ctrl** (0xc) - Left or right control * **Alt** (0x30) - Left or right alt ++++++++++++ Enumerations ++++++++++++ .. _enum-input_consts-ControllerIndex: .. das:attribute:: ControllerIndex Indices of gamepad controllers :Values: * **Device0** = 0x0u8 - First controller * **Device1** = 0x1u8 - Second controller * **Device2** = 0x2u8 - Third controller * **Device3** = 0x3u8 - Fourth controller * **Device4** = 0x4u8 - Fifth controller * **Device5** = 0x5u8 - Sixth controller * **Device6** = 0x6u8 - Seventh controller * **Device7** = 0x7u8 - Eighth controller .. _enum-input_consts-KeyCode: .. das:attribute:: KeyCode Virtual key codes for keyboard buttons :Values: * **Escape** = 0x1u8 - ``Escape`` key, hidden for engine use, do not bind actions to this key * **_1** = 0x2u8 - ``1`` on main keyboard * **_2** = 0x3u8 - ``2`` on main keyboard * **_3** = 0x4u8 - ``3`` on main keyboard * **_4** = 0x5u8 - ``4`` on main keyboard * **_5** = 0x6u8 - ``5`` on main keyboard * **_6** = 0x7u8 - ``6`` on main keyboard * **_7** = 0x8u8 - ``7`` on main keyboard * **_8** = 0x9u8 - ``8`` on main keyboard * **_9** = 0xau8 - ``9`` on main keyboard * **_0** = 0xbu8 - ``0`` on main keyboard * **Minus** = 0xcu8 - ``-`` on main keyboard * **Equals** = 0xdu8 - ``=`` on main keyboard * **Back** = 0xeu8 - ``backspace`` * **Tab** = 0xfu8 - ``tab`` * **Q** = 0x10u8 - ``Q`` * **W** = 0x11u8 - ``W`` * **E** = 0x12u8 - ``E`` * **R** = 0x13u8 - ``R`` * **T** = 0x14u8 - ``T`` * **Y** = 0x15u8 - ``Y`` * **U** = 0x16u8 - ``U`` * **I** = 0x17u8 - ``I`` * **O** = 0x18u8 - ``O`` * **P** = 0x19u8 - ``P`` * **LBracket** = 0x1au8 - ``[`` * **RBracket** = 0x1bu8 - ``]`` * **Return** = 0x1cu8 - ``Enter`` on main keyboard * **LControl** = 0x1du8 - ``Left Control`` * **A** = 0x1eu8 - ``A`` * **S** = 0x1fu8 - ``S`` * **D** = 0x20u8 - ``D`` * **F** = 0x21u8 - ``F`` * **G** = 0x22u8 - ``G`` * **H** = 0x23u8 - ``H`` * **J** = 0x24u8 - ``J`` * **K** = 0x25u8 - ``K`` * **L** = 0x26u8 - ``L`` * **Semicolon** = 0x27u8 - ``;`` * **Apostrophe** = 0x28u8 - ``'`` * **Grave** = 0x29u8 - ````` accent grave * **LShift** = 0x2au8 - ``Left Shift`` * **Backslash** = 0x2bu8 - ``\`` on main keyboard * **Z** = 0x2cu8 - ``Z`` * **X** = 0x2du8 - ``X`` * **C** = 0x2eu8 - ``C`` * **V** = 0x2fu8 - ``V`` * **B** = 0x30u8 - ``B`` * **N** = 0x31u8 - ``N`` * **M** = 0x32u8 - ``M`` * **Comma** = 0x33u8 - ``,`` on main keyboard * **Period** = 0x34u8 - ``.`` on main keyboard * **Slash** = 0x35u8 - ``/`` on main keyboard * **Rshift** = 0x36u8 - ``Right Shift`` * **Multiply** = 0x37u8 - ``*`` on numeric keypad * **LAlt** = 0x38u8 - ``Left Alt`` * **Space** = 0x39u8 - ``Spacebar`` * **Capital** = 0x3au8 - ``Caps Lock`` * **F1** = 0x3bu8 - ``F1`` * **F2** = 0x3cu8 - ``F2`` * **F3** = 0x3du8 - ``F3`` * **F4** = 0x3eu8 - ``F4`` * **F5** = 0x3fu8 - ``F5`` * **F6** = 0x40u8 - ``F6`` * **F7** = 0x41u8 - ``F7`` * **F8** = 0x42u8 - ``F8`` * **F9** = 0x43u8 - ``F9`` * **F10** = 0x44u8 - ``F10`` * **Numlock** = 0x45u8 - ``Num Lock`` * **Scroll** = 0x46u8 - ``Scroll Lock`` * **Numpad7** = 0x47u8 - ``7`` on numeric keypad * **Numpad8** = 0x48u8 - ``8`` on numeric keypad * **Numpad9** = 0x49u8 - ``9`` on numeric keypad * **Subtract** = 0x4au8 - ``-`` on numeric keypad * **Numpad4** = 0x4bu8 - ``4`` on numeric keypad * **Numpad5** = 0x4cu8 - ``5`` on numeric keypad * **Numpad6** = 0x4du8 - ``6`` on numeric keypad * **Add** = 0x4eu8 - ``+`` on numeric keypad * **Numpad1** = 0x4fu8 - ``1`` on numeric keypad * **Numpad2** = 0x50u8 - ``2`` on numeric keypad * **Numpad3** = 0x51u8 - ``3`` on numeric keypad * **Numpad0** = 0x52u8 - ``0`` on numeric keypad * **Decimal** = 0x53u8 - ``.`` on numeric keypad * **Oem102** = 0x56u8 - ``<>`` or ``\|`` on RT 102-key keyboard (Non-U.S.) * **F11** = 0x57u8 - ``F11`` * **F12** = 0x58u8 - ``F12`` * **F13** = 0x64u8 - ``F13`` (NEC PC98) * **F14** = 0x65u8 - ``F14`` (NEC PC98) * **F15** = 0x66u8 - ``F15`` (NEC PC98) * **KANA** = 0x70u8 - (Japanese keyboard) * **ABNT_C1** = 0x73u8 - ``/?`` on Brazilian keyboard * **CONVERT** = 0x79u8 - (Japanese keyboard) * **NOCONVERT** = 0x7bu8 - (Japanese keyboard) * **YEN** = 0x7du8 - (Japanese keyboard) * **ABNT_C2** = 0x7eu8 - ``Numpad .`` on Brazilian keyboard * **NumpadEquals** = 0x8du8 - ``=`` on numeric keypad (NEC PC98) * **PrevTrack** = 0x90u8 - ``Previous Track`` (DIK_CIRCUMFLEX on Japanese keyboard) * **At** = 0x91u8 - (NEC PC98) * **Colon** = 0x92u8 - (NEC PC98) * **Underline** = 0x93u8 - (NEC PC98) * **Kanji** = 0x94u8 - (Japanese keyboard) * **Stop** = 0x95u8 - (NEC PC98) * **Ax** = 0x96u8 - (Japan AX) * **Unlabeled** = 0x97u8 - (J3100) * **NextTrack** = 0x99u8 - ``Next Track`` * **NumpadEnter** = 0x9cu8 - ``Enter`` on numeric keypad * **RControl** = 0x9du8 - ``Right Control`` * **Mute** = 0xa0u8 - ``Mute`` * **Calculator** = 0xa1u8 - ``Calculator`` * **PlayPause** = 0xa2u8 - ``Play / Pause`` * **MediaStop** = 0xa4u8 - ``Media Stop`` * **VolumeDown** = 0xaeu8 - ``Volume -`` * **VolumeUp** = 0xb0u8 - ``Volume +`` * **Webhome** = 0xb2u8 - ``Web home`` * **NumpadComma** = 0xb3u8 - ``,`` on numeric keypad (NEC PC98) * **Divide** = 0xb5u8 - ``/`` on numeric keypad * **Print** = 0xb7u8 - ``System Request / Print Screen`` * **RAlt** = 0xb8u8 - ``Right Alt`` * **Pause** = 0xc5u8 - ``Pause`` * **Home** = 0xc7u8 - ``Home`` on arrow keypad * **Up** = 0xc8u8 - ``UpArrow`` on arrow keypad * **Prior** = 0xc9u8 - ``PgUp`` on arrow keypad * **Left** = 0xcbu8 - ``LeftArrow`` on arrow keypad * **Right** = 0xcdu8 - ``RightArrow`` on arrow keypad * **End** = 0xcfu8 - ``End`` on arrow keypad * **Down** = 0xd0u8 - ``DownArrow`` on arrow keypad * **Next** = 0xd1u8 - ``PgDn`` on arrow keypad * **Insert** = 0xd2u8 - ``Insert`` on arrow keypad * **Delete** = 0xd3u8 - ``Delete`` on arrow keypad * **LWin** = 0xdbu8 - ``Left Windows`` key * **RWin** = 0xdcu8 - ``Right Windows`` key * **Apps** = 0xddu8 - ``AppMenu`` key .. _enum-input_consts-MouseButton: .. das:attribute:: MouseButton Mouse buttons :Values: * **Left** = 0x0u8 - left mouse button * **Right** = 0x1u8 - right mouse button * **Middle** = 0x2u8 - middle mouse button (scroll wheel) * **WheelUp** = 0x5u8 - mouse wheel up * **WheelDown** = 0x6u8 - mouse wheel down +++++++++ Functions +++++++++ * :ref:`ControllerIndex (idx: int) : ControllerIndex ` .. _function-input_consts_ControllerIndex_int: .. das:function:: ControllerIndex(idx: int) : ControllerIndex Converts an integer to a controller index enum :Arguments: * **idx** : int