2013-04-09 16:43:24 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-04-09 16:43:25 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2013-10-17 23:07:19 +04:00
|
|
|
[Pref="dom.gamepad.enabled"]
|
|
|
|
interface GamepadButton {
|
|
|
|
readonly attribute boolean pressed;
|
|
|
|
readonly attribute double value;
|
|
|
|
};
|
|
|
|
|
2014-05-23 15:39:13 +04:00
|
|
|
enum GamepadMappingType {
|
|
|
|
"",
|
|
|
|
"standard"
|
|
|
|
};
|
|
|
|
|
2013-04-09 16:43:24 +04:00
|
|
|
[Pref="dom.gamepad.enabled"]
|
2013-04-09 16:43:25 +04:00
|
|
|
interface Gamepad {
|
|
|
|
/**
|
|
|
|
* An identifier, unique per type of device.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The game port index for the device. Unique per device
|
|
|
|
* attached to this system.
|
|
|
|
*/
|
|
|
|
readonly attribute unsigned long index;
|
|
|
|
|
2013-04-09 16:43:25 +04:00
|
|
|
/**
|
|
|
|
* The mapping in use for this device. The empty string
|
|
|
|
* indicates that no mapping is in use.
|
|
|
|
*/
|
2014-05-23 15:39:13 +04:00
|
|
|
readonly attribute GamepadMappingType mapping;
|
2013-04-09 16:43:25 +04:00
|
|
|
|
2013-04-09 16:43:25 +04:00
|
|
|
/**
|
|
|
|
* true if this gamepad is currently connected to the system.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean connected;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The current state of all buttons on the device, an
|
2013-10-17 23:07:19 +04:00
|
|
|
* array of GamepadButton.
|
2013-04-09 16:43:25 +04:00
|
|
|
*/
|
2013-12-16 22:06:35 +04:00
|
|
|
[Pure, Cached, Frozen]
|
2013-12-06 20:41:13 +04:00
|
|
|
readonly attribute sequence<GamepadButton> buttons;
|
2013-04-09 16:43:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current position of all axes on the device, an
|
|
|
|
* array of doubles.
|
|
|
|
*/
|
2013-12-16 22:06:35 +04:00
|
|
|
[Pure, Cached, Frozen]
|
2013-12-06 20:41:13 +04:00
|
|
|
readonly attribute sequence<double> axes;
|
2013-04-09 16:43:25 +04:00
|
|
|
};
|