blob: 30f49c50f37e681a0f09570521a6332edcc0fcc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* Copyright (C) 2015-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
namespace KODI
{
namespace JOYSTICK
{
/*!
* \ingroup joystick
* \brief Interface for handling keymap keys
*
* Keys can be mapped to analog actions (e.g. "AnalogSeekForward") or digital
* actions (e.g. "Up").
*/
class IKeyHandler
{
public:
virtual ~IKeyHandler() = default;
/*!
* \brief Return true if the key is "pressed" (has a magnitude greater
* than 0.5)
*
* \return True if the key is "pressed", false otherwise
*/
virtual bool IsPressed() const = 0;
/*!
* \brief A key mapped to a digital feature has been pressed or released
*
* \param bPressed true if the key's button/axis is activated, false if deactivated
* \param holdTimeMs The held time in ms for pressed buttons, or 0 for released
*
* \return True if the key is mapped to an action, false otherwise
*/
virtual bool OnDigitalMotion(bool bPressed, unsigned int holdTimeMs) = 0;
/*!
* \brief Callback for keys mapped to analog features
*
* \param magnitude The amount of the analog action
* \param motionTimeMs The time since the magnitude was 0
*
* \return True if the key is mapped to an action, false otherwise
*/
virtual bool OnAnalogMotion(float magnitude, unsigned int motionTimeMs) = 0;
};
} // namespace JOYSTICK
} // namespace KODI
|