/* * Copyright (C) 2015-2021 Team Kodi (https://kodi.tv) * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSE.md for more information. */ #pragma once #include #include #include #include namespace LIBRETRO { typedef unsigned int libretro_device_t; class CLibretroDeviceInput { public: CLibretroDeviceInput(const std::string &controllerId); bool ButtonState(unsigned int buttonIndex) const; float AnalogButtonState(unsigned int buttonIndex) const; bool AnalogStickState(unsigned int analogStickIndex, float& x, float& y) const; bool AccelerometerState(float& x, float& y, float& z) const; int RelativePointerDeltaX(void); int RelativePointerDeltaY(void); bool AbsolutePointerState(unsigned int pointerIndex, float& x, float& y) const; bool InputEvent(const game_input_event& event); private: /*! * \brief Report key to client */ void SendKeyEvent(const std::string &controllerId, const std::string &feature, unsigned int keyIndex, const game_key_event &keyEvent); std::vector m_buttons; std::vector m_analogButtons; std::vector m_analogSticks; std::vector m_accelerometers; std::vector m_relativePointers; std::vector m_absolutePointers; std::mutex m_relativePtrMutex; }; }