kodi
GameClientMouse.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/mouse/interfaces/IMouseInputHandler.h"
12 #include "peripherals/PeripheralTypes.h"
13 
14 namespace KODI
15 {
16 namespace MOUSE
17 {
18 class IMouseInputProvider;
19 }
20 
21 namespace GAME
22 {
23 class CControllerActivity;
24 class CGameClient;
25 
34 {
35 public:
43  CGameClientMouse(CGameClient& gameClient,
44  std::string controllerId,
45  MOUSE::IMouseInputProvider* inputProvider);
46 
50  ~CGameClientMouse() override;
51 
52  // implementation of IMouseInputHandler
53  std::string ControllerID() const override;
54  bool OnMotion(const std::string& relpointer, int dx, int dy) override;
55  bool OnButtonPress(const std::string& button) override;
56  void OnButtonRelease(const std::string& button) override;
57  void OnInputFrame() override;
58 
59  // Input accessors
60  const std::string& GetControllerID() const { return m_controllerId; }
61  const PERIPHERALS::PeripheralPtr& GetSource() const { return m_sourcePeripheral; }
62  float GetActivation() const;
63 
64  // Input mutators
65  void SetSource(PERIPHERALS::PeripheralPtr sourcePeripheral);
66  void ClearSource();
67 
68 private:
69  // Construction parameters
70  CGameClient& m_gameClient;
71  const std::string m_controllerId;
72  MOUSE::IMouseInputProvider* const m_inputProvider;
73 
74  // Input parameters
75  PERIPHERALS::PeripheralPtr m_sourcePeripheral;
76  std::unique_ptr<CControllerActivity> m_mouseActivity;
77 };
78 } // namespace GAME
79 } // namespace KODI
Interface for classes that can provide mouse input.
Definition: IMouseInputProvider.h:22
Interface between Kodi and Game add-ons.
Definition: GameClient.h:116
Definition: AudioDecoder.h:18
Handles mouse events for games.
Definition: GameClientMouse.h:33
Interface for handling mouse events.
Definition: IMouseInputHandler.h:24