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 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ | 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ | 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ |
| 7 | 7 |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 | 9 #include "content/common/gamepad_hardware_buffer.h" |
| 10 namespace blink { | |
| 11 class WebGamepad; | |
| 12 } | |
| 13 | 10 |
| 14 namespace content { | 11 namespace content { |
| 15 | 12 |
| 16 typedef void (*GamepadStandardMappingFunction)( | 13 typedef void (*GamepadStandardMappingFunction)( |
| 17 const blink::WebGamepad& original, | 14 const blink::WebGamepad& original, |
| 18 blink::WebGamepad* mapped); | 15 blink::WebGamepad* mapped); |
| 19 | 16 |
| 20 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( | 17 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( |
| 21 const base::StringPiece& vendor_id, | 18 const base::StringPiece& vendor_id, |
| 22 const base::StringPiece& product_id); | 19 const base::StringPiece& product_id); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 49 }; | 46 }; |
| 50 | 47 |
| 51 enum CanonicalAxisIndex { | 48 enum CanonicalAxisIndex { |
| 52 kAxisLeftStickX, | 49 kAxisLeftStickX, |
| 53 kAxisLeftStickY, | 50 kAxisLeftStickY, |
| 54 kAxisRightStickX, | 51 kAxisRightStickX, |
| 55 kAxisRightStickY, | 52 kAxisRightStickY, |
| 56 kNumAxes | 53 kNumAxes |
| 57 }; | 54 }; |
| 58 | 55 |
| 56 const float default_button_pressed_threshold = 0.1f; | |
|
scottmg
2014/02/20 01:15:13
kDefaultButtonPressedThreshold
(and possibly shar
| |
| 57 | |
| 58 // Common mapping functions | |
| 59 blink::WebGamepadButton AxisToButton(float input); | |
| 60 blink::WebGamepadButton AxisNegativeAsButton(float input); | |
| 61 blink::WebGamepadButton AxisPositiveAsButton(float input); | |
| 62 void DpadFromAxis(blink::WebGamepad* mapped, float dir); | |
| 63 | |
| 59 } // namespace content | 64 } // namespace content |
| 60 | 65 |
| 61 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ | 66 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_ |
| OLD | NEW |