| Index: device/gamepad/gamepad_standard_mappings.cc
|
| diff --git a/device/gamepad/gamepad_standard_mappings.cc b/device/gamepad/gamepad_standard_mappings.cc
|
| index d76d06dd9f273648fe5955b42719ad43fd958c88..e4aaf696716374c3d5710b0ee0bfe2eabf99d4ea 100644
|
| --- a/device/gamepad/gamepad_standard_mappings.cc
|
| +++ b/device/gamepad/gamepad_standard_mappings.cc
|
| @@ -8,27 +8,33 @@ namespace device {
|
|
|
| blink::WebGamepadButton AxisToButton(float input) {
|
| float value = (input + 1.f) / 2.f;
|
| - return blink::WebGamepadButton(value > kDefaultButtonPressedThreshold, value);
|
| + bool pressed = value > kDefaultButtonPressedThreshold;
|
| + bool touched = value > 0.0f;
|
| + return blink::WebGamepadButton(pressed, touched, value);
|
| }
|
|
|
| blink::WebGamepadButton AxisNegativeAsButton(float input) {
|
| float value = (input < -0.5f) ? 1.f : 0.f;
|
| - return blink::WebGamepadButton(value > kDefaultButtonPressedThreshold, value);
|
| + bool pressed = value > kDefaultButtonPressedThreshold;
|
| + bool touched = value > 0.0f;
|
| + return blink::WebGamepadButton(pressed, touched, value);
|
| }
|
|
|
| blink::WebGamepadButton AxisPositiveAsButton(float input) {
|
| float value = (input > 0.5f) ? 1.f : 0.f;
|
| - return blink::WebGamepadButton(value > kDefaultButtonPressedThreshold, value);
|
| + bool pressed = value > kDefaultButtonPressedThreshold;
|
| + bool touched = value > 0.0f;
|
| + return blink::WebGamepadButton(pressed, touched, value);
|
| }
|
|
|
| blink::WebGamepadButton ButtonFromButtonAndAxis(blink::WebGamepadButton button,
|
| float axis) {
|
| float value = (axis + 1.f) / 2.f;
|
| - return blink::WebGamepadButton(button.pressed, value);
|
| + return blink::WebGamepadButton(button.pressed, button.touched, value);
|
| }
|
|
|
| blink::WebGamepadButton NullButton() {
|
| - return blink::WebGamepadButton(false, 0.0);
|
| + return blink::WebGamepadButton(false, false, 0.0);
|
| }
|
|
|
| void DpadFromAxis(blink::WebGamepad* mapped, float dir) {
|
| @@ -49,12 +55,16 @@ void DpadFromAxis(blink::WebGamepad* mapped, float dir) {
|
| }
|
|
|
| mapped->buttons[BUTTON_INDEX_DPAD_UP].pressed = up;
|
| + mapped->buttons[BUTTON_INDEX_DPAD_UP].touched = up;
|
| mapped->buttons[BUTTON_INDEX_DPAD_UP].value = up ? 1.f : 0.f;
|
| mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].pressed = right;
|
| + mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].touched = right;
|
| mapped->buttons[BUTTON_INDEX_DPAD_RIGHT].value = right ? 1.f : 0.f;
|
| mapped->buttons[BUTTON_INDEX_DPAD_DOWN].pressed = down;
|
| + mapped->buttons[BUTTON_INDEX_DPAD_DOWN].touched = down;
|
| mapped->buttons[BUTTON_INDEX_DPAD_DOWN].value = down ? 1.f : 0.f;
|
| mapped->buttons[BUTTON_INDEX_DPAD_LEFT].pressed = left;
|
| + mapped->buttons[BUTTON_INDEX_DPAD_LEFT].touched = left;
|
| mapped->buttons[BUTTON_INDEX_DPAD_LEFT].value = left ? 1.f : 0.f;
|
| }
|
|
|
|
|