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 16 matching lines...) Expand all Loading... |
27 #include "WebCommon.h" | 27 #include "WebCommon.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 #pragma pack(push, 1) | 31 #pragma pack(push, 1) |
32 | 32 |
33 class WebGamepadButton { | 33 class WebGamepadButton { |
34 public: | 34 public: |
35 WebGamepadButton() | 35 WebGamepadButton() |
36 : pressed(false) | 36 : pressed(false) |
| 37 , touched(false) |
37 , value(0.) | 38 , value(0.) |
38 { | 39 { |
39 } | 40 } |
40 WebGamepadButton(bool pressed, double value) | 41 WebGamepadButton(bool pressed, bool touched, double value) |
41 : pressed(pressed) | 42 : pressed(pressed) |
| 43 , touched(touched) |
42 , value(value) | 44 , value(value) |
43 { | 45 { |
44 } | 46 } |
45 bool pressed; | 47 bool pressed; |
| 48 bool touched; |
46 double value; | 49 double value; |
47 }; | 50 }; |
48 | 51 |
49 // This structure is intentionally POD and fixed size so that it can be shared | 52 // This structure is intentionally POD and fixed size so that it can be shared |
50 // memory between hardware polling threads and the rest of the browser. See | 53 // memory between hardware polling threads and the rest of the browser. See |
51 // also WebGamepads.h. | 54 // also WebGamepads.h. |
52 class WebGamepad { | 55 class WebGamepad { |
53 public: | 56 public: |
54 static const size_t idLengthCap = 128; | 57 static const size_t idLengthCap = 128; |
55 static const size_t mappingLengthCap = 16; | 58 static const size_t mappingLengthCap = 16; |
(...skipping 29 matching lines...) Expand all Loading... |
85 // Number of valid entries in the buttons array. | 88 // Number of valid entries in the buttons array. |
86 unsigned buttonsLength; | 89 unsigned buttonsLength; |
87 | 90 |
88 // Button states | 91 // Button states |
89 WebGamepadButton buttons[buttonsLengthCap]; | 92 WebGamepadButton buttons[buttonsLengthCap]; |
90 | 93 |
91 // Mapping type (for example "standard") | 94 // Mapping type (for example "standard") |
92 WebUChar mapping[mappingLengthCap]; | 95 WebUChar mapping[mappingLengthCap]; |
93 }; | 96 }; |
94 | 97 |
95 static_assert(sizeof(WebGamepad) == 721, "WebGamepad has wrong size"); | 98 static_assert(sizeof(WebGamepad) == 753, "WebGamepad has wrong size"); |
96 | 99 |
97 #pragma pack(pop) | 100 #pragma pack(pop) |
98 | 101 |
99 } | 102 } |
100 | 103 |
101 #endif // WebGamepad_h | 104 #endif // WebGamepad_h |
OLD | NEW |