Chromium Code Reviews| Index: ppapi/api/dev/ppb_gamepad_dev.idl |
| diff --git a/ppapi/api/dev/ppb_gamepad_dev.idl b/ppapi/api/dev/ppb_gamepad_dev.idl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f940b3bbb4fa6886807f6eb09b36179d0c30c5c6 |
| --- /dev/null |
| +++ b/ppapi/api/dev/ppb_gamepad_dev.idl |
| @@ -0,0 +1,89 @@ |
| +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +/** |
| + * This file defines the <code>PPB_Gamepad_Dev</code> interface, which |
| + * provides access to gamepad devices. |
| + */ |
| + |
| +label Chrome { |
| + M18 = 0.1 |
| +}; |
| + |
| +/** |
| + * The data for one gamepad device. |
| + */ |
| +[assert_size(472)] |
| +struct PP_GamepadData_Dev { |
| + /** |
| + * Is there a gamepad connected at this index? If this is false, no other |
| + * data in this structure is valid. |
| + */ |
| + uint32_t connected; |
| + |
| + /** |
| + * String identifier for the type of device/manufacturer. |
| + */ |
| + uint16_t[128] id; |
|
brettw
2012/01/05 22:50:04
This is the same thing as uint16_t id[128], right?
scottmg
2012/01/06 00:54:21
Yes, it's just an array of ushorts. C-style doesn'
|
| + |
| + /** |
| + * Monotonically increasing value that is incremented when the data have |
| + * been updated. |
| + */ |
| + uint64_t timestamp; |
| + |
| + /** |
| + * Number of valid elements in the |axes| array. |
| + */ |
| + uint32_t axesLength; |
|
brettw
2012/01/05 22:50:04
Google style would be axes_length (same for button
scottmg
2012/01/06 00:54:21
Done.
|
| + |
| + /** |
| + * Normalized values for the axes, indices valid up to |axesLength|-1. Axis |
| + * values range from -1..1, and are in order of "importance". |
| + */ |
| + float_t[16] axes; |
| + |
| + /** |
| + * Number of valid elements in the |buttons| array. |
| + */ |
| + uint32_t buttonsLength; |
| + |
| + /** |
| + * Normalized values for the buttons, indices valid up to |buttonsLength| |
| + * - 1. Button values range from 0..1, and are in order of importance. |
| + */ |
| + float_t[32] buttons; |
|
brettw
2012/01/05 22:50:04
In other places, we've just done "float" rather th
scottmg
2012/01/06 00:54:21
Yeah, that's what I did at first, but doesn't seem
|
| +}; |
| + |
| +/** |
| + * The data for all gamepads connected to the system. |
| + */ |
| +[assert_size(1896)] |
| +struct PP_GamepadsData_Dev { |
| + /** |
| + * Number of valid elements in the |items| array. |
| + */ |
| + uint32_t length; |
| + |
| + /** |
| + * Data for an individual gamepad device connected to the system. |
| + */ |
| + PP_GamepadData_Dev[4] items; |
| +}; |
| + |
| +/** |
| + * The <code>PPB_Gamepad_Dev</code> interface contains pointers to several |
|
brettw
2012/01/05 22:50:04
This is wrong because you only provide a pointer t
scottmg
2012/01/06 00:54:21
Done. (I plead guilty to some copy-paste-o-rama)
|
| + * functions for retrieving gamepad data. |
| + */ |
| +[version=0.1, macro="PPB_GAMEPAD_DEV_INTERFACE"] |
| +interface PPB_Gamepad_Dev { |
| + /** |
| + * Samples the current state of the connected gamepads. |
| + */ |
| + void SampleGamepads( |
| + [in] PP_Instance instance, |
| + [out] PP_GamepadsData_Dev data); |
| + |
| +}; |