Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: ui/events/ozone/gamepad/webgamepad_constants.h

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Support Gamepad in Ozone. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <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_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;
scottmg 2017/05/01 18:20:53 Can you make these values in their respective enum
jkwang 2017/05/01 22:21:57 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698