Gorilla.Controller.Input.Consts Unit Reference

Input code constants for keyboard, mouse, and gamepad.

Unit: Gorilla.Controller.Input.Consts

Action Constants

Predefined action codes for quick HotKey integration.

System Actions

const
  GORILLA_INPUT_ACTION_NONE = $00000000;
  GORILLA_INPUT_ACTION_HOME = $00000001;
  GORILLA_INPUT_ACTION_SETTINGS = $00000002;

Menu Navigation

const
  GORILLA_INPUT_ACTION_BACK = $00000003;
  GORILLA_INPUT_ACTION_CONTINUE = $00000004;
  GORILLA_INPUT_ACTION_NEXT = $00000005;
  GORILLA_INPUT_ACTION_PREV = $00000006;

Movement Actions

const
  GORILLA_INPUT_ACTION_MOVEFORWARD = $00000100;
  GORILLA_INPUT_ACTION_MOVEBACKWARDS = $00000101;
  GORILLA_INPUT_ACTION_STRIDELEFT = $00000102;
  GORILLA_INPUT_ACTION_STRIDERIGHT = $00000103;
  GORILLA_INPUT_ACTION_TURNLEFT = $00000104;
  GORILLA_INPUT_ACTION_TURNRIGHT = $00000105;
  GORILLA_INPUT_ACTION_LOOKUP = $00000106;
  GORILLA_INPUT_ACTION_LOOKDOWN = $00000107;
  GORILLA_INPUT_ACTION_RUNFORWARD = $00000108;
  GORILLA_INPUT_ACTION_RUNBACKWARDS = $00000109;

Character Interaction

const
  // Jump variations
  GORILLA_INPUT_ACTION_JUMP_0 = $00000200;
  GORILLA_INPUT_ACTION_JUMP_1 = $00000201;
  GORILLA_INPUT_ACTION_JUMP_2 = $00000202;

  // Double jump variations
  GORILLA_INPUT_ACTION_DOUBLEJUMP_0 = $00000203;
  GORILLA_INPUT_ACTION_DOUBLEJUMP_1 = $00000204;
  GORILLA_INPUT_ACTION_DOUBLEJUMP_2 = $00000205;

  // Crouch variations
  GORILLA_INPUT_ACTION_CROUCH_0 = $00000206;
  GORILLA_INPUT_ACTION_CROUCH_1 = $00000207;
  GORILLA_INPUT_ACTION_CROUCH_2 = $00000208;

  // Stance changes
  GORILLA_INPUT_ACTION_LAYDOWN = $00000209;
  GORILLA_INPUT_ACTION_STANDUP = $0000020A;
  GORILLA_INPUT_ACTION_HOLDDOWN = $0000020B;
  GORILLA_INPUT_ACTION_HOLDUP = $0000020C;
  GORILLA_INPUT_ACTION_KNEELDOWN = $0000020D;
  GORILLA_INPUT_ACTION_KNEELUP = $0000020E;

  // Hanging
  GORILLA_INPUT_ACTION_HANG = $0000020F;
  GORILLA_INPUT_ACTION_RELEASE = $00000210;

Climbing Actions

const
  GORILLA_INPUT_ACTION_CLIMB_0 = $00000211;
  GORILLA_INPUT_ACTION_CLIMB_1 = $00000212;
  GORILLA_INPUT_ACTION_CLIMB_2 = $00000213;
  GORILLA_INPUT_ACTION_CLIMB_3 = $00000214;
  GORILLA_INPUT_ACTION_CLIMB_4 = $00000215;
  GORILLA_INPUT_ACTION_CLIMB_5 = $00000216;
  GORILLA_INPUT_ACTION_CLIMB_6 = $00000217;
  GORILLA_INPUT_ACTION_CLIMB_7 = $00000218;
  GORILLA_INPUT_ACTION_CLIMB_8 = $00000219;
  GORILLA_INPUT_ACTION_CLIMB_9 = $0000021A;

Collecting Actions

const
  GORILLA_INPUT_ACTION_COLLECT_LOW = $0000021B;
  GORILLA_INPUT_ACTION_COLLECT_MID = $0000021C;
  GORILLA_INPUT_ACTION_COLLECT_HIGH = $0000021D;

Combat Actions

