xbmc
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 CGameClient;
24 
33 {
34 public:
42  CGameClientMouse(CGameClient& gameClient,
43  std::string controllerId,
44  MOUSE::IMouseInputProvider* inputProvider);
45 
49  ~CGameClientMouse() override;
50 
51  // implementation of IMouseInputHandler
52  std::string ControllerID() const override;
53  bool OnMotion(const std::string& relpointer, int dx, int dy) override;
54  bool OnButtonPress(const std::string& button) override;
55  void OnButtonRelease(const std::string& button) override;
56 
57  // Input accessors
58  const std::string& GetControllerID() const { return m_controllerId; }
59  const PERIPHERALS::PeripheralPtr& GetSource() const { return m_sourcePeripheral; }
60 
61  // Input mutators
62  void SetSource(PERIPHERALS::PeripheralPtr sourcePeripheral);
63  void ClearSource();
64 
65 private:
66  // Construction parameters
67  CGameClient& m_gameClient;
68  const std::string m_controllerId;
69  MOUSE::IMouseInputProvider* const m_inputProvider;
70 
71  // Input parameters
72  PERIPHERALS::PeripheralPtr m_sourcePeripheral;
73 };
74 } // namespace GAME
75 } // namespace KODI
Interface for classes that can provide mouse input.
Definition: IMouseInputProvider.h:21
Interface between Kodi and Game add-ons.
Definition: GameClient.h:116
Definition: AudioDecoder.h:18
Handles mouse events for games.
Definition: GameClientMouse.h:32
Interface for handling mouse events.
Definition: IMouseInputHandler.h:23