| 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 "input/joysticks/interfaces/IInputHandler.h" |
| 12 |
|
| 13 |
namespace KODI |
| 14 |
{ |
| 15 |
namespace GAME |
| 16 |
{ |
| 17 |
class CGameClient; |
| 18 |
|
| 19 |
/*! |
| 20 |
* \ingroup games |
| 21 |
*/ |
| 22 |
class CInputSink : public JOYSTICK::IInputHandler |
| 23 |
{ |
| 24 |
public: |
| 25 |
explicit CInputSink(JOYSTICK::IInputHandler* gameInput); |
| 26 |
|
| 27 |
~CInputSink() override = default; |
| 28 |
|
| 29 |
// Implementation of IInputHandler |
| 30 |
std::string ControllerID() const override; |
| 31 |
bool HasFeature(const std::string& feature) const override { return true; } |
| 32 |
bool AcceptsInput(const std::string& feature) const override; |
| 33 |
bool OnButtonPress(const std::string& feature, bool bPressed) override; |
| 34 |
void OnButtonHold(const std::string& feature, unsigned int holdTimeMs) override {} |
| 35 |
bool OnButtonMotion(const std::string& feature, |
| 36 |
float magnitude, |
| 37 |
unsigned int motionTimeMs) override; |
| 38 |
bool OnAnalogStickMotion(const std::string& feature, |
| 39 |
float x, |
| 40 |
float y, |
| 41 |
unsigned int motionTimeMs) override; |
| 42 |
bool OnAccelerometerMotion(const std::string& feature, float x, float y, float z) override; |
| 43 |
bool OnWheelMotion(const std::string& feature, |
| 44 |
float position, |
| 45 |
unsigned int motionTimeMs) override; |
| 46 |
bool OnThrottleMotion(const std::string& feature, |
| 47 |
float position, |
| 48 |
unsigned int motionTimeMs) override; |
| 49 |
void OnInputFrame() override {} |
| 50 |
|
| 51 |
private: |
| 52 |
// Construction parameters |
| 53 |
JOYSTICK::IInputHandler* m_gameInput; |
| 54 |
}; |
| 55 |
} // namespace GAME |
| 56 |
} // namespace KODI |