Debian Codegraph @

xbmc/input/joysticks/JoystickTypes.h

raw
1 /*
2 * Copyright (C) 2014-2024 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include "input/InputTypes.h"
12
13 #include <set>
14 #include <string>
15
16 /// \ingroup joystick
17 /// \{
18
19 namespace KODI
20 {
21 namespace JOYSTICK
22 {
23 /*!
24 * \brief Name of a physical feature belonging to the joystick
25 */
26 using FeatureName = std::string;
27
28 /*!
29 * \brief Types of features used in the joystick library
30 *
31 * Available types:
32 *
33 * 1) scalar[*]
34 * 2) analog stick
35 * 3) accelerometer
36 * 4) rumble motor
37 * 5) relative pointer
38 * 6) absolute pointer
39 * 7) wheel
40 * 8) throttle
41 * 9) keyboard key
42 *
43 * [*] All three driver primitives (buttons, hats and axes) have a state that
44 * can be represented using a single scalar value. For this reason,
45 * features that map to a single primitive are called "scalar features".
46 */
47 enum class FEATURE_TYPE
48 {
49 UNKNOWN,
50 SCALAR,
51 ANALOG_STICK,
52 ACCELEROMETER,
53 MOTOR,
54 RELPOINTER,
55 ABSPOINTER,
56 WHEEL,
57 THROTTLE,
58 KEY,
59 };
60
61 /*!
62 * \brief Categories of features used in the joystick library
63 */
64 enum class FEATURE_CATEGORY
65 {
66 UNKNOWN,
67 FACE,
68 SHOULDER,
69 TRIGGER,
70 ANALOG_STICK,
71 ACCELEROMETER,
72 HAPTICS,
73 MOUSE_BUTTON,
74 POINTER,
75 LIGHTGUN,
76 OFFSCREEN, // Virtual button to shoot light gun offscreen
77 KEY, // A keyboard key
78 KEYPAD, // A key on a numeric keymap, including star and pound
79 HARDWARE, // A button or functionality on the console
80 WHEEL,
81 JOYSTICK,
82 PADDLE,
83 };
84
85 /*!
86 * \brief Direction arrows on the hat (directional pad)
87 */
88 using HAT_DIRECTION = INPUT::CARDINAL_DIRECTION;
89
90 /*!
91 * \brief States in which a hat can be
92 */
93 using HAT_STATE = INPUT::INTERCARDINAL_DIRECTION;
94
95 /*!
96 * \brief Typedef for analog stick directions
97 */
98 using ANALOG_STICK_DIRECTION = INPUT::CARDINAL_DIRECTION;
99
100 /*!
101 * \brief Directions of motion for a relative pointer
102 */
103 using RELATIVE_POINTER_DIRECTION = INPUT::CARDINAL_DIRECTION;
104
105 /*!
106 * \brief Directions in which a semiaxis can point
107 */
108 enum class SEMIAXIS_DIRECTION
109 {
110 NEGATIVE = -1, // semiaxis lies in the interval [-1.0, 0.0]
111 ZERO = 0, // semiaxis is unknown or invalid
112 POSITIVE = 1, // semiaxis lies in the interval [0.0, 1.0]
113 };
114
115 /*!
116 * \brief Directions on a wheel
117 */
118 enum class WHEEL_DIRECTION
119 {
120 NONE,
121 RIGHT,
122 LEFT,
123 };
124
125 /*!
126 * \brief Directions on a throttle
127 */
128 enum class THROTTLE_DIRECTION
129 {
130 NONE,
131 UP,
132 DOWN,
133 };
134
135 /*!
136 * \brief Types of input available for scalar features
137 */
138 enum class INPUT_TYPE
139 {
140 UNKNOWN,
141 DIGITAL,
142 ANALOG,
143 };
144
145 /*!
146 * \brief Type of driver primitive
147 */
148 enum class PRIMITIVE_TYPE
149 {
150 UNKNOWN = 0, // primitive has no type (invalid)
151 BUTTON, // a digital button
152 HAT, // one of the four direction arrows on a D-pad
153 SEMIAXIS, // the positive or negative half of an axis
154 MOTOR, // a rumble motor
155 KEY, // a keyboard key
156 MOUSE_BUTTON, // a mouse button
157 RELATIVE_POINTER, // a relative pointer, such as on a mouse
158 };
159 } // namespace JOYSTICK
160 } // namespace KODI
161
162 /// \}