Debian Codegraph @

xbmc/games/controllers/dialogs/GUIDialogAxisDetection.h

raw
1 /*
2 * Copyright (C) 2017-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 "GUIDialogButtonCapture.h"
12
13 #include <string>
14 #include <utility>
15 #include <vector>
16
17 namespace KODI
18 {
19 namespace GAME
20 {
21 /*!
22 * \ingroup games
23 */
24 class CGUIDialogAxisDetection : public CGUIDialogButtonCapture
25 {
26 public:
27 CGUIDialogAxisDetection() = default;
28
29 ~CGUIDialogAxisDetection() override = default;
30
31 // specialization of IButtonMapper via CGUIDialogButtonCapture
32 bool AcceptsPrimitive(JOYSTICK::PRIMITIVE_TYPE type) const override;
33 void OnLateAxis(const JOYSTICK::IButtonMap* buttonMap, unsigned int axisIndex) override;
34
35 protected:
36 // implementation of CGUIDialogButtonCapture
37 std::string GetDialogText() override;
38 std::string GetDialogHeader() override;
39 bool MapPrimitiveInternal(JOYSTICK::IButtonMap* buttonMap,
40 KEYMAP::IKeymap* keymap,
41 const JOYSTICK::CDriverPrimitive& primitive) override;
42 void OnClose(bool bAccepted) override {}
43
44 private:
45 void AddAxis(const std::string& deviceLocation, unsigned int axisIndex);
46
47 // Axis types
48 using DeviceName = std::string;
49 using AxisIndex = unsigned int;
50 using AxisEntry = std::pair<DeviceName, AxisIndex>;
51 using AxisVector = std::vector<AxisEntry>;
52
53 // Axis detection
54 AxisVector m_detectedAxes;
55 };
56 } // namespace GAME
57 } // namespace KODI