const
  // Attack variations (0-9)
  GORILLA_INPUT_ACTION_ATTACK_0 = $00010000;
  GORILLA_INPUT_ACTION_ATTACK_1 = $00010001;
  GORILLA_INPUT_ACTION_ATTACK_2 = $00010002;
  GORILLA_INPUT_ACTION_ATTACK_3 = $00010003;
  GORILLA_INPUT_ACTION_ATTACK_4 = $00010004;
  GORILLA_INPUT_ACTION_ATTACK_5 = $00010005;
  GORILLA_INPUT_ACTION_ATTACK_6 = $00010006;
  GORILLA_INPUT_ACTION_ATTACK_7 = $00010007;
  GORILLA_INPUT_ACTION_ATTACK_8 = $00010008;
  GORILLA_INPUT_ACTION_ATTACK_9 = $00010009;

  // Defend variations (0-9)
  GORILLA_INPUT_ACTION_DEFEND_0 = $0001000A;
  GORILLA_INPUT_ACTION_DEFEND_1 = $0001000B;
  GORILLA_INPUT_ACTION_DEFEND_2 = $0001000C;
  GORILLA_INPUT_ACTION_DEFEND_3 = $0001000D;
  GORILLA_INPUT_ACTION_DEFEND_4 = $0001000E;
  GORILLA_INPUT_ACTION_DEFEND_5 = $0001000F;
  GORILLA_INPUT_ACTION_DEFEND_6 = $00010010;
  GORILLA_INPUT_ACTION_DEFEND_7 = $00010011;
  GORILLA_INPUT_ACTION_DEFEND_8 = $00010012;
  GORILLA_INPUT_ACTION_DEFEND_9 = $00010013;

Keyboard Input Codes

Letters

const
  GORILLA_INPUT_KEY_A = Ord('A');  // 65
  GORILLA_INPUT_KEY_B = Ord('B');  // 66
  GORILLA_INPUT_KEY_C = Ord('C');  // 67
  GORILLA_INPUT_KEY_D = Ord('D');  // 68
  GORILLA_INPUT_KEY_E = Ord('E');  // 69
  GORILLA_INPUT_KEY_F = Ord('F');  // 70
  GORILLA_INPUT_KEY_G = Ord('G');  // 71
  GORILLA_INPUT_KEY_H = Ord('H');  // 72
  GORILLA_INPUT_KEY_I = Ord('I');  // 73
  GORILLA_INPUT_KEY_J = Ord('J');  // 74
  GORILLA_INPUT_KEY_K = Ord('K');  // 75
  GORILLA_INPUT_KEY_L = Ord('L');  // 76
  GORILLA_INPUT_KEY_M = Ord('M');  // 77
  GORILLA_INPUT_KEY_N = Ord('N');  // 78
  GORILLA_INPUT_KEY_O = Ord('O');  // 79
  GORILLA_INPUT_KEY_P = Ord('P');  // 80
  GORILLA_INPUT_KEY_Q = Ord('Q');  // 81
  GORILLA_INPUT_KEY_R = Ord('R');  // 82
  GORILLA_INPUT_KEY_S = Ord('S');  // 83
  GORILLA_INPUT_KEY_T = Ord('T');  // 84
  GORILLA_INPUT_KEY_U = Ord('U');  // 85
  GORILLA_INPUT_KEY_V = Ord('V');  // 86
  GORILLA_INPUT_KEY_W = Ord('W');  // 87
  GORILLA_INPUT_KEY_X = Ord('X');  // 88
  GORILLA_INPUT_KEY_Y = Ord('Y');  // 89
  GORILLA_INPUT_KEY_Z = Ord('Z');  // 90

Numbers

const
  GORILLA_INPUT_KEY_0 = Ord('0');  // 48
  GORILLA_INPUT_KEY_1 = Ord('1');  // 49
  GORILLA_INPUT_KEY_2 = Ord('2');  // 50
  GORILLA_INPUT_KEY_3 = Ord('3');  // 51
  GORILLA_INPUT_KEY_4 = Ord('4');  // 52
  GORILLA_INPUT_KEY_5 = Ord('5');  // 53
  GORILLA_INPUT_KEY_6 = Ord('6');  // 54
  GORILLA_INPUT_KEY_7 = Ord('7');  // 55
  GORILLA_INPUT_KEY_8 = Ord('8');  // 56
  GORILLA_INPUT_KEY_9 = Ord('9');  // 57

Arrow Keys

