|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 [Pref="dom.gamepad.enabled"] |
|
7 interface GamepadButton { |
|
8 readonly attribute boolean pressed; |
|
9 readonly attribute double value; |
|
10 }; |
|
11 |
|
12 [Pref="dom.gamepad.enabled"] |
|
13 interface Gamepad { |
|
14 /** |
|
15 * An identifier, unique per type of device. |
|
16 */ |
|
17 readonly attribute DOMString id; |
|
18 |
|
19 /** |
|
20 * The game port index for the device. Unique per device |
|
21 * attached to this system. |
|
22 */ |
|
23 readonly attribute unsigned long index; |
|
24 |
|
25 /** |
|
26 * The mapping in use for this device. The empty string |
|
27 * indicates that no mapping is in use. |
|
28 */ |
|
29 readonly attribute DOMString mapping; |
|
30 |
|
31 /** |
|
32 * true if this gamepad is currently connected to the system. |
|
33 */ |
|
34 readonly attribute boolean connected; |
|
35 |
|
36 /** |
|
37 * The current state of all buttons on the device, an |
|
38 * array of GamepadButton. |
|
39 */ |
|
40 [Pure, Cached, Frozen] |
|
41 readonly attribute sequence<GamepadButton> buttons; |
|
42 |
|
43 /** |
|
44 * The current position of all axes on the device, an |
|
45 * array of doubles. |
|
46 */ |
|
47 [Pure, Cached, Frozen] |
|
48 readonly attribute sequence<double> axes; |
|
49 }; |