OLD | NEW |
1 // Copyright (C) 2011, Google Inc. All rights reserved. | 1 // Copyright (C) 2011, Google Inc. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are met: | 4 // modification, are permitted provided that the following conditions are met: |
5 // | 5 // |
6 // 1. Redistributions of source code must retain the above copyright | 6 // 1. Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // 2. Redistributions in binary form must reproduce the above copyright | 8 // 2. Redistributions in binary form must reproduce the above copyright |
9 // notice, this list of conditions and the following disclaimer in the | 9 // notice, this list of conditions and the following disclaimer in the |
10 // documentation and/or other materials provided with the distribution. | 10 // documentation and/or other materials provided with the distribution. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 bool hasPosition; | 84 bool hasPosition; |
85 | 85 |
86 WebGamepadQuaternion orientation; | 86 WebGamepadQuaternion orientation; |
87 WebGamepadVector position; | 87 WebGamepadVector position; |
88 WebGamepadVector angularVelocity; | 88 WebGamepadVector angularVelocity; |
89 WebGamepadVector linearVelocity; | 89 WebGamepadVector linearVelocity; |
90 WebGamepadVector angularAcceleration; | 90 WebGamepadVector angularAcceleration; |
91 WebGamepadVector linearAcceleration; | 91 WebGamepadVector linearAcceleration; |
92 }; | 92 }; |
93 | 93 |
| 94 enum WebGamepadHand { |
| 95 GamepadHandNone = 0, |
| 96 GamepadHandLeft = 1, |
| 97 GamepadHandRight = 2 |
| 98 }; |
| 99 |
94 // This structure is intentionally POD and fixed size so that it can be shared | 100 // This structure is intentionally POD and fixed size so that it can be shared |
95 // memory between hardware polling threads and the rest of the browser. See | 101 // memory between hardware polling threads and the rest of the browser. See |
96 // also WebGamepads.h. | 102 // also WebGamepads.h. |
97 class WebGamepad { | 103 class WebGamepad { |
98 public: | 104 public: |
99 static const size_t idLengthCap = 128; | 105 static const size_t idLengthCap = 128; |
100 static const size_t mappingLengthCap = 16; | 106 static const size_t mappingLengthCap = 16; |
101 static const size_t axesLengthCap = 16; | 107 static const size_t axesLengthCap = 16; |
102 static const size_t buttonsLengthCap = 32; | 108 static const size_t buttonsLengthCap = 32; |
103 | 109 |
(...skipping 26 matching lines...) Expand all Loading... |
130 // Number of valid entries in the buttons array. | 136 // Number of valid entries in the buttons array. |
131 unsigned buttonsLength; | 137 unsigned buttonsLength; |
132 | 138 |
133 // Button states | 139 // Button states |
134 WebGamepadButton buttons[buttonsLengthCap]; | 140 WebGamepadButton buttons[buttonsLengthCap]; |
135 | 141 |
136 // Mapping type (for example "standard") | 142 // Mapping type (for example "standard") |
137 WebUChar mapping[mappingLengthCap]; | 143 WebUChar mapping[mappingLengthCap]; |
138 | 144 |
139 WebGamepadPose pose; | 145 WebGamepadPose pose; |
| 146 |
| 147 WebGamepadHand hand; |
140 }; | 148 }; |
141 | 149 |
142 static_assert(sizeof(WebGamepad) == 838, "WebGamepad has wrong size"); | |
143 | |
144 #pragma pack(pop) | 150 #pragma pack(pop) |
145 | 151 |
146 } | 152 } |
147 | 153 |
148 #endif // WebGamepad_h | 154 #endif // WebGamepad_h |
OLD | NEW |