Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gdevelop5:draft-controllers [2019/06/24 01:08] (current)
bouh created
Line 1: Line 1:
 +FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)//
  
 +<​note>​This page talks about extension, to know more about it it is recommended to read [[gdevelop5:​extensions|this page]]. </​note>​
 +
 +====== Gamepads (controllers) extension ======
 +This extension adds support for joysticks (or other controllers) to your game, giving you access to information such as trigger pressure, buttons, axis position, etc....
 +
 +Up to 4 controllers can be connected: for each condition or expression, you will need to enter the controller number with a number 1, 2, 3 or 4, the parameters are detailed below.
 +
 +The Xbox360 and PS4 controllers are fully supported, other types can also be used.
 +But the buttons can have another layout.
 +
 +====Expressions====
 +^ Function ^ Description ^
 +| **Gamepads::​TriggerPressure(a,​ b)** | Get the value of the pressure on a gamepad trigger|
 +| **Gamepads::​AxisValue(a,​ c, d)** | Get the value of axis of a gamepad stick|
 +| **Gamepads::​LastButtonId(a)** | Return the index of the last button used on a gamepad|
 +| **Gamepads::​Deadzone()** | Return the value of the deadzone applied to sticks|
 +| **Gamepads::​ConnectedGamepadsCount()** | Return the number of connected gamepads|
 +| **Gamepads::​GamepadType(a)** | Return a string containing information about the specified gamepad|
 +
 +====Conditions====
 +^ Condition ^ Description ^ Argument ^
 +| Gamepad button pressed | Test if a button is pressed on a gamepad | a, e |
 +| Gamepad stick pushed in a direction (axis) | Check if a stick of a gamepad is pushed in a given direction | a, c, d|
 +| Gamepad type/​information | Check if the specified gamepad has the specified information in its description.| a, f |
 +| Gamepad connected| Check if a gamepad is connected | a |
 +
 +====Actions====
 +^ Action ^ Description ^ Argument ^
 +| Set gamepad deadzone for sticks| Set the deadzone for sticks of the gamepad. The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved). Deadzone is between 0 and 1, and is by default 0.2.| g|
 +| Vibrate gamepad| Generate a vibration on the specified controller. Might only work if the game is running in a recent web browser.| a, h|
 +
 +**a**: Controller ID (1,2,3 or 4)
 +
 +**b**: Trigger ("​LT",​ "​RT",​ "​L2",​ "​R2"​)
 +
 +**c**: Stick ("​LEFT"​ or "​RIGHT"​)
 +
 +**d**: Direction ("​UP",​ "​DOWN",​ "​LEFT"​ or "​RIGHT"​)
 +
 +**e**: The name of the button can be:
 +
 +Xbox: "​A",​ "​B",​ "​X",​ "​Y",​ "​LB",​ "​RB",​ "​LT",​ "​RT",​ "​BACK",​ "​START"​
 +
 +
 +<​nowiki>​
 +PS4: "​CROSS",​ "​SQUARE",​ "​CIRCLE",​ "​TRIANGLE",​ "​L1",​ "​L2",​ "​R1",​ "​R2",​ "​SHARE",​ "​OPTIONS",​ "​PS_BUTTON",​ "​CLICK_TOUCHPAD"​
 +</​nowiki>​
 +
 +<​nowiki>​
 +Other: "​UP",​ "​DOWN",​ "​LEFT",​ "​RIGHT",​ "​CLICK_STICK_LEFT",​ "​CLICK_STICK_RIGHT"​
 +</​nowiki>​
 +
 +
 +**f**: ​ "​Xbox",​ "​PS4",​ "​STEAM"​ or "​PS3"​ (among other)
 +
 +**g**: Deadzone for sticks, 0.2 by default
 +
 +**h**: Time of the vibration, in seconds (optional, default value is 1)