| 1 |
/* |
| 2 |
* Copyright (C) 2018 Team Kodi |
| 3 |
* http://kodi.tv |
| 4 |
* |
| 5 |
* This Program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2, or (at your option) |
| 8 |
* any later version. |
| 9 |
* |
| 10 |
* This Program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this Program; see the file COPYING. If not, see |
| 17 |
* <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h" |
| 24 |
#include "games/controllers/ControllerTypes.h" |
| 25 |
|
| 26 |
#include <string> |
| 27 |
#include <vector> |
| 28 |
|
| 29 |
namespace KODI |
| 30 |
{ |
| 31 |
namespace GAME |
| 32 |
{ |
| 33 |
class CGameClientInput; |
| 34 |
|
| 35 |
/*! |
| 36 |
* \ingroup games |
| 37 |
* |
| 38 |
* \brief A container for the layout of a controller connected to a game |
| 39 |
* client input port |
| 40 |
*/ |
| 41 |
class CGameClientController |
| 42 |
{ |
| 43 |
public: |
| 44 |
/*! |
| 45 |
* \brief Construct a controller layout |
| 46 |
* |
| 47 |
* \brief controller The controller add-on |
| 48 |
*/ |
| 49 |
CGameClientController(CGameClientInput& input, ControllerPtr controller); |
| 50 |
|
| 51 |
/*! |
| 52 |
* \brief Get a controller layout for the Game API |
| 53 |
*/ |
| 54 |
game_controller_layout TranslateController() const; |
| 55 |
|
| 56 |
private: |
| 57 |
// Construction parameters |
| 58 |
CGameClientInput& m_input; |
| 59 |
const ControllerPtr m_controller; |
| 60 |
|
| 61 |
// Buffer parameters |
| 62 |
std::string m_controllerId; |
| 63 |
std::vector<char*> m_digitalButtons; |
| 64 |
std::vector<char*> m_analogButtons; |
| 65 |
std::vector<char*> m_analogSticks; |
| 66 |
std::vector<char*> m_accelerometers; |
| 67 |
std::vector<char*> m_keys; |
| 68 |
std::vector<char*> m_relPointers; |
| 69 |
std::vector<char*> m_absPointers; |
| 70 |
std::vector<char*> m_motors; |
| 71 |
}; |
| 72 |
} // namespace GAME |
| 73 |
} // namespace KODI |