Gamepad API

L'API Gamepad est un moyen pour les développeurs d'accéder aux signaux provenant des manettes des jeu et des autres unités de commande du jeu d'y répondre de manière simple et systématique. Il contient trois interfaces, deux événements et une fonction spécialisée, pour répondre aux manettes connectées et déconnectées, et pour accéder à d'autres informations sur les manettes elles-mêmes, ainsi que sur les boutons et autres commandes sur lesquels vous appuyez actuellement.

Interfaces

Gamepad

Représente une manette de jeu / unités de commande du jeu connecté à l'ordinateur.

GamepadButton (en-US)

Représente un bouton sur un gamepad connecté.

GamepadEvent (en-US)

L'objet d'événement qui déclenche des événements sur la manette de jeu contiguë de manière représentative.

Extensions de manette du jeu expérimentales

GamepadHapticActuator (en-US)

Represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.

GamepadPose (en-US)

Represents the pose of a controller (e.g. position and orientation in 3D space) in the case of a WebVRcontroller.

See also the extensions to the Gamepad interface, for features that allow you to access the above information.

Extensions à d'autres interfaces

An extension to the Navigator object that returns an array of Gamepad objects, one for each connected gamepad.

Window events

Window.ongamepadconnected (en-US)

Represents an event handler that will run when a gamepad is connected (when the gamepadconnected event fires).

Window.ongamepaddisconnected (en-US)

Represents an event handler that will run when a gamepad is disconnected (when the gamepadisdisconnected event fires).

Tutoriels et guides

Spécifications

Specification
Gamepad
# gamepad-interface
Gamepad Extensions
# partial-gamepad-interface

Compatibilité des navigateurs

BCD tables only load in the browser

Voir aussi