| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_EVENTS_OZONE_GAMEPAD_WEBGAMEPAD_CONSTANTS_H_ |
| 6 #define UI_EVENTS_OZONE_GAMEPAD_WEBGAMEPAD_CONSTANTS_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 // We care about three type of gamepad events. |
| 13 enum class GamepadEventType { BUTTON, AXIS, FRAME }; |
| 14 |
| 15 // This WebGamepadButtonType matches the index of gamepad button defined in w3c |
| 16 // standard gamepad. |
| 17 enum WebGamepadButtonType { |
| 18 WG_BUTTON_A = 0, |
| 19 WG_BUTTON_B = 1, |
| 20 WG_BUTTON_X = 2, |
| 21 WG_BUTTON_Y = 3, |
| 22 WG_BUTTON_L1 = 4, |
| 23 WG_BUTTON_R1 = 5, |
| 24 WG_BUTTON_LT = 6, |
| 25 WG_BUTTON_RT = 7, |
| 26 WG_BUTTON_SELECT = 8, |
| 27 WG_BUTTON_START = 9, |
| 28 WG_BUTTON_THUMBL = 10, |
| 29 WG_BUTTON_THUMBR = 11, |
| 30 WG_BUTTON_DPAD_UP = 12, |
| 31 WG_BUTTON_DPAD_DOWN = 13, |
| 32 WG_BUTTON_DPAD_LEFT = 14, |
| 33 WG_BUTTON_DPAD_RIGHT = 15, |
| 34 WG_BUTTON_MODE = 16, |
| 35 WG_BUTTON_COUNT = 17 |
| 36 }; |
| 37 |
| 38 // This WebGamepadAbsType matches the index of gamepad abs defined in w3c |
| 39 // standard gamepad. |
| 40 enum WebGamepadAbsType { |
| 41 WG_ABS_X = 0, |
| 42 WG_ABS_Y = 1, |
| 43 WG_ABS_RX = 2, |
| 44 WG_ABS_RY = 3, |
| 45 WG_ABS_COUNT = 4 |
| 46 }; |
| 47 |
| 48 // Following constants are used to normalize abs values to web gamepad standard. |
| 49 constexpr double kWebGamepadTriggerMin = 0.0; |
| 50 constexpr double kWebGamepadTriggerMax = 1.0; |
| 51 constexpr double kWebGamepadJoystickMin = -1.0; |
| 52 constexpr double kWebGamepadJoystickMax = 1.0; |
| 53 |
| 54 } // namespace ui |
| 55 |
| 56 #endif // UI_EVENTS_OZONE_EVDEV_WEBGAMEPAD_CONSTANTS_H_ |
| OLD | NEW |