xbmc
AddonInputHandling.h
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 
11 #include "input/joysticks/interfaces/IDriverHandler.h"
12 #include "input/joysticks/interfaces/IInputReceiver.h"
13 #include "input/keyboard/interfaces/IKeyboardDriverHandler.h"
14 #include "input/mouse/interfaces/IMouseDriverHandler.h"
15 
16 #include <memory>
17 
18 namespace KODI
19 {
20 namespace JOYSTICK
21 {
22 class IButtonMap;
23 class IDriverReceiver;
24 class IInputHandler;
25 } // namespace JOYSTICK
26 
27 namespace KEYBOARD
28 {
29 class IKeyboardInputHandler;
30 }
31 
32 namespace MOUSE
33 {
34 class IMouseInputHandler;
35 }
36 } // namespace KODI
37 
38 namespace PERIPHERALS
39 {
40 class CPeripheral;
41 class CPeripherals;
42 
47 {
48 public:
50  CPeripheral* peripheral,
53 
55  CPeripheral* peripheral,
57 
59  CPeripheral* peripheral,
61 
62  ~CAddonInputHandling(void) override;
63 
64  // implementation of IDriverHandler
65  bool OnButtonMotion(unsigned int buttonIndex, bool bPressed) override;
66  bool OnHatMotion(unsigned int hatIndex, KODI::JOYSTICK::HAT_STATE state) override;
67  bool OnAxisMotion(unsigned int axisIndex,
68  float position,
69  int center,
70  unsigned int range) override;
71  void OnInputFrame(void) override;
72 
73  // implementation of IKeyboardDriverHandler
74  bool OnKeyPress(const CKey& key) override;
75  void OnKeyRelease(const CKey& key) override;
76 
77  // implementation of IMouseDriverHandler
78  bool OnPosition(int x, int y) override;
79  bool OnButtonPress(KODI::MOUSE::BUTTON_ID button) override;
80  void OnButtonRelease(KODI::MOUSE::BUTTON_ID button) override;
81 
82  // implementation of IInputReceiver
83  bool SetRumbleState(const KODI::JOYSTICK::FeatureName& feature, float magnitude) override;
84 
85 private:
86  std::unique_ptr<KODI::JOYSTICK::IDriverHandler> m_driverHandler;
87  std::unique_ptr<KODI::JOYSTICK::IInputReceiver> m_inputReceiver;
88  std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> m_keyboardHandler;
89  std::unique_ptr<KODI::MOUSE::IMouseDriverHandler> m_mouseHandler;
90  std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap;
91 };
92 } // namespace PERIPHERALS
Definition: IInputHandler.h:16
Definition: AddonInputHandling.h:43
Definition: RetroPlayerInput.h:15
Interface defining methods to handle joystick events for raw driver elements (buttons, hats, axes)
Definition: IDriverHandler.h:21
Interface for handling input events for keyboards.
Definition: IKeyboardInputHandler.h:27
Controller configuration window.
Definition: AudioDecoder.h:18
Interface for handling mouse events.
Definition: IMouseInputHandler.h:23
Interface for handling input events for game controllers.
Definition: IInputHandler.h:25
Interface for handling mouse driver events.
Definition: IMouseDriverHandler.h:21
std::string FeatureName
Name of a physical feature belonging to the joystick.
Definition: JoystickTypes.h:28
Interface for handling keyboard events.
Definition: IKeyboardDriverHandler.h:21
Definition: Peripheral.h:62
Interface for sending input events to game controllers.
Definition: IInputReceiver.h:21
Definition: Key.h:135
Interface for sending input events to joystick drivers.
Definition: IDriverReceiver.h:19
Definition: Peripherals.h:49