tas_poller.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2021 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include "core/frontend/input.h"
  7. #include "input_common/tas/tas_input.h"
  8. namespace InputCommon {
  9. /**
  10. * A button device factory representing a tas bot. It receives tas events and forward them
  11. * to all button devices it created.
  12. */
  13. class TasButtonFactory final : public Input::Factory<Input::ButtonDevice> {
  14. public:
  15. explicit TasButtonFactory(std::shared_ptr<TasInput::Tas> tas_input_);
  16. /**
  17. * Creates a button device from a button press
  18. * @param params contains parameters for creating the device:
  19. * - "code": the code of the key to bind with the button
  20. */
  21. std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override;
  22. private:
  23. std::shared_ptr<TasInput::Tas> tas_input;
  24. };
  25. /// An analog device factory that creates analog devices from tas
  26. class TasAnalogFactory final : public Input::Factory<Input::AnalogDevice> {
  27. public:
  28. explicit TasAnalogFactory(std::shared_ptr<TasInput::Tas> tas_input_);
  29. std::unique_ptr<Input::AnalogDevice> Create(const Common::ParamPackage& params) override;
  30. private:
  31. std::shared_ptr<TasInput::Tas> tas_input;
  32. };
  33. } // namespace InputCommon