kodi
JoystickTranslator.h
1 /*
2  * Copyright (C) 2015-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 "JoystickTypes.h"
12 
13 namespace KODI
14 {
15 namespace JOYSTICK
16 {
17 class CDriverPrimitive;
18 
25 {
26 public:
34  static const char* HatStateToString(HAT_STATE state);
35 
43  static const char* TranslateAnalogStickDirection(ANALOG_STICK_DIRECTION dir);
44 
52  static ANALOG_STICK_DIRECTION TranslateAnalogStickDirection(const std::string& dir);
53 
61  static const char* TranslateWheelDirection(WHEEL_DIRECTION dir);
62 
70  static WHEEL_DIRECTION TranslateWheelDirection(const std::string& dir);
71 
79  static const char* TranslateThrottleDirection(THROTTLE_DIRECTION dir);
80 
88  static THROTTLE_DIRECTION TranslateThrottleDirection(const std::string& dir);
89 
97  static SEMIAXIS_DIRECTION PositionToSemiAxisDirection(float position);
98 
106  static WHEEL_DIRECTION PositionToWheelDirection(float position);
107 
115  static THROTTLE_DIRECTION PositionToThrottleDirection(float position);
116 
124  static std::string GetPrimitiveName(const CDriverPrimitive& primitive);
125 };
126 } // namespace JOYSTICK
127 } // namespace KODI
static std::string GetPrimitiveName(const CDriverPrimitive &primitive)
Get the localized name of the primitive.
Definition: JoystickTranslator.cpp:158
static const char * TranslateWheelDirection(WHEEL_DIRECTION dir)
Translate a wheel direction to a lower-case string.
Definition: JoystickTranslator.cpp:78
static const char * HatStateToString(HAT_STATE state)
Translate a hat state to a string representation.
Definition: JoystickTranslator.cpp:18
static const char * TranslateAnalogStickDirection(ANALOG_STICK_DIRECTION dir)
Translate an analog stick direction to a lower-case string.
Definition: JoystickTranslator.cpp:45
Joystick translation utilities.
Definition: JoystickTranslator.h:24
Definition: AudioDecoder.h:18
static WHEEL_DIRECTION PositionToWheelDirection(float position)
Get the wheel direction containing the specified position.
Definition: JoystickTranslator.cpp:138
static THROTTLE_DIRECTION PositionToThrottleDirection(float position)
Get the throttle direction containing the specified position.
Definition: JoystickTranslator.cpp:148
Basic driver element associated with input events.
Definition: DriverPrimitive.h:70
static SEMIAXIS_DIRECTION PositionToSemiAxisDirection(float position)
Get the semi-axis direction containing the specified position.
Definition: JoystickTranslator.cpp:128
static const char * TranslateThrottleDirection(THROTTLE_DIRECTION dir)
Translate a throttle direction to a lower-case string.
Definition: JoystickTranslator.cpp:103