Debian Codegraph @

xbmc/games/agents/input/AgentKeyboard.h

raw
1 /*
2 * Copyright (C) 2024 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 "games/controllers/ControllerTypes.h"
12 #include "input/keyboard/interfaces/IKeyboardInputHandler.h"
13 #include "peripherals/PeripheralTypes.h"
14
15 namespace KODI
16 {
17 namespace GAME
18 {
19 class CControllerActivity;
20
21 /*!
22 * \ingroup games
23 *
24 * \brief Handles keyboard events for game agent functionality
25 */
26 class CAgentKeyboard : public KEYBOARD::IKeyboardInputHandler
27 {
28 public:
29 CAgentKeyboard(PERIPHERALS::PeripheralPtr peripheral);
30
31 ~CAgentKeyboard() override;
32
33 void Initialize();
34 void Deinitialize();
35 void ClearButtonState();
36
37 // Input parameters
38 float GetActivation() const;
39 ControllerPtr Appearance() const { return m_controllerAppearance; }
40
41 // Implementation of IKeyboardInputHandler
42 std::string ControllerID() const override;
43 bool HasKey(const KEYBOARD::KeyName& key) const override;
44 bool OnKeyPress(const KEYBOARD::KeyName& key, KEYBOARD::Modifier mod, uint32_t unicode) override;
45 void OnKeyRelease(const KEYBOARD::KeyName& key,
46 KEYBOARD::Modifier mod,
47 uint32_t unicode) override;
48
49 private:
50 // Construction parameters
51 const PERIPHERALS::PeripheralPtr m_peripheral;
52
53 // Input state
54 std::unique_ptr<CControllerActivity> m_keyboardActivity;
55 ControllerPtr m_controllerAppearance;
56 };
57 } // namespace GAME
58 } // namespace KODI