1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/Gamepad.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +[Pref="dom.gamepad.enabled"] 1.10 +interface GamepadButton { 1.11 + readonly attribute boolean pressed; 1.12 + readonly attribute double value; 1.13 +}; 1.14 + 1.15 +[Pref="dom.gamepad.enabled"] 1.16 +interface Gamepad { 1.17 + /** 1.18 + * An identifier, unique per type of device. 1.19 + */ 1.20 + readonly attribute DOMString id; 1.21 + 1.22 + /** 1.23 + * The game port index for the device. Unique per device 1.24 + * attached to this system. 1.25 + */ 1.26 + readonly attribute unsigned long index; 1.27 + 1.28 + /** 1.29 + * The mapping in use for this device. The empty string 1.30 + * indicates that no mapping is in use. 1.31 + */ 1.32 + readonly attribute DOMString mapping; 1.33 + 1.34 + /** 1.35 + * true if this gamepad is currently connected to the system. 1.36 + */ 1.37 + readonly attribute boolean connected; 1.38 + 1.39 + /** 1.40 + * The current state of all buttons on the device, an 1.41 + * array of GamepadButton. 1.42 + */ 1.43 + [Pure, Cached, Frozen] 1.44 + readonly attribute sequence<GamepadButton> buttons; 1.45 + 1.46 + /** 1.47 + * The current position of all axes on the device, an 1.48 + * array of doubles. 1.49 + */ 1.50 + [Pure, Cached, Frozen] 1.51 + readonly attribute sequence<double> axes; 1.52 +};