Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * This file defines the <code>PPB_Gamepad_Dev</code> interface, which | 7 * This file defines the <code>PPB_Gamepad_Dev</code> interface, which |
| 8 * provides access to gamepad devices. | 8 * provides access to gamepad devices. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 label Chrome { | 11 label Chrome { |
| 12 M18 = 0.1 | 12 M19 = 0.1 |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 #inline c | |
| 16 #pragma pack(push, 1) | |
| 17 #endinl | |
| 18 | |
| 19 /** | 15 /** |
| 20 * The data for one gamepad device. | 16 * The data for one gamepad device. |
| 21 */ | 17 */ |
| 22 struct PP_GamepadData_Dev { | 18 [assert_size(472)] |
| 23 /** | 19 struct PP_GamepadSampleData_Dev { |
| 24 * Is there a gamepad connected at this index? If this is false, no other | |
| 25 * data in this structure is valid. | |
| 26 */ | |
| 27 char connected; | |
| 28 | |
| 29 /** | |
| 30 * String identifier for the type of device/manufacturer. | |
| 31 */ | |
| 32 uint16_t[128] id; | |
| 33 | |
| 34 /** | |
| 35 * Monotonically increasing value that is incremented when the data have | |
| 36 * been updated. | |
| 37 */ | |
| 38 uint64_t timestamp; | |
| 39 | |
| 40 /** | 20 /** |
| 41 * Number of valid elements in the |axes| array. | 21 * Number of valid elements in the |axes| array. |
| 42 */ | 22 */ |
| 43 uint32_t axes_length; | 23 uint32_t axes_length; |
| 44 | 24 |
| 45 /** | 25 /** |
| 46 * Normalized values for the axes, indices valid up to |axesLength|-1. Axis | 26 * Normalized values for the axes, indices valid up to |axes_length|-1. Axis |
| 47 * values range from -1..1, and are in order of "importance". | 27 * values range from -1..1, and are in order of "importance". |
| 48 */ | 28 */ |
| 49 float_t[16] axes; | 29 float_t[16] axes; |
| 50 | 30 |
| 51 /** | 31 /** |
| 52 * Number of valid elements in the |buttons| array. | 32 * Number of valid elements in the |buttons| array. |
| 53 */ | 33 */ |
| 54 uint32_t buttons_length; | 34 uint32_t buttons_length; |
| 55 | 35 |
| 56 /** | 36 /** |
| 57 * Normalized values for the buttons, indices valid up to |buttonsLength| | 37 * Normalized values for the buttons, indices valid up to |buttons_length| |
| 58 * - 1. Button values range from 0..1, and are in order of importance. | 38 * - 1. Button values range from 0..1, and are in order of importance. |
| 59 */ | 39 */ |
| 60 float_t[32] buttons; | 40 float_t[32] buttons; |
| 41 | |
| 42 /** | |
| 43 * Monotonically increasing value that is incremented when the data have | |
| 44 * been updated. | |
| 45 */ | |
| 46 double_t timestamp; | |
| 47 | |
| 48 /** | |
| 49 * Identifier for the type of device/manufacturer. | |
| 50 */ | |
| 51 uint16_t[128] id; | |
| 52 | |
| 53 /** | |
| 54 * Is there a gamepad connected at this index? If this is false, no other | |
| 55 * data in this structure is valid. | |
| 56 */ | |
| 57 PP_Bool connected; | |
| 58 | |
| 59 /* Padding to make the struct the same size between 64 and 32. */ | |
| 60 char[4] unused_pad_; | |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * The data for all gamepads connected to the system. | 64 * The data for all gamepads connected to the system. |
| 65 */ | 65 */ |
| 66 struct PP_GamepadsData_Dev { | 66 [assert_size(1896)] |
| 67 struct PP_GamepadsSampleData_Dev { | |
| 67 /** | 68 /** |
| 68 * Number of valid elements in the |items| array. | 69 * Number of valid elements in the |items| array. |
| 69 */ | 70 */ |
| 70 uint32_t length; | 71 uint32_t length; |
| 71 | 72 |
| 73 /* Padding to make the struct the same size between 64 and 32. */ | |
| 74 char[4] unused_pad_; | |
| 75 | |
| 72 /** | 76 /** |
| 73 * Data for an individual gamepad device connected to the system. | 77 * Data for an individual gamepad device connected to the system. |
| 74 */ | 78 */ |
| 75 PP_GamepadData_Dev[4] items; | 79 PP_GamepadSampleData_Dev[4] items; |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 #inline c | |
| 79 #pragma pack(pop) | |
| 80 #endinl | |
| 81 | |
| 82 /** | 82 /** |
| 83 * The <code>PPB_Gamepad_Dev</code> interface allows retrieving data from | 83 * The <code>PPB_Gamepad_Dev</code> interface allows retrieving data from |
| 84 * gamepad/joystick devices that are connected to the system. | 84 * gamepad/joystick devices that are connected to the system. |
| 85 */ | 85 */ |
| 86 [version=0.1, macro="PPB_GAMEPAD_DEV_INTERFACE"] | 86 [version=0.1, macro="PPB_GAMEPAD_DEV_INTERFACE"] |
|
brettw
2012/02/27 17:44:20
Can you bump the version? (Also at the top with th
scottmg
2012/02/27 21:29:48
Done.
| |
| 87 interface PPB_Gamepad_Dev { | 87 interface PPB_Gamepad_Dev { |
| 88 /** | 88 /** |
| 89 * Samples the current state of the connected gamepads. | 89 * Samples the current state of the connected gamepads. |
| 90 */ | 90 */ |
| 91 void SampleGamepads( | 91 void Sample( |
| 92 [in] PP_Instance instance, | 92 [in] PP_Instance instance, |
| 93 [out] PP_GamepadsData_Dev data); | 93 [out] PP_GamepadsSampleData_Dev data); |
| 94 | 94 |
| 95 }; | 95 }; |
| OLD | NEW |