xbmc
JoystickMonitor.h
1 /*
2  * Copyright (C) 2015-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 
11 #include "input/joysticks/interfaces/IInputHandler.h"
12 
13 namespace KODI
14 {
15 namespace JOYSTICK
16 {
23 {
24 public:
25  // implementation of IInputHandler
26  std::string ControllerID() const override;
27  bool HasFeature(const FeatureName& feature) const override { return true; }
28  bool AcceptsInput(const FeatureName& feature) const override;
29  bool OnButtonPress(const FeatureName& feature, bool bPressed) override;
30  void OnButtonHold(const FeatureName& feature, unsigned int holdTimeMs) override {}
31  bool OnButtonMotion(const FeatureName& feature,
32  float magnitude,
33  unsigned int motionTimeMs) override;
34  bool OnAnalogStickMotion(const FeatureName& feature,
35  float x,
36  float y,
37  unsigned int motionTimeMs) override;
38  bool OnAccelerometerMotion(const FeatureName& feature, float x, float y, float z) override
39  {
40  return false;
41  }
42  bool OnWheelMotion(const FeatureName& feature,
43  float position,
44  unsigned int motionTimeMs) override;
45  bool OnThrottleMotion(const FeatureName& feature,
46  float position,
47  unsigned int motionTimeMs) override;
48  void OnInputFrame() override {}
49 
50 private:
55  bool ResetTimers(void);
56 };
57 } // namespace JOYSTICK
58 } // 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:30
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
Controller configuration window.
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:25
bool HasFeature(const FeatureName &feature) const override
Return true if the input handler accepts the given feature.
Definition: JoystickMonitor.h:27
void OnInputFrame() override
Called at the end of the frame that provided input.
Definition: JoystickMonitor.h:48
std::string FeatureName
Name of a physical feature belonging to the joystick.
Definition: JoystickTypes.h:28
Monitors joystick input and resets screensaver/shutdown timers whenever motion occurs.
Definition: JoystickMonitor.h:22
bool OnAccelerometerMotion(const FeatureName &feature, float x, float y, float z) override
An accelerometer's state has changed.
Definition: JoystickMonitor.h:38
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