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