kodi
JoystickMonitor.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 "input/joysticks/interfaces/IInputHandler.h"
12 
13 namespace KODI
14 {
15 namespace JOYSTICK
16 {
24 {
25 public:
26  // implementation of IInputHandler
27  std::string ControllerID() const override;
28  bool HasFeature(const FeatureName& feature) const override { return true; }
29  bool AcceptsInput(const FeatureName& feature) const override;
30  bool OnButtonPress(const FeatureName& feature, bool bPressed) override;
31  void OnButtonHold(const FeatureName& feature, unsigned int holdTimeMs) override {}
32  bool OnButtonMotion(const FeatureName& feature,
33  float magnitude,
34  unsigned int motionTimeMs) override;
35  bool OnAnalogStickMotion(const FeatureName& feature,
36  float x,
37  float y,
38  unsigned int motionTimeMs) override;
39  bool OnAccelerometerMotion(const FeatureName& feature, float x, float y, float z) override
40  {
41  return false;
42  }
43  bool OnWheelMotion(const FeatureName& feature,
44  float position,
45  unsigned int motionTimeMs) override;
46  bool OnThrottleMotion(const FeatureName& feature,
47  float position,
48  unsigned int motionTimeMs) override;
49  void OnInputFrame() override {}
50 
51 private:
56  bool ResetTimers(void);
57 };
58 } // namespace JOYSTICK
59 } // namespace KODI
bool OnAnalogStickMotion(const FeatureName &feature, float x, float y, unsigned int motionTimeMs) override
An analog stick has moved.
Definition: JoystickMonitor.cpp:61
bool OnThrottleMotion(const FeatureName &feature, float position, unsigned int motionTimeMs) override
A throttle has changed state.
Definition: JoystickMonitor.cpp:89
void OnButtonHold(const FeatureName &feature, unsigned int holdTimeMs) override
A digital button has been pressed for more than one event frame.
Definition: JoystickMonitor.h:31
bool OnWheelMotion(const FeatureName &feature, float position, unsigned int motionTimeMs) override
A wheel has changed state.
Definition: JoystickMonitor.cpp:76
std::string ControllerID() const override
The add-on ID of the game controller associated with this input handler.
Definition: JoystickMonitor.cpp:24
Definition: AudioDecoder.h:18
bool OnButtonPress(const FeatureName &feature, bool bPressed) override
A digital button has been pressed or released.
Definition: JoystickMonitor.cpp:37
bool OnButtonMotion(const FeatureName &feature, float magnitude, unsigned int motionTimeMs) override
An analog button (trigger or a pressure-sensitive button) has changed state.
Definition: JoystickMonitor.cpp:48
Interface for handling input events for game controllers.
Definition: IInputHandler.h:26
bool HasFeature(const FeatureName &feature) const override
Return true if the input handler accepts the given feature.
Definition: JoystickMonitor.h:28
void OnInputFrame() override
Called at the end of the frame that provided input.
Definition: JoystickMonitor.h:49
Monitors joystick input and resets screensaver/shutdown timers whenever motion occurs.
Definition: JoystickMonitor.h:23
bool OnAccelerometerMotion(const FeatureName &feature, float x, float y, float z) override
An accelerometer's state has changed.
Definition: JoystickMonitor.h:39
bool AcceptsInput(const FeatureName &feature) const override
Return true if the input handler is currently accepting input for the given feature.
Definition: JoystickMonitor.cpp:29