-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from kodi-game/game-api-leia
Game API v1.1.0 - Input refactoring
- Loading branch information
Showing
13 changed files
with
280 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (C) 2018 Team Kodi | ||
* http://kodi.tv | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this Program; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "ControllerLayout.h" | ||
|
||
#include "kodi_game_types.h" | ||
|
||
using namespace LIBRETRO; | ||
|
||
CControllerLayout::CControllerLayout(const game_controller_layout &controller) : | ||
m_controllerId(controller.controller_id != nullptr ? controller.controller_id : ""), | ||
m_bProvidesInput(controller.provides_input) | ||
{ | ||
if (controller.digital_buttons != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.digital_button_count; i++) | ||
m_digitalButtons.emplace_back(controller.digital_buttons[i]); | ||
} | ||
|
||
if (controller.analog_buttons != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.analog_button_count; i++) | ||
m_analogButtons.emplace_back(controller.analog_buttons[i]); | ||
} | ||
|
||
if (controller.analog_sticks != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.analog_stick_count; i++) | ||
m_analogSticks.emplace_back(controller.analog_sticks[i]); | ||
} | ||
|
||
if (controller.accelerometers != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.accelerometer_count; i++) | ||
m_accelerometers.emplace_back(controller.accelerometers[i]); | ||
} | ||
|
||
if (controller.keys != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.key_count; i++) | ||
m_keys.emplace_back(controller.keys[i]); | ||
} | ||
|
||
if (controller.rel_pointers != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.rel_pointer_count; i++) | ||
m_relPointers.emplace_back(controller.rel_pointers[i]); | ||
} | ||
|
||
if (controller.abs_pointers != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.abs_pointer_count; i++) | ||
m_absPointers.emplace_back(controller.abs_pointers[i]); | ||
} | ||
|
||
if (controller.motors != nullptr) | ||
{ | ||
for (unsigned int i = 0; i < controller.motor_count; i++) | ||
m_motors.emplace_back(controller.motors[i]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2018 Team Kodi | ||
* http://kodi.tv | ||
* | ||
* This Program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This Program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this Program; see the file COPYING. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
struct game_controller_layout; | ||
|
||
namespace LIBRETRO | ||
{ | ||
class CControllerLayout | ||
{ | ||
public: | ||
CControllerLayout(const game_controller_layout &controller); | ||
|
||
const std::string &ControllerID() const { return m_controllerId; } | ||
bool ProvidesInput() const { return m_bProvidesInput; } | ||
|
||
private: | ||
std::string m_controllerId; | ||
bool m_bProvidesInput; | ||
std::vector<std::string> m_digitalButtons; | ||
std::vector<std::string> m_analogButtons; | ||
std::vector<std::string> m_analogSticks; | ||
std::vector<std::string> m_accelerometers; | ||
std::vector<std::string> m_keys; | ||
std::vector<std::string> m_relPointers; | ||
std::vector<std::string> m_absPointers; | ||
std::vector<std::string> m_motors; | ||
}; | ||
} |
Oops, something went wrong.