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
- bitfield GamepadButton
Button codes for gamepad (Xbox) controller
- Fields:
Up (0x1) -
Upon Xbox controllerDown (0x2) -
Downon Xbox controllerLeft (0x4) -
Lefton Xbox controllerRight (0x8) -
Righton Xbox controllerStart (0x10) -
Starton Xbox controller, hidden for engine use, do not bind actions to this buttonBack (0x20) -
Backon Xbox controllerL3 (0x40) -
L3(LSBorLeft Stick) on Xbox controllerR3 (0x80) -
R3(RSBorRight Stick) on Xbox controllerLeftBumper (0x100) -
LBon Xbox controllerRightBumper (0x200) -
RBon Xbox controllerRESERVED1 (0x400) - unused placeholder
RESERVED2 (0x800) - unused placeholder
A (0x1000) -
Aon Xbox controllerB (0x2000) -
Bon Xbox controllerX (0x4000) -
Xon Xbox controllerY (0x8000) -
Yon Xbox controllerLeftTrigger (0x10000) -
LT(orLeft Trigger) on Xbox controllerRightTrigger (0x20000) -
RT(orRight Trigger) on Xbox controller
- 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
- 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
- KeyCode
Virtual key codes for keyboard buttons
- Values:
Escape = 0x1u8 -
Escapekey, hidden for engine use, do not bind actions to this key_1 = 0x2u8 -
1on main keyboard_2 = 0x3u8 -
2on main keyboard_3 = 0x4u8 -
3on main keyboard_4 = 0x5u8 -
4on main keyboard_5 = 0x6u8 -
5on main keyboard_6 = 0x7u8 -
6on main keyboard_7 = 0x8u8 -
7on main keyboard_8 = 0x9u8 -
8on main keyboard_9 = 0xau8 -
9on main keyboard_0 = 0xbu8 -
0on main keyboardMinus = 0xcu8 -
-on main keyboardEquals = 0xdu8 -
=on main keyboardBack = 0xeu8 -
backspaceTab = 0xfu8 -
tabQ = 0x10u8 -
QW = 0x11u8 -
WE = 0x12u8 -
ER = 0x13u8 -
RT = 0x14u8 -
TY = 0x15u8 -
YU = 0x16u8 -
UI = 0x17u8 -
IO = 0x18u8 -
OP = 0x19u8 -
PLBracket = 0x1au8 -
[RBracket = 0x1bu8 -
]Return = 0x1cu8 -
Enteron main keyboardLControl = 0x1du8 -
Left ControlA = 0x1eu8 -
AS = 0x1fu8 -
SD = 0x20u8 -
DF = 0x21u8 -
FG = 0x22u8 -
GH = 0x23u8 -
HJ = 0x24u8 -
JK = 0x25u8 -
KL = 0x26u8 -
LSemicolon = 0x27u8 -
;Apostrophe = 0x28u8 -
'Grave = 0x29u8 -
`accent graveLShift = 0x2au8 -
Left ShiftBackslash = 0x2bu8 -
\on main keyboardZ = 0x2cu8 -
ZX = 0x2du8 -
XC = 0x2eu8 -
CV = 0x2fu8 -
VB = 0x30u8 -
BN = 0x31u8 -
NM = 0x32u8 -
MComma = 0x33u8 -
,on main keyboardPeriod = 0x34u8 -
.on main keyboardSlash = 0x35u8 -
/on main keyboardRshift = 0x36u8 -
Right ShiftMultiply = 0x37u8 -
*on numeric keypadLAlt = 0x38u8 -
Left AltSpace = 0x39u8 -
SpacebarCapital = 0x3au8 -
Caps LockF1 = 0x3bu8 -
F1F2 = 0x3cu8 -
F2F3 = 0x3du8 -
F3F4 = 0x3eu8 -
F4F5 = 0x3fu8 -
F5F6 = 0x40u8 -
F6F7 = 0x41u8 -
F7F8 = 0x42u8 -
F8F9 = 0x43u8 -
F9F10 = 0x44u8 -
F10Numlock = 0x45u8 -
Num LockScroll = 0x46u8 -
Scroll LockNumpad7 = 0x47u8 -
7on numeric keypadNumpad8 = 0x48u8 -
8on numeric keypadNumpad9 = 0x49u8 -
9on numeric keypadSubtract = 0x4au8 -
-on numeric keypadNumpad4 = 0x4bu8 -
4on numeric keypadNumpad5 = 0x4cu8 -
5on numeric keypadNumpad6 = 0x4du8 -
6on numeric keypadAdd = 0x4eu8 -
+on numeric keypadNumpad1 = 0x4fu8 -
1on numeric keypadNumpad2 = 0x50u8 -
2on numeric keypadNumpad3 = 0x51u8 -
3on numeric keypadNumpad0 = 0x52u8 -
0on numeric keypadDecimal = 0x53u8 -
.on numeric keypadOem102 = 0x56u8 -
<>or\|on RT 102-key keyboard (Non-U.S.)F11 = 0x57u8 -
F11F12 = 0x58u8 -
F12F13 = 0x64u8 -
F13(NEC PC98)F14 = 0x65u8 -
F14(NEC PC98)F15 = 0x66u8 -
F15(NEC PC98)KANA = 0x70u8 - (Japanese keyboard)
ABNT_C1 = 0x73u8 -
/?on Brazilian keyboardCONVERT = 0x79u8 - (Japanese keyboard)
NOCONVERT = 0x7bu8 - (Japanese keyboard)
YEN = 0x7du8 - (Japanese keyboard)
ABNT_C2 = 0x7eu8 -
Numpad .on Brazilian keyboardNumpadEquals = 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 TrackNumpadEnter = 0x9cu8 -
Enteron numeric keypadRControl = 0x9du8 -
Right ControlMute = 0xa0u8 -
MuteCalculator = 0xa1u8 -
CalculatorPlayPause = 0xa2u8 -
Play / PauseMediaStop = 0xa4u8 -
Media StopVolumeDown = 0xaeu8 -
Volume -VolumeUp = 0xb0u8 -
Volume +Webhome = 0xb2u8 -
Web homeNumpadComma = 0xb3u8 -
,on numeric keypad (NEC PC98)Divide = 0xb5u8 -
/on numeric keypadPrint = 0xb7u8 -
System Request / Print ScreenRAlt = 0xb8u8 -
Right AltPause = 0xc5u8 -
PauseHome = 0xc7u8 -
Homeon arrow keypadUp = 0xc8u8 -
UpArrowon arrow keypadPrior = 0xc9u8 -
PgUpon arrow keypadLeft = 0xcbu8 -
LeftArrowon arrow keypadRight = 0xcdu8 -
RightArrowon arrow keypadEnd = 0xcfu8 -
Endon arrow keypadDown = 0xd0u8 -
DownArrowon arrow keypadNext = 0xd1u8 -
PgDnon arrow keypadInsert = 0xd2u8 -
Inserton arrow keypadDelete = 0xd3u8 -
Deleteon arrow keypadLWin = 0xdbu8 -
Left WindowskeyRWin = 0xdcu8 -
Right WindowskeyApps = 0xddu8 -
AppMenukey
- 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
- ControllerIndex(idx: int): ControllerIndex
Converts an integer to a controller index enum
- Arguments:
idx : int