My Project
Loading...
Searching...
No Matches
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"

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
 
typedef struct SDL_Finger SDL_Finger
 

Enumerations

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

Functions

DECLSPEC int SDLCALL SDL_GetNumTouchDevices (void)
 
DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice (int index)
 
DECLSPEC const char *SDLCALL SDL_GetTouchName (int index)
 
DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType (SDL_TouchID touchID)
 
DECLSPEC int SDLCALL SDL_GetNumTouchFingers (SDL_TouchID touchID)
 
DECLSPEC SDL_Finger *SDLCALL SDL_GetTouchFinger (SDL_TouchID touchID, int index)
 

Detailed Description

Include file for SDL touch event handling.

Function Documentation

◆ SDL_GetNumTouchDevices()

DECLSPEC int SDLCALL SDL_GetNumTouchDevices ( void  )

Get the number of registered touch devices.

On some platforms SDL first sees the touch device if it was actually used. Therefore SDL_GetNumTouchDevices() may return 0 although devices are available. After using all devices at least once the number will be correct.

This was fixed for Android in SDL 2.0.1.

Returns
the number of registered touch devices.
Since
This function is available since SDL 2.0.0.
See also
SDL_GetTouchDevice

◆ SDL_GetNumTouchFingers()

DECLSPEC int SDLCALL SDL_GetNumTouchFingers ( SDL_TouchID  touchID)

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

Parameters
touchIDthe ID of a touch device
Returns
the number of active fingers for a given touch device on success or 0 on failure; call SDL_GetError() for more information.
Since
This function is available since SDL 2.0.0.
See also
SDL_GetTouchFinger

◆ SDL_GetTouchDevice()

DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice ( int  index)

Get the touch ID with the given index.

Parameters
indexthe touch device index
Returns
the touch ID with the given index on success or 0 if the index is invalid; call SDL_GetError() for more information.
Since
This function is available since SDL 2.0.0.
See also
SDL_GetNumTouchDevices

◆ SDL_GetTouchDeviceType()

DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType ( SDL_TouchID  touchID)

Get the type of the given touch device.

Since
This function is available since SDL 2.0.10.

◆ SDL_GetTouchFinger()

DECLSPEC SDL_Finger *SDLCALL SDL_GetTouchFinger ( SDL_TouchID  touchID,
int  index 
)

Get the finger object for specified touch device ID and finger index.

The returned resource is owned by SDL and should not be deallocated.

Parameters
touchIDthe ID of the requested touch device
indexthe index of the requested finger
Returns
a pointer to the SDL_Finger object or NULL if no object at the given ID and index could be found.
Since
This function is available since SDL 2.0.0.
See also
SDL_RecordGesture

◆ SDL_GetTouchName()

DECLSPEC const char *SDLCALL SDL_GetTouchName ( int  index)

Get the touch device name as reported from the driver or NULL if the index is invalid.

Since
This function is available since SDL 2.0.22.