Updated touch API
* Normalized touch coordinates as floats in the 0...1 range * Removed unused touchpad concepts from the API * Added API functions to get active touch devices and current finger state
This commit is contained in:
parent
71ea3033fa
commit
bb0752e573
15 changed files with 356 additions and 917 deletions
|
@ -46,46 +46,11 @@ typedef Sint64 SDL_FingerID;
|
|||
typedef struct SDL_Finger
|
||||
{
|
||||
SDL_FingerID id;
|
||||
Uint16 x;
|
||||
Uint16 y;
|
||||
Uint16 pressure;
|
||||
Uint16 xdelta;
|
||||
Uint16 ydelta;
|
||||
Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */
|
||||
SDL_bool down;
|
||||
float x;
|
||||
float y;
|
||||
float pressure;
|
||||
} SDL_Finger;
|
||||
|
||||
typedef struct SDL_Touch
|
||||
{
|
||||
/* Free the touch when it's time */
|
||||
void (*FreeTouch) (struct SDL_Touch * touch);
|
||||
|
||||
/* data common for tablets */
|
||||
float pressure_max, pressure_min;
|
||||
float x_max,x_min;
|
||||
float y_max,y_min;
|
||||
Uint16 xres,yres,pressureres;
|
||||
float native_xres,native_yres,native_pressureres;
|
||||
float tilt_x; /* for future use */
|
||||
float tilt_y; /* for future use */
|
||||
float rotation; /* for future use */
|
||||
|
||||
/* Data common to all touch */
|
||||
SDL_TouchID id;
|
||||
SDL_Window *focus;
|
||||
|
||||
char *name;
|
||||
Uint8 buttonstate;
|
||||
SDL_bool relative_mode;
|
||||
SDL_bool flush_motion;
|
||||
|
||||
int num_fingers;
|
||||
int max_fingers;
|
||||
SDL_Finger** fingers;
|
||||
|
||||
void *driverdata;
|
||||
} SDL_Touch;
|
||||
|
||||
/* Used as the device ID for mouse events simulated with touch input */
|
||||
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
|
||||
|
||||
|
@ -93,14 +58,24 @@ typedef struct SDL_Touch
|
|||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Get the touch object with the given id.
|
||||
* \brief Get the number of registered touch devices.
|
||||
*/
|
||||
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices();
|
||||
|
||||
/**
|
||||
* \brief Get the finger object of the given touch, with the given id.
|
||||
* \brief Get the touch ID with the given index, or 0 if the index is invalid.
|
||||
*/
|
||||
extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
|
||||
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
|
||||
|
||||
/**
|
||||
* \brief Get the number of active fingers for a given touch device.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
|
||||
|
||||
/**
|
||||
* \brief Get the finger object of the given touch, with the given index.
|
||||
*/
|
||||
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue