Legacy:Functions/Input

From Spherical
< Legacy:Functions
Revision as of 23:03, 30 May 2013 by Apollolux (talk | contribs) (created, needs reformatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Input

Player Input

 API:GetPlayerKey(player, player_key)
     - Returns the key constant associated with the configurable player key of 'player'.
       Allowed 'player' values are 0 - 3 or:
         PLAYER_1
         PLAYER_2
         PLAYER_3
         PLAYER_4
       Allowed 'player_key' values are:
         PLAYER_KEY_MENU
         PLAYER_KEY_UP
         PLAYER_KEY_DOWN
         PLAYER_KEY_LEFT
         PLAYER_KEY_RIGHT
         PLAYER_KEY_A
         PLAYER_KEY_B
         PLAYER_KEY_X
         PLAYER_KEY_Y

Keyboard

Key code translation

  • API:GetKeyString(key, shift): Converts the given key into a string, KEY_A will become "a", etc. If shift is true, returns uppercase/special value of key. Control keys return an empty string.

Key status

  • API:GetToggleState(key): Checks if Caps Lock, Num Lock or Scroll Lock are active.
  • Allowed key values:
    • KEY_CAPSLOCK
    • KEY_NUMLOCK
    • KEY_SCROLLOCK (Note: only two Ls)

Key queue

  • API:AreKeysLeft(): Check if keys are left in the key buffer.
  • API:GetKey(): Get a key from the key buffer, waits for one if there isn't.

Mouse

Cursor location

Mouse button status

Mouse wheel event queue

Joystick

Button status

Orientation

  • API:GetJoystickAxis(joystick, axis): Returns the current joystick axis position in normalized coordinates fro -1 to 1.
  • Allowed axis values:
    • JOYSTICK_AXIS_X
    • JOYSTICK_AXIS_Y
    • JOYSTICK_AXIS_Z
    • JOYSTICK_AXIS_R (rotation)