Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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 <cstdint> | |
|
spang
2017/04/21 05:38:47
<stdint.h>
jkwang
2017/04/25 21:16:41
Done.
| |
| 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_L2 = 6, | |
| 25 WG_BUTTON_R2 = 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 }; | |
| 36 | |
| 37 // This WebGamepadAbsType matches the index of gamepad abs defined in w3c | |
| 38 // standard gamepad. | |
| 39 enum WebGamepadAbsType { | |
| 40 WG_ABS_X = 0, | |
| 41 WG_ABS_Y = 1, | |
| 42 WG_ABS_Z = 2, | |
| 43 WG_ABS_RZ = 3 | |
| 44 }; | |
| 45 | |
| 46 constexpr uint16_t kWebGamepadBtnCnt = 17; | |
| 47 constexpr uint16_t kWebGamepadAbsCnt = 4; | |
| 48 | |
| 49 // Following constants are used to normalize abs values to web gamepad standard. | |
| 50 constexpr double kWebGamepadTriggerMin = 0.0; | |
| 51 constexpr double kWebGamepadTriggerMax = 1.0; | |
| 52 constexpr double kWebGamepadJoystickMin = -1.0; | |
| 53 constexpr double kWebGamepadJoystickMax = 1.0; | |
| 54 | |
| 55 } // namespace ui | |
| 56 | |
| 57 #endif // UI_EVENTS_OZONE_EVDEV_WEBGAMEPAD_CONSTANTS_H_ | |
| OLD | NEW |