Difference between revisions of "Legacy:Functions/Input"

From Spherical
Jump to: navigation, search
(created, needs reformatting)
 
(section out)
 
Line 3: Line 3:
 
=== Player Input ===
 
=== Player Input ===
  
  [[API:GetPlayerKey]](''player'', ''player_key'')
+
* [[API:GetPlayerKey|GetPlayerKey]](''player'', ''player_key''): Returns the key constant associated with the configurable player key of 'player'.
      - Returns the key constant associated with the configurable player key of 'player'.
+
** Allowed 'player' values are 0 - 3 or:
        Allowed 'player' values are 0 - 3 or:
+
**: <var>PLAYER_1</var>
          PLAYER_1
+
**: <var>PLAYER_2</var>
          PLAYER_2
+
**: <var>PLAYER_3</var>
          PLAYER_3
+
**: <var>PLAYER_4</var>
          PLAYER_4
+
** Allowed 'player_key' values are:
        Allowed 'player_key' values are:
+
**: <var>PLAYER_KEY_MENU</var>
          PLAYER_KEY_MENU
+
**: <var>PLAYER_KEY_UP</var>
          PLAYER_KEY_UP
+
**: <var>PLAYER_KEY_DOWN</var>
          PLAYER_KEY_DOWN
+
**: <var>PLAYER_KEY_LEFT</var>
          PLAYER_KEY_LEFT
+
**: <var>PLAYER_KEY_RIGHT</var>
          PLAYER_KEY_RIGHT
+
**: <var>PLAYER_KEY_A</var>
          PLAYER_KEY_A
+
**: <var>PLAYER_KEY_B</var>
          PLAYER_KEY_B
+
**: <var>PLAYER_KEY_X</var>
          PLAYER_KEY_X
+
**: <var>PLAYER_KEY_Y</var>
          PLAYER_KEY_Y
 
  
=== Keyboard ===
+
{{API:Functions/Input/Keyboard}}
  
==== Key code translation ====
+
{{API:Functions/Input/Mouse}}
  
* [[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.
+
{{API:Functions/Input/Joystick}}
 
 
==== Key status ====
 
 
 
* [[API:IsAnyKeyPressed]](): Check if any key is being held down.
 
* [[API:IsKeyPressed]](''key''): Check if the given ''key'' is being held down.
 
 
 
* [[API:GetToggleState]](''key''): Checks if Caps Lock, Num Lock or Scroll Lock are active.
 
* Allowed key values:
 
** <var>KEY_CAPSLOCK</var>
 
** <var>KEY_NUMLOCK</var>
 
** <var>KEY_SCROLLOCK (Note: only two Ls)</var>
 
 
 
==== 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 ====
 
 
 
* [[API:GetMouseX]](): Get X coordinate of mouse cursor on the screen.
 
* [[API:GetMouseY]](): Get Y coordinate of mouse cursor on the screen.
 
* [[API:SetMousePosition]](''x'', ''y''): Set mouse cursor location.
 
 
 
==== Mouse button status ====
 
 
 
* [[API:IsMouseButtonPressed]](''mouse_button''): Check if a mouse button is being held down.
 
 
 
==== Mouse wheel event queue ====
 
 
 
* [[API:GetMouseWheelEvent]](): Returns a single mouse wheel event.
 
* [[API:GetNumMouseWheelEvents]](): Returns the length of the mouse wheel event queue.
 
 
 
=== Joystick ===
 
 
 
* [[API:GetNumJoysticks]](): Returns the number of joysticks available on the system.
 
* [[API:GetNumJoystickButtons]](''joystick''): Returns the number of buttons available on this joystick.
 
* [[API:GetNumJoystickAxes]](''joystick''): Returns the number of available axes on the given joystick.
 
 
 
* [[API:GetTalkActivationButton]](): Get joystick button used to activate talk scripts.
 
* [[API:SetTalkActivationButton]](''button''): Set joystick button used to activate talk scripts.
 
 
 
==== Button status ====
 
 
 
* [[API:IsJoystickButtonPressed]](''joystick'', ''button''): Find if a button on a joystick is being held down.
 
 
 
==== Orientation ====
 
 
 
* [[API:GetJoystickAxis]](''joystick'', ''axis''): Returns the current joystick axis position in normalized coordinates fro -1 to 1.
 
* Allowed axis values:
 
** <var>JOYSTICK_AXIS_X</var>
 
** <var>JOYSTICK_AXIS_Y</var>
 
** <var>JOYSTICK_AXIS_Z</var>
 
** <var>JOYSTICK_AXIS_R (rotation)</var>
 

Latest revision as of 23:12, 30 May 2013

Input

Player Input

  • 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

API:Functions/Input/Keyboard

API:Functions/Input/Mouse

API:Functions/Input/Joystick