Debian Codegraph @

src/input/LibretroDeviceInput.h

raw
1 /*
2 * Copyright (C) 2015-2021 Team Kodi (https://kodi.tv)
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 * See LICENSE.md for more information.
6 */
7
8 #pragma once
9
10 #include <kodi/addon-instance/Game.h>
11 #include <mutex>
12
13 #include <string>
14 #include <vector>
15
16 namespace LIBRETRO
17 {
18 typedef unsigned int libretro_device_t;
19
20 class CLibretroDeviceInput
21 {
22 public:
23 CLibretroDeviceInput(const std::string &controllerId);
24
25 bool ButtonState(unsigned int buttonIndex) const;
26 float AnalogButtonState(unsigned int buttonIndex) const;
27 bool AnalogStickState(unsigned int analogStickIndex, float& x, float& y) const;
28 bool AccelerometerState(float& x, float& y, float& z) const;
29 int RelativePointerDeltaX(void);
30 int RelativePointerDeltaY(void);
31 bool AbsolutePointerState(unsigned int pointerIndex, float& x, float& y) const;
32
33 bool InputEvent(const game_input_event& event);
34
35 private:
36 /*!
37 * \brief Report key to client
38 */
39 void SendKeyEvent(const std::string &controllerId,
40 const std::string &feature,
41 unsigned int keyIndex,
42 const game_key_event &keyEvent);
43
44 std::vector<game_digital_button_event> m_buttons;
45 std::vector<game_analog_button_event> m_analogButtons;
46 std::vector<game_analog_stick_event> m_analogSticks;
47 std::vector<game_accelerometer_event> m_accelerometers;
48 std::vector<game_rel_pointer_event> m_relativePointers;
49 std::vector<game_abs_pointer_event> m_absolutePointers;
50 std::mutex m_relativePtrMutex;
51 };
52 }