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 #ifndef PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 bool hasPosition; | 42 bool hasPosition; |
43 | 43 |
44 WebKitGamepadQuaternion orientation; | 44 WebKitGamepadQuaternion orientation; |
45 WebKitGamepadVector position; | 45 WebKitGamepadVector position; |
46 WebKitGamepadVector angularVelocity; | 46 WebKitGamepadVector angularVelocity; |
47 WebKitGamepadVector linearVelocity; | 47 WebKitGamepadVector linearVelocity; |
48 WebKitGamepadVector angularAcceleration; | 48 WebKitGamepadVector angularAcceleration; |
49 WebKitGamepadVector linearAcceleration; | 49 WebKitGamepadVector linearAcceleration; |
50 }; | 50 }; |
51 | 51 |
| 52 enum WebKitGamepadHand { |
| 53 WEBKIT_GAMEPAD_HAND_NONE = 0, |
| 54 WEBKIT_GAMEPAD_HAND_LEFT = 1, |
| 55 WEBKIT_GAMEPAD_HAND_RIGHT = 2 |
| 56 }; |
| 57 |
52 // This must match the definition of blink::Gamepad. The GamepadHost unit test | 58 // This must match the definition of blink::Gamepad. The GamepadHost unit test |
53 // has some compile asserts to validate this. | 59 // has some compile asserts to validate this. |
54 struct WebKitGamepad { | 60 struct WebKitGamepad { |
55 static const size_t kIdLengthCap = 128; | 61 static const size_t kIdLengthCap = 128; |
56 static const size_t kMappingLengthCap = 16; | 62 static const size_t kMappingLengthCap = 16; |
57 static const size_t kAxesLengthCap = 16; | 63 static const size_t kAxesLengthCap = 16; |
58 static const size_t kButtonsLengthCap = 32; | 64 static const size_t kButtonsLengthCap = 32; |
59 | 65 |
60 // Is there a gamepad connected at this index? | 66 // Is there a gamepad connected at this index? |
61 bool connected; | 67 bool connected; |
(...skipping 14 matching lines...) Expand all Loading... |
76 // Number of valid entries in the buttons array. | 82 // Number of valid entries in the buttons array. |
77 unsigned buttons_length; | 83 unsigned buttons_length; |
78 | 84 |
79 // Normalized values representing buttons, in the range [0..1]. | 85 // Normalized values representing buttons, in the range [0..1]. |
80 WebKitGamepadButton buttons[kButtonsLengthCap]; | 86 WebKitGamepadButton buttons[kButtonsLengthCap]; |
81 | 87 |
82 // Mapping type (for example "standard") | 88 // Mapping type (for example "standard") |
83 base::char16 mapping[kMappingLengthCap]; | 89 base::char16 mapping[kMappingLengthCap]; |
84 | 90 |
85 WebKitGamepadPose pose; | 91 WebKitGamepadPose pose; |
| 92 |
| 93 WebKitGamepadHand hand; |
86 }; | 94 }; |
87 | 95 |
88 // This must match the definition of blink::Gamepads. The GamepadHost unit | 96 // This must match the definition of blink::Gamepads. The GamepadHost unit |
89 // test has some compile asserts to validate this. | 97 // test has some compile asserts to validate this. |
90 struct WebKitGamepads { | 98 struct WebKitGamepads { |
91 static const size_t kItemsLengthCap = 4; | 99 static const size_t kItemsLengthCap = 4; |
92 | 100 |
93 // Number of valid entries in the items array. | 101 // Number of valid entries in the items array. |
94 unsigned length; | 102 unsigned length; |
95 | 103 |
(...skipping 11 matching lines...) Expand all Loading... |
107 | 115 |
108 #pragma pack(pop) | 116 #pragma pack(pop) |
109 | 117 |
110 PPAPI_SHARED_EXPORT void ConvertWebKitGamepadData( | 118 PPAPI_SHARED_EXPORT void ConvertWebKitGamepadData( |
111 const WebKitGamepads& webkit_data, | 119 const WebKitGamepads& webkit_data, |
112 PP_GamepadsSampleData* output_data); | 120 PP_GamepadsSampleData* output_data); |
113 | 121 |
114 } // namespace ppapi | 122 } // namespace ppapi |
115 | 123 |
116 #endif // PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ | 124 #endif // PPAPI_SHARED_IMPL_PPB_GAMEPAD_SHARED_H_ |
OLD | NEW |