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</code> interface, which | 7 * This file defines the <code>PPB_Gamepad</code> interface, which |
| 8 * provides access to gamepad devices. | 8 * provides access to gamepad devices. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 [generate_thunk] | 11 [generate_thunk] |
| 12 | 12 |
| 13 label Chrome { | 13 label Chrome { |
| 14 M19 = 1.0 | 14 M19 = 1.0, |
| 15 M36 = 1.1 | |
| 15 }; | 16 }; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * The data for one gamepad device. | 19 * The data for one gamepad device. |
| 19 */ | 20 */ |
| 20 [assert_size(472)] | 21 [assert_size(672)] |
| 21 struct PP_GamepadSampleData { | 22 struct PP_GamepadSampleData { |
| 22 /** | 23 /** |
| 23 * Number of valid elements in the |axes| array. | 24 * Number of valid elements in the |axes| array. |
| 24 */ | 25 */ |
| 25 uint32_t axes_length; | 26 uint32_t axes_length; |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * Normalized values for the axes, indices valid up to |axes_length|-1. Axis | 29 * Normalized values for the axes, indices valid up to |axes_length|-1. Axis |
| 29 * values range from -1..1, and are in order of "importance". | 30 * values range from -1..1, and are in order of "importance". |
| 30 */ | 31 */ |
| 32 [version = 1.0] | |
| 31 float_t[16] axes; | 33 float_t[16] axes; |
| 32 | 34 |
| 33 /** | 35 /** |
| 36 * Normalized values for the axes, indices valid up to |axes_length|-1. Axis | |
| 37 * values range from -1..1, and are in order of "importance". | |
| 38 */ | |
| 39 [version = 1.1] | |
| 40 double_t[16] axes; | |
| 41 | |
| 42 /** | |
| 34 * Number of valid elements in the |buttons| array. | 43 * Number of valid elements in the |buttons| array. |
| 35 */ | 44 */ |
| 36 uint32_t buttons_length; | 45 uint32_t buttons_length; |
| 37 | 46 |
| 38 /** | 47 /** |
| 39 * Normalized values for the buttons, indices valid up to |buttons_length| | 48 * Normalized values for the buttons, indices valid up to |buttons_length| |
| 40 * - 1. Button values range from 0..1, and are in order of importance. | 49 * - 1. Button values range from 0..1, and are in order of importance. |
| 41 */ | 50 */ |
| 51 [version = 1.0] | |
| 42 float_t[32] buttons; | 52 float_t[32] buttons; |
| 43 | 53 |
| 44 /** | 54 /** |
| 55 * Normalized values for the buttons, indices valid up to |buttons_length| | |
| 56 * - 1. Button values range from 0..1, and are in order of importance. | |
| 57 */ | |
| 58 [version = 1.1] | |
| 59 double_t[32] buttons; | |
| 60 | |
| 61 /** | |
| 45 * Monotonically increasing value that is incremented when the data have | 62 * Monotonically increasing value that is incremented when the data have |
| 46 * been updated. | 63 * been updated. |
| 47 */ | 64 */ |
| 48 double_t timestamp; | 65 double_t timestamp; |
| 49 | 66 |
| 50 /** | 67 /** |
| 51 * Identifier for the type of device/manufacturer. | 68 * Identifier for the type of device/manufacturer. |
| 52 */ | 69 */ |
| 53 uint16_t[128] id; | 70 uint16_t[128] id; |
| 54 | 71 |
| 55 /** | 72 /** |
| 56 * Is there a gamepad connected at this index? If this is false, no other | 73 * Is there a gamepad connected at this index? If this is false, no other |
| 57 * data in this structure is valid. | 74 * data in this structure is valid. |
| 58 */ | 75 */ |
| 59 PP_Bool connected; | 76 PP_Bool connected; |
| 60 | 77 |
| 61 /* Padding to make the struct the same size between 64 and 32. */ | 78 /* Padding to make the struct the same size between 64 and 32. */ |
| 62 char[4] unused_pad_; | 79 char[4] unused_pad_; |
| 63 }; | 80 }; |
| 64 | 81 |
| 65 /** | 82 /** |
| 66 * The data for all gamepads connected to the system. | 83 * The data for all gamepads connected to the system. |
| 67 */ | 84 */ |
| 68 [assert_size(1896)] | 85 [assert_size(2696)] |
| 69 struct PP_GamepadsSampleData { | 86 struct PP_GamepadsSampleData { |
| 70 /** | 87 /** |
| 71 * Number of valid elements in the |items| array. | 88 * Number of valid elements in the |items| array. |
| 72 */ | 89 */ |
| 73 uint32_t length; | 90 uint32_t length; |
| 74 | 91 |
| 75 /* Padding to make the struct the same size between 64 and 32. */ | 92 /* Padding to make the struct the same size between 64 and 32. */ |
| 76 char[4] unused_pad_; | 93 char[4] unused_pad_; |
| 77 | 94 |
| 78 /** | 95 /** |
| 79 * Data for an individual gamepad device connected to the system. | 96 * Data for an individual gamepad device connected to the system. |
| 80 */ | 97 */ |
| 81 PP_GamepadSampleData[4] items; | 98 PP_GamepadSampleData[4] items; |
| 82 }; | 99 }; |
| 83 | 100 |
| 84 /** | 101 /** |
| 85 * The <code>PPB_Gamepad</code> interface allows retrieving data from | 102 * The <code>PPB_Gamepad</code> interface allows retrieving data from |
| 86 * gamepad/joystick devices that are connected to the system. | 103 * gamepad/joystick devices that are connected to the system. |
| 87 */ | 104 */ |
| 88 [version=1.0, macro="PPB_GAMEPAD_INTERFACE", singleton] | 105 [version=1.0, macro="PPB_GAMEPAD_INTERFACE", singleton] |
|
dmichael (off chromium)
2014/05/14 15:14:04
This needs a new version (1.1). I'm not certain ho
| |
| 89 interface PPB_Gamepad { | 106 interface PPB_Gamepad { |
| 90 /** | 107 /** |
| 91 * Samples the current state of the available gamepads. | 108 * Samples the current state of the available gamepads. |
| 92 */ | 109 */ |
| 93 [always_set_output_parameters] | 110 [always_set_output_parameters] |
| 94 void Sample( | 111 void Sample( |
| 95 [in] PP_Instance instance, | 112 [in] PP_Instance instance, |
| 96 [out] PP_GamepadsSampleData data); | 113 [out] PP_GamepadsSampleData data); |
| 97 }; | 114 }; |
| OLD | NEW |