xbmc
GameClientKeyboard.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/keyboard/interfaces/IKeyboardInputHandler.h"
12 #include "peripherals/PeripheralTypes.h"
13 
14 namespace KODI
15 {
16 namespace KEYBOARD
17 {
18 class IKeyboardInputProvider;
19 }
20 
21 namespace GAME
22 {
23 class CGameClient;
24 
33 {
34 public:
42  CGameClientKeyboard(CGameClient& gameClient,
43  std::string controllerId,
44  KEYBOARD::IKeyboardInputProvider* inputProvider);
45 
49  ~CGameClientKeyboard() override;
50 
51  // implementation of IKeyboardInputHandler
52  std::string ControllerID() const override;
53  bool HasKey(const KEYBOARD::KeyName& key) const override;
54  bool OnKeyPress(const KEYBOARD::KeyName& key, KEYBOARD::Modifier mod, uint32_t unicode) override;
55  void OnKeyRelease(const KEYBOARD::KeyName& key,
56  KEYBOARD::Modifier mod,
57  uint32_t unicode) override;
58 
59  // Input accessors
60  const std::string& GetControllerID() const { return m_controllerId; }
61  const PERIPHERALS::PeripheralPtr& GetSource() const { return m_sourcePeripheral; }
62 
63  // Input mutators
64  void SetSource(PERIPHERALS::PeripheralPtr sourcePeripheral);
65  void ClearSource();
66 
67 private:
68  // Construction parameters
69  CGameClient& m_gameClient;
70  const std::string m_controllerId;
71  KEYBOARD::IKeyboardInputProvider* const m_inputProvider;
72 
73  // Input parameters
74  PERIPHERALS::PeripheralPtr m_sourcePeripheral;
75 };
76 } // namespace GAME
77 } // namespace KODI
Interface for handling input events for keyboards.
Definition: IKeyboardInputHandler.h:27
Handles keyboard events for games.
Definition: GameClientKeyboard.h:32
Interface between Kodi and Game add-ons.
Definition: GameClient.h:116
Definition: AudioDecoder.h:18
Interface for classes that can provide keyboard input.
Definition: IKeyboardInputProvider.h:21