#ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_
#define CONTENT_BROWSER_GAMEPAD_GAMEPAD_STANDARD_MAPPINGS_H_
#include "base/strings/string_piece.h"
#include "content/common/gamepad_hardware_buffer.h"
namespace content {
typedef void (*GamepadStandardMappingFunction)(
const blink::WebGamepad& original,
blink::WebGamepad* mapped);
GamepadStandardMappingFunction GetGamepadStandardMappingFunction(
const base::StringPiece& vendor_id,
const base::StringPiece& product_id);
enum CanonicalButtonIndex {
kButtonPrimary,
kButtonSecondary,
kButtonTertiary,
kButtonQuaternary,
kButtonLeftShoulder,
kButtonRightShoulder,
kButtonLeftTrigger,
kButtonRightTrigger,
kButtonBackSelect,
kButtonStart,
kButtonLeftThumbstick,
kButtonRightThumbstick,
kButtonDpadUp,
kButtonDpadDown,
kButtonDpadLeft,
kButtonDpadRight,
kButtonMeta,
kNumButtons
};
enum CanonicalAxisIndex {
kAxisLeftStickX,
kAxisLeftStickY,
kAxisRightStickX,
kAxisRightStickY,
kNumAxes
};
const float kDefaultButtonPressedThreshold = 30.f/255.f;
blink::WebGamepadButton AxisToButton(float input);
blink::WebGamepadButton AxisNegativeAsButton(float input);
blink::WebGamepadButton AxisPositiveAsButton(float input);
blink::WebGamepadButton ButtonFromButtonAndAxis(
blink::WebGamepadButton button, float axis);
void DpadFromAxis(blink::WebGamepad* mapped, float dir);
}
#endif