xbmc
JoystickMapper.h
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 "IButtonMapper.h"
13 
14 #include <map>
15 #include <memory>
16 #include <set>
17 #include <string>
18 #include <vector>
19 
20 class IWindowKeymap;
21 class TiXmlElement;
22 class TiXmlNode;
23 
25 {
26 public:
27  CJoystickMapper() = default;
28  ~CJoystickMapper() override = default;
29 
30  // implementation of IButtonMapper
31  void MapActions(int windowID, const TiXmlNode* pDevice) override;
32  void Clear() override;
33 
34  std::vector<std::shared_ptr<const IWindowKeymap>> GetJoystickKeymaps() const;
35 
36 private:
37  void DeserializeJoystickNode(const TiXmlNode* pDevice, std::string& controllerId);
38  bool DeserializeButton(const TiXmlElement* pButton,
39  std::string& feature,
40  KODI::JOYSTICK::ANALOG_STICK_DIRECTION& dir,
41  unsigned int& holdtimeMs,
42  std::set<std::string>& hotkeys,
43  std::string& actionStr);
44 
45  using ControllerID = std::string;
46  std::map<ControllerID, std::shared_ptr<IWindowKeymap>> m_joystickKeymaps;
47 
48  std::vector<std::string> m_controllerIds;
49 };
Interface for classes that can map buttons to Kodi actions.
Definition: IButtonMapper.h:16
Definition: JoystickMapper.h:24
Interface for mapping buttons to Kodi actions for specific windows.
Definition: IKeymap.h:54