SDL_touch.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_touch.h
  20. *
  21. * Include file for SDL touch event handling.
  22. */
  23. #ifndef SDL_touch_h_
  24. #define SDL_touch_h_
  25. #include "SDL_stdinc.h"
  26. #include "SDL_error.h"
  27. #include "SDL_video.h"
  28. #include "begin_code.h"
  29. /* Set up for C function definitions, even when using C++ */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. typedef Sint64 SDL_TouchID;
  34. typedef Sint64 SDL_FingerID;
  35. typedef enum
  36. {
  37. SDL_TOUCH_DEVICE_INVALID = -1,
  38. SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */
  39. SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
  40. SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */
  41. } SDL_TouchDeviceType;
  42. typedef struct SDL_Finger
  43. {
  44. SDL_FingerID id;
  45. float x;
  46. float y;
  47. float pressure;
  48. } SDL_Finger;
  49. /* Used as the device ID for mouse events simulated with touch input */
  50. #define SDL_TOUCH_MOUSEID ((Uint32)-1)
  51. /* Used as the SDL_TouchID for touch events simulated with mouse input */
  52. #define SDL_MOUSE_TOUCHID ((Sint64)-1)
  53. /* Function prototypes */
  54. /**
  55. * \brief Get the number of registered touch devices.
  56. */
  57. extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
  58. /**
  59. * \brief Get the touch ID with the given index, or 0 if the index is invalid.
  60. */
  61. extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
  62. /**
  63. * \brief Get the type of the given touch device.
  64. */
  65. extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
  66. /**
  67. * \brief Get the number of active fingers for a given touch device.
  68. */
  69. extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
  70. /**
  71. * \brief Get the finger object of the given touch, with the given index.
  72. */
  73. extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
  74. /* Ends C function definitions when using C++ */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #include "close_code.h"
  79. #endif /* SDL_touch_h_ */
  80. /* vi: set ts=4 sw=4 expandtab: */