motion_emu.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2017 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "core/frontend/input.h"
  6. namespace InputCommon {
  7. class MotionEmuDevice;
  8. class MotionEmu : public Input::Factory<Input::MotionDevice> {
  9. public:
  10. /**
  11. * Creates a motion device emulated from mouse input
  12. * @param params contains parameters for creating the device:
  13. * - "update_period": update period in milliseconds
  14. * - "sensitivity": the coefficient converting mouse movement to tilting angle
  15. */
  16. std::unique_ptr<Input::MotionDevice> Create(const Common::ParamPackage& params) override;
  17. /**
  18. * Signals that a motion sensor tilt has begun.
  19. * @param x the x-coordinate of the cursor
  20. * @param y the y-coordinate of the cursor
  21. */
  22. void BeginTilt(int x, int y);
  23. /**
  24. * Signals that a motion sensor tilt is occurring.
  25. * @param x the x-coordinate of the cursor
  26. * @param y the y-coordinate of the cursor
  27. */
  28. void Tilt(int x, int y);
  29. /**
  30. * Signals that a motion sensor tilt has ended.
  31. */
  32. void EndTilt();
  33. private:
  34. std::weak_ptr<MotionEmuDevice> current_device;
  35. };
  36. } // namespace InputCommon