InputSourceTouch.h 947 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * InputSourceTouch.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. VCMI_LIB_NAMESPACE_BEGIN
  12. class Point;
  13. VCMI_LIB_NAMESPACE_END
  14. struct SDL_TouchFingerEvent;
  15. /// Class that handles touchscreen input from SDL events
  16. class InputSourceTouch
  17. {
  18. bool multifinger;
  19. bool isPointerRelativeMode;
  20. /// moves mouse pointer into specified position inside vcmi window
  21. void moveCursorToPosition(const Point & position);
  22. Point convertTouchToMouse(const SDL_TouchFingerEvent & current);
  23. void fakeMouseButtonEventRelativeMode(bool down, bool right);
  24. public:
  25. InputSourceTouch();
  26. void handleEventFingerMotion(const SDL_TouchFingerEvent & current);
  27. void handleEventFingerDown(const SDL_TouchFingerEvent & current);
  28. void handleEventFingerUp(const SDL_TouchFingerEvent & current);
  29. };