xbmc
JoystickTypes.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2018 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 
16 #include "input/InputTypes.h"
17 
18 #include <set>
19 #include <string>
20 
21 namespace KODI
22 {
23 namespace JOYSTICK
24 {
28 using FeatureName = std::string;
29 
49 enum class FEATURE_TYPE
50 {
51  UNKNOWN,
52  SCALAR,
53  ANALOG_STICK,
54  ACCELEROMETER,
55  MOTOR,
56  RELPOINTER,
57  ABSPOINTER,
58  WHEEL,
59  THROTTLE,
60  KEY,
61 };
62 
66 enum class FEATURE_CATEGORY
67 {
68  UNKNOWN,
69  FACE,
70  SHOULDER,
71  TRIGGER,
72  ANALOG_STICK,
73  ACCELEROMETER,
74  HAPTICS,
75  MOUSE_BUTTON,
76  POINTER,
77  LIGHTGUN,
78  OFFSCREEN, // Virtual button to shoot light gun offscreen
79  KEY, // A keyboard key
80  KEYPAD, // A key on a numeric keymap, including star and pound
81  HARDWARE, // A button or functionality on the console
82  WHEEL,
83  JOYSTICK,
84  PADDLE,
85 };
86 
90 using HAT_DIRECTION = INPUT::CARDINAL_DIRECTION;
91 
95 using HAT_STATE = INPUT::INTERCARDINAL_DIRECTION;
96 
100 using ANALOG_STICK_DIRECTION = INPUT::CARDINAL_DIRECTION;
101 
105 using RELATIVE_POINTER_DIRECTION = INPUT::CARDINAL_DIRECTION;
106 
111 {
112  NEGATIVE = -1, // semiaxis lies in the interval [-1.0, 0.0]
113  ZERO = 0, // semiaxis is unknown or invalid
114  POSITIVE = 1, // semiaxis lies in the interval [0.0, 1.0]
115 };
116 
120 enum class WHEEL_DIRECTION
121 {
122  NONE,
123  RIGHT,
124  LEFT,
125 };
126 
131 {
132  NONE,
133  UP,
134  DOWN,
135 };
136 
140 enum class INPUT_TYPE
141 {
142  UNKNOWN,
143  DIGITAL,
144  ANALOG,
145 };
146 
150 enum class PRIMITIVE_TYPE
151 {
152  UNKNOWN = 0, // primitive has no type (invalid)
153  BUTTON, // a digital button
154  HAT, // one of the four direction arrows on a D-pad
155  SEMIAXIS, // the positive or negative half of an axis
156  MOTOR, // a rumble motor
157  KEY, // a keyboard key
158  MOUSE_BUTTON, // a mouse button
159  RELATIVE_POINTER, // a relative pointer, such as on a mouse
160 };
161 
167 {
168  unsigned int actionId;
169  std::string actionString;
170  unsigned int holdTimeMs;
171  std::set<std::string> hotkeys;
172 
173  bool operator<(const KeymapAction& rhs) const { return holdTimeMs < rhs.holdTimeMs; }
174 };
175 
181 {
182  int windowId = -1;
183  std::set<KeymapAction> actions;
184 };
185 } // namespace JOYSTICK
186 } // namespace KODI
THROTTLE_DIRECTION
Directions on a throttle.
Definition: JoystickTypes.h:130
INPUT_TYPE
Types of input available for scalar features.
Definition: JoystickTypes.h:140
FEATURE_TYPE
Types of features used in the joystick library.
Definition: JoystickTypes.h:49
Container that sorts action entries by their holdtime.
Definition: JoystickTypes.h:180
PRIMITIVE_TYPE
Type of driver primitive.
Definition: JoystickTypes.h:150
Action entry in joystick.xml.
Definition: JoystickTypes.h:166
WHEEL_DIRECTION
Directions on a wheel.
Definition: JoystickTypes.h:120
Controller configuration window.
Definition: AudioDecoder.h:18
FEATURE_CATEGORY
Categories of features used in the joystick library.
Definition: JoystickTypes.h:66
std::string FeatureName
Name of a physical feature belonging to the joystick.
Definition: JoystickTypes.h:28
Definition: actions.py:1
SEMIAXIS_DIRECTION
Directions in which a semiaxis can point.
Definition: JoystickTypes.h:110