🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
4.4 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2022 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. /**
  54. * Get the number of registered touch devices.
  55. *
  56. * On some platforms SDL first sees the touch device if it was actually used.
  57. * Therefore SDL_GetNumTouchDevices() may return 0 although devices are
  58. * available. After using all devices at least once the number will be
  59. * correct.
  60. *
  61. * This was fixed for Android in SDL 2.0.1.
  62. *
  63. * \returns the number of registered touch devices.
  64. *
  65. * \since This function is available since SDL 2.0.0.
  66. *
  67. * \sa SDL_GetTouchDevice
  68. */
  69. extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
  70. /**
  71. * Get the touch ID with the given index.
  72. *
  73. * \param index the touch device index
  74. * \returns the touch ID with the given index on success or 0 if the index is
  75. * invalid; call SDL_GetError() for more information.
  76. *
  77. * \since This function is available since SDL 2.0.0.
  78. *
  79. * \sa SDL_GetNumTouchDevices
  80. */
  81. extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
  82. /**
  83. * Get the touch device name as reported from the driver or NULL if the index
  84. * is invalid.
  85. *
  86. * \since This function is available since SDL 2.0.22.
  87. */
  88. extern DECLSPEC const char* SDLCALL SDL_GetTouchName(int index);
  89. /**
  90. * Get the type of the given touch device.
  91. *
  92. * \since This function is available since SDL 2.0.10.
  93. */
  94. extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID);
  95. /**
  96. * Get the number of active fingers for a given touch device.
  97. *
  98. * \param touchID the ID of a touch device
  99. * \returns the number of active fingers for a given touch device on success
  100. * or 0 on failure; call SDL_GetError() for more information.
  101. *
  102. * \since This function is available since SDL 2.0.0.
  103. *
  104. * \sa SDL_GetTouchFinger
  105. */
  106. extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
  107. /**
  108. * Get the finger object for specified touch device ID and finger index.
  109. *
  110. * The returned resource is owned by SDL and should not be deallocated.
  111. *
  112. * \param touchID the ID of the requested touch device
  113. * \param index the index of the requested finger
  114. * \returns a pointer to the SDL_Finger object or NULL if no object at the
  115. * given ID and index could be found.
  116. *
  117. * \since This function is available since SDL 2.0.0.
  118. *
  119. * \sa SDL_RecordGesture
  120. */
  121. extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
  122. /* Ends C function definitions when using C++ */
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126. #include "close_code.h"
  127. #endif /* SDL_touch_h_ */
  128. /* vi: set ts=4 sw=4 expandtab: */