SDL  2.0
SDL_touch.h File Reference
#include "SDL_stdinc.h"
#include "SDL_error.h"
#include "SDL_video.h"
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_touch.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SDL_Finger
 

Macros

#define SDL_TOUCH_MOUSEID   ((Uint32)-1)
 
#define SDL_MOUSE_TOUCHID   ((Sint64)-1)
 

Typedefs

typedef Sint64 SDL_TouchID
 
typedef Sint64 SDL_FingerID
 

Enumerations

enum  SDL_TouchDeviceType {
  SDL_TOUCH_DEVICE_INVALID = -1,
  SDL_TOUCH_DEVICE_DIRECT,
  SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE,
  SDL_TOUCH_DEVICE_INDIRECT_RELATIVE
}
 

Functions

int SDL_GetNumTouchDevices (void)
 Get the number of registered touch devices. More...
 
SDL_TouchID SDL_GetTouchDevice (int index)
 Get the touch ID with the given index, or 0 if the index is invalid. More...
 
SDL_TouchDeviceType SDL_GetTouchDeviceType (SDL_TouchID touchID)
 Get the type of the given touch device. More...
 
int SDL_GetNumTouchFingers (SDL_TouchID touchID)
 Get the number of active fingers for a given touch device. More...
 
SDL_FingerSDL_GetTouchFinger (SDL_TouchID touchID, int index)
 Get the finger object of the given touch, with the given index. More...
 

Detailed Description

Include file for SDL touch event handling.

Definition in file SDL_touch.h.

Macro Definition Documentation

◆ SDL_MOUSE_TOUCHID

#define SDL_MOUSE_TOUCHID   ((Sint64)-1)

Definition at line 64 of file SDL_touch.h.

◆ SDL_TOUCH_MOUSEID

#define SDL_TOUCH_MOUSEID   ((Uint32)-1)

Definition at line 61 of file SDL_touch.h.

Typedef Documentation

◆ SDL_FingerID

Definition at line 42 of file SDL_touch.h.

◆ SDL_TouchID

const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char const char const SDL_SCANF_FORMAT_STRING char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID

Definition at line 41 of file SDL_touch.h.

Enumeration Type Documentation

◆ SDL_TouchDeviceType

Enumerator
SDL_TOUCH_DEVICE_INVALID 
SDL_TOUCH_DEVICE_DIRECT 
SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE 
SDL_TOUCH_DEVICE_INDIRECT_RELATIVE 

Definition at line 44 of file SDL_touch.h.

45 {
47  SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */
48  SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */
49  SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */

Function Documentation

◆ SDL_GetNumTouchDevices()

int SDL_GetNumTouchDevices ( void  )

Get the number of registered touch devices.

Definition at line 52 of file SDL_touch.c.

53 {
54  return SDL_num_touch;
55 }

References SDL_num_touch.

◆ SDL_GetNumTouchFingers()

int SDL_GetNumTouchFingers ( SDL_TouchID  touchID)

Get the number of active fingers for a given touch device.

Definition at line 131 of file SDL_touch.c.

132 {
133  SDL_Touch *touch = SDL_GetTouch(touchID);
134  if (touch) {
135  return touch->num_fingers;
136  }
137  return 0;
138 }

References SDL_Touch::num_fingers, and SDL_GetTouch().

◆ SDL_GetTouchDevice()

SDL_TouchID SDL_GetTouchDevice ( int  index)

Get the touch ID with the given index, or 0 if the index is invalid.

Definition at line 58 of file SDL_touch.c.

59 {
61  SDL_SetError("Unknown touch device index %d", index);
62  return 0;
63  }
64  return SDL_touchDevices[index]->id;
65 }

References SDL_Touch::id, SDL_num_touch, SDL_SetError, and SDL_touchDevices.

◆ SDL_GetTouchDeviceType()

SDL_TouchDeviceType SDL_GetTouchDeviceType ( SDL_TouchID  touchID)

Get the type of the given touch device.

Definition at line 99 of file SDL_touch.c.

100 {
101  SDL_Touch *touch = SDL_GetTouch(id);
102  if (touch) {
103  return touch->type;
104  }
106 }

References SDL_GetTouch(), SDL_TOUCH_DEVICE_INVALID, and SDL_Touch::type.

◆ SDL_GetTouchFinger()

SDL_Finger* SDL_GetTouchFinger ( SDL_TouchID  touchID,
int  index 
)

Get the finger object of the given touch, with the given index.

Definition at line 141 of file SDL_touch.c.

142 {
143  SDL_Touch *touch = SDL_GetTouch(touchID);
144  if (!touch) {
145  return NULL;
146  }
147  if (index < 0 || index >= touch->num_fingers) {
148  SDL_SetError("Unknown touch finger");
149  return NULL;
150  }
151  return touch->fingers[index];
152 }

References SDL_Touch::fingers, NULL, SDL_Touch::num_fingers, SDL_GetTouch(), and SDL_SetError.

SDL_num_touch
static int SDL_num_touch
Definition: SDL_touch.c:31
SDL_TOUCH_DEVICE_DIRECT
@ SDL_TOUCH_DEVICE_DIRECT
Definition: SDL_touch.h:47
NULL
#define NULL
Definition: begin_code.h:167
SDL_TOUCH_DEVICE_INVALID
@ SDL_TOUCH_DEVICE_INVALID
Definition: SDL_touch.h:46
SDL_TOUCH_DEVICE_INDIRECT_RELATIVE
@ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE
Definition: SDL_touch.h:49
index
GLuint index
Definition: SDL_opengl_glext.h:663
SDL_TouchDeviceType
SDL_TouchDeviceType
Definition: SDL_touch.h:44
SDL_Touch::num_fingers
int num_fingers
Definition: SDL_touch_c.h:31
SDL_Touch::fingers
SDL_Finger ** fingers
Definition: SDL_touch_c.h:33
SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE
@ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE
Definition: SDL_touch.h:48
SDL_Touch
Definition: SDL_touch_c.h:27
SDL_Touch::id
SDL_TouchID id
Definition: SDL_touch_c.h:29
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_touchDevices
static SDL_Touch ** SDL_touchDevices
Definition: SDL_touch.c:32
SDL_Touch::type
SDL_TouchDeviceType type
Definition: SDL_touch_c.h:30
SDL_GetTouch
SDL_Touch * SDL_GetTouch(SDL_TouchID id)
Definition: SDL_touch.c:83