const
  GORILLA_INPUT_KEY_ARROW_LEFT = Ord(#37);   // 37
  GORILLA_INPUT_KEY_ARROW_UP = Ord(#38);     // 38
  GORILLA_INPUT_KEY_ARROW_RIGHT = Ord(#39);  // 39
  GORILLA_INPUT_KEY_ARROW_DOWN = Ord(#40);   // 40

Common Keys

const
  GORILLA_INPUT_KEY_NONE = 0;

  GORILLA_INPUT_KEY_SPACE = Ord(' ');         // 32
  GORILLA_INPUT_KEY_RETURN = Ord(Char(#$0D)); // 13
  GORILLA_INPUT_KEY_ESCAPE = Ord(Char(#$1B)); // 27
  GORILLA_INPUT_KEY_SHIFT_BACKSPACE = Ord(#8);
  GORILLA_INPUT_KEY_SHIFT_TAB = Ord(#9);
  GORILLA_INPUT_KEY_LINEFEED = Ord(Char(#$0A));
  GORILLA_INPUT_KEY_DELETE = Ord(Char(#$7F));
  GORILLA_INPUT_KEY_SHIFT_CAPS = Ord(#20);
  GORILLA_INPUT_KEY_PAUSE = $13;

Modifier Keys

const
  GORILLA_INPUT_KEY_SHIFT_LEFT = Ord(#160);   // 160
  GORILLA_INPUT_KEY_SHIFT_RIGHT = Ord(#161);  // 161
  GORILLA_INPUT_KEY_CTRL_LEFT = Ord(#162);    // 162
  GORILLA_INPUT_KEY_CTRL_RIGHT = Ord(#163);   // 163
  GORILLA_INPUT_KEY_ALT = Ord(#164);          // 164
  GORILLA_INPUT_KEY_ALTGR = Ord(#165);        // 165

Symbol Keys

const
  GORILLA_INPUT_KEY_PLUS = Ord('+');
  GORILLA_INPUT_KEY_MINUS = Ord('-');
  GORILLA_INPUT_KEY_DOT = Ord('.');
  GORILLA_INPUT_KEY_COMMA = Ord(',');
  GORILLA_INPUT_KEY_HASH = Ord('#');
  GORILLA_INPUT_KEY_DIV = Ord('/');
  GORILLA_INPUT_KEY_STAR = Ord('*');

  GORILLA_INPUT_KEY_EXCL = Ord('!');
  GORILLA_INPUT_KEY_QUOTE = Ord('"');
  GORILLA_INPUT_KEY_PARA = Ord('§');

  GORILLA_INPUT_KEY_DOLLAR = Ord('$');
  GORILLA_INPUT_KEY_EURO = Ord('€');
  GORILLA_INPUT_KEY_AT = Ord('@');
  GORILLA_INPUT_KEY_PERCENT = Ord('%');
  GORILLA_INPUT_KEY_AND = Ord('&');
  GORILLA_INPUT_KEY_SLASH = Ord('/');
  GORILLA_INPUT_KEY_BACKSLASH = Ord('\');
  GORILLA_INPUT_KEY_BRACKETOPEN = Ord('(');
  GORILLA_INPUT_KEY_BRACKETCLOSE = Ord(')');
  GORILLA_INPUT_KEY_EQUAL = Ord('=');
  GORILLA_INPUT_KEY_QUESTION = Ord('?');
  GORILLA_INPUT_KEY_TILDE = Ord('~');
  GORILLA_INPUT_KEY_UNDERSCORE = Ord('_');
  GORILLA_INPUT_KEY_SEMICOLON = Ord(';');
  GORILLA_INPUT_KEY_COLON = Ord(':');
  GORILLA_INPUT_KEY_BAR = Ord('|');
  GORILLA_INPUT_KEY_TAGOPEN = Ord('<');
  GORILLA_INPUT_KEY_TAGCLOSE = Ord('>');
  GORILLA_INPUT_APOSTROPHE = Ord('''');

Usage Example:

// WASD movement
LHotKey := GorillaInputController1.AddHotKey('MoveForward');
LHotKey.AddInput(Keyboard, GORILLA_INPUT_KEY_W);

// Ctrl + S to save
LHotKey := GorillaInputController1.AddHotKey('Save');
LHotKey.AddInput(Keyboard, GORILLA_INPUT_KEY_CTRL_LEFT);
LHotKey.AddInput(Keyboard, GORILLA_INPUT_KEY_S);

Mouse Input Codes

Mouse Buttons

const
  GORILLA_INPUT_MOUSE_LBUTTON = $100002;         // Left button
  GORILLA_INPUT_MOUSE_LBUTTON_DBLCLK = $100003;  // Left double-click

  GORILLA_INPUT_MOUSE_RBUTTON = $100004;         // Right button
  GORILLA_INPUT_MOUSE_RBUTTON_DBLCLK = $100005;  // Right double-click

  GORILLA_INPUT_MOUSE_MBUTTON = $100006;         // Middle button (wheel click)
  GORILLA_INPUT_MOUSE_MBUTTON_DBLCLK = $100007;  // Middle double-click

  GORILLA_INPUT_MOUSE_X1BUTTON = $100008;        // Extra button 1
  GORILLA_INPUT_MOUSE_X1BUTTON_DBLCLK = $100009; // Extra 1 double-click

  GORILLA_INPUT_MOUSE_X2BUTTON = $10000A;        // Extra button 2
  GORILLA_INPUT_MOUSE_X2BUTTON_DBLCLK = $10000B; // Extra 2 double-click

Mouse Events

const
  GORILLA_INPUT_MOUSE_POSITION = $100001;  // Mouse position (persistent)
  GORILLA_INPUT_MOUSE_WHEEL = $10000C;     // Mouse wheel

Usage Example:

// Left click to shoot
LHotKey := GorillaInputController1.AddHotKey('Shoot');
LHotKey.AddInput(Mouse, GORILLA_INPUT_MOUSE_LBUTTON);

// Right click to aim
LHotKey := GorillaInputController1.AddHotKey('Aim');
LHotKey.AddInput(Mouse, GORILLA_INPUT_MOUSE_RBUTTON);

// Get persistent mouse position
var
  LMsg: TGorillaInputMessage;
begin
  if GorillaInputController1.GetPersistentMessage(Mouse,
    GORILLA_INPUT_MOUSE_POSITION, LMsg) then
  begin
    // Use mouse position
  end;
end;

GamePad Input Codes

Connection Events

const
  GORILLA_INPUT_GAMEPAD_CONNECTED = $200001;
  GORILLA_INPUT_GAMEPAD_DISCONNECTED = $200002;

D-Pad

const
  GORILLA_INPUT_GAMEPAD_DPAD_UP = $200003;
  GORILLA_INPUT_GAMEPAD_DPAD_DOWN = $200004;
  GORILLA_INPUT_GAMEPAD_DPAD_LEFT = $200005;
  GORILLA_INPUT_GAMEPAD_DPAD_RIGHT = $200006;

System Buttons

const
  GORILLA_INPUT_GAMEPAD_STARTBUTTON = $200007;  // Start/Menu
  GORILLA_INPUT_GAMEPAD_MODEBUTTON = $200008;   // Xbox/Guide/Home
  GORILLA_INPUT_GAMEPAD_BACKBUTTON = $200009;   // Back/View/Select

Thumbsticks (Press)

const
  GORILLA_INPUT_GAMEPAD_THUMBSTICK_LEFT = $20000A;   // L3
  GORILLA_INPUT_GAMEPAD_THUMBSTICK_RIGHT = $20000B;  // R3

Shoulder Buttons

const
  GORILLA_INPUT_GAMEPAD_SHOULDER_LEFT = $20000C;   // LB
  GORILLA_INPUT_GAMEPAD_SHOULDER_RIGHT = $20000D;  // RB

Face Buttons

const
  GORILLA_INPUT_GAMEPAD_BUTTON_A = $20000E;  // A / Cross
  GORILLA_INPUT_GAMEPAD_BUTTON_B = $20000F;  // B / Circle
  GORILLA_INPUT_GAMEPAD_BUTTON_X = $200011;  // X / Square
  GORILLA_INPUT_GAMEPAD_BUTTON_Y = $200012;  // Y / Triangle

Triggers (Persistent)

const
  GORILLA_INPUT_GAMEPAD_TRIGGER_LEFT = $200020;   // LT (0-255)
  GORILLA_INPUT_GAMEPAD_TRIGGER_RIGHT = $200021;  // RT (0-255)

Thumbstick Positions (Persistent)

const
  GORILLA_INPUT_GAMEPAD_THUMBSTICK_POS_LEFT = $200030;   // Left stick position
  GORILLA_INPUT_GAMEPAD_THUMBSTICK_POS_RIGHT = $200031;  // Right stick position

Usage Example:

// Jump with A button
LHotKey := GorillaInputController1.AddHotKey('Jump');
LHotKey.AddInput(GamePad, GORILLA_INPUT_GAMEPAD_BUTTON_A);

// Sprint with left thumbstick press
LHotKey := GorillaInputController1.AddHotKey('Sprint');
LHotKey.AddInput(GamePad, GORILLA_INPUT_GAMEPAD_THUMBSTICK_LEFT);

// Get persistent left trigger value
var
  LMsg: TGorillaInputMessage;
  LValue: Byte;
begin
  if GorillaInputController1.GetPersistentMessage(GamePad,
    GORILLA_INPUT_GAMEPAD_TRIGGER_LEFT, LMsg) then
  begin
    LValue := LMsg.WParam;  // 0-255
  end;
end;

System Constants

GamePad Limits

const
{$IFDEF MSWINDOWS}
  GORILLA_GAMEPAD_USER_MAX = 4;  // XInput limitation
{$ENDIF}
{$IFDEF ANDROID}
  GORILLA_GAMEPAD_USER_MAX = 1;
{$ENDIF}
{$IFDEF IOS}
  GORILLA_GAMEPAD_USER_MAX = 1;
{$ENDIF}
{$IFDEF MACOS}
  GORILLA_GAMEPAD_USER_MAX = 4;
{$ENDIF}
{$IFDEF LINUX}
  GORILLA_GAMEPAD_USER_MAX = 4;
{$ENDIF}

Maximum number of simultaneously connected gamepads per platform.

HotKey Limits

const
  // Maximum inputs per device in a HotKey
  GORILLA_HOTKEY_INPUTS_MAX = 4;

  // Maximum HotKeys in a Sequence
  GORILLA_INPUT_SEQUENCE_HOTKEY_MAX = 16;

Timing Constants

const
  // Handler polling interval (milliseconds)
  GORILLA_INPUT_HANDLER_SENSITIVITY = 10;

  // Default sequence sensitivity (milliseconds)
  GORILLA_INPUT_SEQUENCE_SENSITIVITY = 500;

  // GamePad availability check interval (milliseconds)
  GORILLA_GAMEPAD_AVAILIBILITY_CHECK = 3000;

  // GamePad vibration check interval (milliseconds)
  GORILLA_GAMEPAD_VIBRATION_CHECK = 100;

  // GamePad battery check interval (milliseconds)
  GORILLA_GAMEPAD_BATTERY_CHECK = 30000;

Button Mapping Reference

Xbox Controller Layout

                    [Mode]
        [LB]                    [RB]

    [D-Pad]              [Y]
                    [X]     [B]
                         [A]

    [L3]                    [R3]

      LT                      RT

Mapping:

Xbox Code
D-Pad Up/Down/Left/Right GORILLA_INPUT_GAMEPAD_DPAD_*
A GORILLA_INPUT_GAMEPAD_BUTTON_A
B GORILLA_INPUT_GAMEPAD_BUTTON_B
X GORILLA_INPUT_GAMEPAD_BUTTON_X
Y GORILLA_INPUT_GAMEPAD_BUTTON_Y
LB GORILLA_INPUT_GAMEPAD_SHOULDER_LEFT
RB GORILLA_INPUT_GAMEPAD_SHOULDER_RIGHT
LT GORILLA_INPUT_GAMEPAD_TRIGGER_LEFT
RT GORILLA_INPUT_GAMEPAD_TRIGGER_RIGHT
L3 GORILLA_INPUT_GAMEPAD_THUMBSTICK_LEFT
R3 GORILLA_INPUT_GAMEPAD_THUMBSTICK_RIGHT
Start GORILLA_INPUT_GAMEPAD_STARTBUTTON
Back GORILLA_INPUT_GAMEPAD_BACKBUTTON
Mode GORILLA_INPUT_GAMEPAD_MODEBUTTON

PlayStation Controller Layout

                   [PS]
        [L1]                    [R1]

    [D-Pad]             [△]
                    [□]     [○]
                         [✕]

    [L3]                    [R3]

      L2                      R2

Mapping:

PlayStation Xbox Equivalent Code
D-Pad D-Pad GORILLA_INPUT_GAMEPAD_DPAD_*
✕ (Cross) A GORILLA_INPUT_GAMEPAD_BUTTON_A
○ (Circle) B GORILLA_INPUT_GAMEPAD_BUTTON_B
□ (Square) X GORILLA_INPUT_GAMEPAD_BUTTON_X
△ (Triangle) Y GORILLA_INPUT_GAMEPAD_BUTTON_Y
L1 LB GORILLA_INPUT_GAMEPAD_SHOULDER_LEFT
R1 RB GORILLA_INPUT_GAMEPAD_SHOULDER_RIGHT
L2 LT GORILLA_INPUT_GAMEPAD_TRIGGER_LEFT
R2 RT GORILLA_INPUT_GAMEPAD_TRIGGER_RIGHT
L3 L3 GORILLA_INPUT_GAMEPAD_THUMBSTICK_LEFT
R3 R3 GORILLA_INPUT_GAMEPAD_THUMBSTICK_RIGHT
Options Start GORILLA_INPUT_GAMEPAD_STARTBUTTON
Share Back GORILLA_INPUT_GAMEPAD_BACKBUTTON
PS Mode GORILLA_INPUT_GAMEPAD_MODEBUTTON

See Also