Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).

This commit is contained in:
jimtla 2010-07-31 20:02:54 +04:00
parent 598471cf71
commit 39ee818f98
11 changed files with 108 additions and 89 deletions

View file

@ -288,15 +288,15 @@ typedef struct SDL_TouchFingerEvent
Uint32 type; /**< ::SDL_FINGERMOTION OR
SDL_FINGERDOWN OR SDL_FINGERUP*/
Uint32 windowID; /**< The window with mouse focus, if any */
long touchId; /**< The touch device id */
long fingerId;
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
Uint8 state; /**< The current button state */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
float x;
float y;
int pressure;
Uint16 x;
Uint16 y;
Uint16 pressure;
} SDL_TouchFingerEvent;
@ -307,7 +307,7 @@ typedef struct SDL_TouchButtonEvent
{
Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
Uint32 windowID; /**< The window with mouse focus, if any */
long touchId; /**< The touch device index */
SDL_TouchID touchId; /**< The touch device index */
Uint8 state; /**< The current button state */
Uint8 button; /**< The button changing state */
Uint8 padding1;
@ -323,7 +323,7 @@ typedef struct SDL_MultiGestureEvent
{
Uint32 type; /**< ::SDL_MULTIGESTURE */
Uint32 windowID; /**< The window with mouse focus, if any */
long touchId; /**< The touch device index */
SDL_TouchID touchId; /**< The touch device index */
float dTheta;
float dDist;
float x; //currently 0...1. Change to screen coords?
@ -335,8 +335,8 @@ typedef struct SDL_DollarGestureEvent
{
Uint32 type; /**< ::SDL_DOLLARGESTURE */
Uint32 windowID; /**< The window with mouse focus, if any */
long touchId; /**< The touch device index */
unsigned long gestureId;
SDL_TouchID touchId; /**< The touch device index */
SDL_GestureID gestureId;
float error;
/*
//TODO: Enable to give location?

View file

@ -33,6 +33,9 @@
#include "SDL_error.h"
#include "SDL_video.h"
#include "SDL_touch.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@ -41,6 +44,7 @@ extern "C" {
/* *INDENT-ON* */
#endif
typedef Uint64 SDL_GestureID;
/* Function prototypes */
@ -49,7 +53,7 @@ extern "C" {
*
*
*/
extern DECLSPEC int SDLCALL SDL_RecordGesture(int touchId);
extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
/**
@ -65,7 +69,7 @@ extern "C" {
*
*/
extern DECLSPEC int
SDLCALL SDL_SaveDollarTemplate(unsigned long gestureId,SDL_RWops *src);
SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
/**
@ -73,7 +77,8 @@ extern "C" {
*
*
*/
extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(int touchId, SDL_RWops *src);
extern DECLSPEC
int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);

View file

@ -42,15 +42,19 @@ extern "C" {
#endif
typedef Uint64 SDL_TouchID;
typedef Uint64 SDL_FingerID;
struct SDL_Finger {
long id;
float x;
float y;
float xdelta;
float ydelta;
float last_x, last_y,last_pressure; /* the last reported coordinates */
SDL_FingerID id;
Uint16 x;
Uint16 y;
Uint16 xdelta;
Uint16 ydelta;
Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */
SDL_bool down;
float pressure;
Uint16 pressure;
};
typedef struct SDL_Touch SDL_Touch;
@ -66,12 +70,13 @@ struct SDL_Touch {
float pressure_max, pressure_min;
float x_max,x_min;
float y_max,y_min;
float xres,yres,pressureres;
Uint16 xres,yres,pressureres;
float native_xres,native_yres,native_pressureres;
float tilt; /* for future use */
float rotation; /* for future use */
/* Data common to all touch */
long id;
SDL_TouchID id;
SDL_Window *focus;
char *name;
@ -95,7 +100,7 @@ struct SDL_Touch {
*
*
*/
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(long id);
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
@ -104,7 +109,8 @@ struct SDL_Touch {
*
*
*/
extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, long id);
extern
DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus