1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
---
title: Gamepad API
slug: Web/API/Gamepad_API
translation_of: Web/API/Gamepad_API
---
<div>{{DefaultAPISidebar("Gamepad API")}}</div>
<p>L'<strong>API Gamepad</strong> <span class="tlid-translation translation" lang="fr"><span title="">est un moyen</span></span> pour les <span class="tlid-translation translation" lang="fr"><span title="">développeurs d'accéder aux signaux provenant des manettes des jeu et des autres unités</span> <span title="">de commande du jeu d'y répondre de manière simple et systématiq</span></span>. <span class="tlid-translation translation" lang="fr"><span title="">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.</span></span></p>
<h2 id="Interfaces">Interfaces</h2>
<dl>
<dt><a href="https://developer.mozilla.org/en-US/docs/Web/API/Gamepad" title="The Gamepad interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id."><code>Gamepad</code></a></dt>
<dd><span class="tlid-translation translation" lang="fr"><span title="">Représente une manette de jeu / unités</span> <span title="">de commande du jeu connecté à l'ordinateur.</span></span></dd>
<dt><a href="https://developer.mozilla.org/en-US/docs/Web/API/GamepadButton" title="The GamepadButton interface defines an individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device."><code>GamepadButton</code></a></dt>
<dd>Représente un bouton sur un gamepad connecté.</dd>
<dt><a href="https://developer.mozilla.org/en-US/docs/Web/API/GamepadEvent" title="The GamepadEvent interface of the Gamepad API contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to."><code>GamepadEvent</code></a></dt>
<dd>L'objet d'événement qui déclenche des événements sur la manette de jeu contiguë de manière représentative.</dd>
</dl>
<h3 id="Extensions_de_manette_du_jeu_expérimentales">Extensions de manette du jeu expérimentales</h3>
<dl>
<dt><a href="https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator" title="The GamepadHapticActuator interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware."><code>GamepadHapticActuator</code></a></dt>
<dd>Represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware.</dd>
<dt><a href="https://developer.mozilla.org/en-US/docs/Web/API/GamepadPose" title="The GamepadPose interface of the Gamepad API represents the pose of a WebVR controller at a given timestamp (which includes orientation, position, velocity, and acceleration information.)"><code>GamepadPose</code></a></dt>
<dd>Represents the pose of a controller (e.g. position and orientation in 3D space) in the case of a <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebVR_API">WebVR</a>controller.</dd>
</dl>
<p>See also the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Gamepad#Experimental_extensions_to_Gamepad">extensions to the Gamepad interface</a>, for features that allow you to access the above information.</p>
<h3 id="Extensions_à_d'autres_interfaces">Extensions à d'autres interfaces</h3>
<h4 id="Navigator">Navigator</h4>
<dl>
<dt>{{domxref("Navigator.getGamepads()")}}</dt>
<dd>An extension to the {{domxref("Navigator")}} object that returns an array of {{domxref("Gamepad")}} objects, one for each connected gamepad.</dd>
</dl>
<h4 id="Window_events">Window events</h4>
<dl>
<dt>{{domxref("Window.ongamepadconnected")}}</dt>
<dd>Represents an event handler that will run when a gamepad is connected (when the {{event('gamepadconnected')}} event fires).</dd>
<dt>{{domxref("Window.ongamepaddisconnected")}}</dt>
<dd>Represents an event handler that will run when a gamepad is disconnected (when the {{event('gamepaddisconnected')}} event fires).</dd>
</dl>
<h2 id="Tutoriels_et_guides">Tutoriels et guides</h2>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API">Using the Gamepad API</a></li>
<li><a href="/en-US/docs/Games/Techniques/Controls_Gamepad_API">Implementing controls using the Gamepad API</a></li>
</ul>
<h2 id="Caractéristiques">Caractéristiques</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Spécification</th>
<th scope="col">Statut</th>
<th scope="col">Commentaire</th>
</tr>
<tr>
<td>{{SpecName("GamepadExtensions")}}</td>
<td>{{Spec2("GamepadExtensions")}}</td>
<td>Defines the {{anch("Experimental Gamepad extensions")}}.</td>
</tr>
<tr>
<td>{{SpecName("Gamepad", "", "The Gamepad API specification")}}</td>
<td>{{Spec2("Gamepad")}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilité_du_navigateur">Compatibilité du navigateur</h2>
<p>{{Compat("api.Gamepad")}}</p>
<h2 id="Voir_également">Voir également</h2>
<ul>
<li><a class="external text" href="https://hacks.mozilla.org/2013/12/the-gamepad-api/" rel="nofollow">The Gamepad API</a> by Ted Mielczarek and Robert Nyman</li>
<li><a href="http://luser.github.io/gamepadtest/">Simple API demo page</a> (<a href="https://github.com/luser/gamepadtest">source</a>)</li>
</ul>
|