Upgraded touchId/fingerId to long. Changed position variables to floats.
This commit is contained in:
parent
6ed8759bcc
commit
c9b9312be3
7 changed files with 69 additions and 78 deletions
|
@ -288,12 +288,14 @@ typedef struct SDL_TouchFingerEvent
|
||||||
Uint32 type; /**< ::SDL_FINGERMOTION OR
|
Uint32 type; /**< ::SDL_FINGERMOTION OR
|
||||||
SDL_FINGERDOWN OR SDL_FINGERUP*/
|
SDL_FINGERDOWN OR SDL_FINGERUP*/
|
||||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||||
Uint8 touchId; /**< The touch device id */
|
long touchId; /**< The touch device id */
|
||||||
|
long fingerId;
|
||||||
Uint8 state; /**< The current button state */
|
Uint8 state; /**< The current button state */
|
||||||
Uint8 fingerId;
|
|
||||||
Uint8 padding1;
|
Uint8 padding1;
|
||||||
int x;
|
Uint8 padding2;
|
||||||
int y;
|
Uint8 padding3;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
int pressure;
|
int pressure;
|
||||||
} SDL_TouchFingerEvent;
|
} SDL_TouchFingerEvent;
|
||||||
|
|
||||||
|
@ -305,11 +307,11 @@ typedef struct SDL_TouchButtonEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
|
Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
|
||||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||||
Uint8 touchId; /**< The touch device index */
|
long touchId; /**< The touch device index */
|
||||||
Uint8 state; /**< The current button state */
|
Uint8 state; /**< The current button state */
|
||||||
Uint8 button; /**< The button changing state */
|
Uint8 button; /**< The button changing state */
|
||||||
Uint8 padding1;
|
Uint8 padding1;
|
||||||
|
Uint8 padding2;
|
||||||
} SDL_TouchButtonEvent;
|
} SDL_TouchButtonEvent;
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,10 +323,7 @@ typedef struct SDL_MultiGestureEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_MULTIGESTURE */
|
Uint32 type; /**< ::SDL_MULTIGESTURE */
|
||||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||||
Uint8 touchId; /**< The touch device index */
|
long touchId; /**< The touch device index */
|
||||||
Uint8 padding1;
|
|
||||||
Uint8 padding2;
|
|
||||||
Uint8 padding3;
|
|
||||||
float dTheta;
|
float dTheta;
|
||||||
float dDist;
|
float dDist;
|
||||||
float x; //currently 0...1. Change to screen coords?
|
float x; //currently 0...1. Change to screen coords?
|
||||||
|
@ -336,10 +335,7 @@ typedef struct SDL_DollarGestureEvent
|
||||||
{
|
{
|
||||||
Uint32 type; /**< ::SDL_DOLLARGESTURE */
|
Uint32 type; /**< ::SDL_DOLLARGESTURE */
|
||||||
Uint32 windowID; /**< The window with mouse focus, if any */
|
Uint32 windowID; /**< The window with mouse focus, if any */
|
||||||
Uint8 touchId; /**< The touch device index */
|
long touchId; /**< The touch device index */
|
||||||
Uint8 padding1;
|
|
||||||
Uint8 padding2;
|
|
||||||
Uint8 padding3;
|
|
||||||
unsigned long gestureId;
|
unsigned long gestureId;
|
||||||
float error;
|
float error;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,15 +43,14 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
struct SDL_Finger {
|
struct SDL_Finger {
|
||||||
int id;
|
long id;
|
||||||
int x;
|
float x;
|
||||||
int y;
|
float y;
|
||||||
int z; /* for future use */
|
float xdelta;
|
||||||
int xdelta;
|
float ydelta;
|
||||||
int ydelta;
|
float last_x, last_y,last_pressure; /* the last reported coordinates */
|
||||||
int last_x, last_y,last_pressure; /* the last reported coordinates */
|
|
||||||
SDL_bool down;
|
SDL_bool down;
|
||||||
int pressure;
|
float pressure;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct SDL_Touch SDL_Touch;
|
typedef struct SDL_Touch SDL_Touch;
|
||||||
|
@ -64,15 +63,15 @@ struct SDL_Touch {
|
||||||
void (*FreeTouch) (SDL_Touch * touch);
|
void (*FreeTouch) (SDL_Touch * touch);
|
||||||
|
|
||||||
/* data common for tablets */
|
/* data common for tablets */
|
||||||
int pressure_max, pressure_min;
|
float pressure_max, pressure_min;
|
||||||
int x_max,x_min;
|
float x_max,x_min;
|
||||||
int y_max,y_min;
|
float y_max,y_min;
|
||||||
int xres,yres,pressureres;
|
float xres,yres,pressureres;
|
||||||
int tilt; /* for future use */
|
float tilt; /* for future use */
|
||||||
int rotation; /* for future use */
|
float rotation; /* for future use */
|
||||||
|
|
||||||
/* Data common to all touch */
|
/* Data common to all touch */
|
||||||
int id;
|
long id;
|
||||||
SDL_Window *focus;
|
SDL_Window *focus;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -96,7 +95,7 @@ struct SDL_Touch {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(int id);
|
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ struct SDL_Touch {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, int id);
|
extern DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, long id);
|
||||||
|
|
||||||
/* Ends C function definitions when using C++ */
|
/* Ends C function definitions when using C++ */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -42,7 +42,7 @@ SDL_TouchInit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Touch *
|
SDL_Touch *
|
||||||
SDL_GetTouch(int id)
|
SDL_GetTouch(long id)
|
||||||
{
|
{
|
||||||
int index = SDL_GetTouchIndexId(id);
|
int index = SDL_GetTouchIndexId(id);
|
||||||
if (index < 0 || index >= SDL_num_touch) {
|
if (index < 0 || index >= SDL_num_touch) {
|
||||||
|
@ -61,7 +61,7 @@ SDL_GetTouchIndex(int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_GetFingerIndexId(SDL_Touch* touch,int fingerid)
|
SDL_GetFingerIndexId(SDL_Touch* touch,long fingerid)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < touch->num_fingers;i++)
|
for(i = 0;i < touch->num_fingers;i++)
|
||||||
|
@ -72,7 +72,7 @@ SDL_GetFingerIndexId(SDL_Touch* touch,int fingerid)
|
||||||
|
|
||||||
|
|
||||||
SDL_Finger *
|
SDL_Finger *
|
||||||
SDL_GetFinger(SDL_Touch* touch,int id)
|
SDL_GetFinger(SDL_Touch* touch,long id)
|
||||||
{
|
{
|
||||||
int index = SDL_GetFingerIndexId(touch,id);
|
int index = SDL_GetFingerIndexId(touch,id);
|
||||||
if(index < 0 || index >= touch->num_fingers)
|
if(index < 0 || index >= touch->num_fingers)
|
||||||
|
@ -82,7 +82,7 @@ SDL_GetFinger(SDL_Touch* touch,int id)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_GetTouchIndexId(int id)
|
SDL_GetTouchIndexId(long id)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
SDL_Touch *touch;
|
SDL_Touch *touch;
|
||||||
|
@ -146,7 +146,7 @@ SDL_AddTouch(const SDL_Touch * touch, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SDL_DelTouch(int id)
|
SDL_DelTouch(long id)
|
||||||
{
|
{
|
||||||
int index = SDL_GetTouchIndexId(id);
|
int index = SDL_GetTouchIndexId(id);
|
||||||
SDL_Touch *touch = SDL_GetTouch(id);
|
SDL_Touch *touch = SDL_GetTouch(id);
|
||||||
|
@ -189,7 +189,7 @@ SDL_GetNumTouch(void)
|
||||||
return SDL_num_touch;
|
return SDL_num_touch;
|
||||||
}
|
}
|
||||||
SDL_Window *
|
SDL_Window *
|
||||||
SDL_GetTouchFocusWindow(int id)
|
SDL_GetTouchFocusWindow(long id)
|
||||||
{
|
{
|
||||||
SDL_Touch *touch = SDL_GetTouch(id);
|
SDL_Touch *touch = SDL_GetTouch(id);
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ SDL_GetTouchFocusWindow(int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SDL_SetTouchFocus(int id, SDL_Window * window)
|
SDL_SetTouchFocus(long id, SDL_Window * window)
|
||||||
{
|
{
|
||||||
int index = SDL_GetTouchIndexId(id);
|
int index = SDL_GetTouchIndexId(id);
|
||||||
SDL_Touch *touch = SDL_GetTouch(id);
|
SDL_Touch *touch = SDL_GetTouch(id);
|
||||||
|
@ -250,12 +250,12 @@ SDL_SetTouchFocus(int id, SDL_Window * window)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
|
SDL_AddFinger(SDL_Touch* touch,SDL_Finger finger)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
SDL_Finger **fingers;
|
SDL_Finger **fingers;
|
||||||
//printf("Adding Finger...\n");
|
//printf("Adding Finger...\n");
|
||||||
if (SDL_GetFingerIndexId(touch,finger->id) != -1) {
|
if (SDL_GetFingerIndexId(touch,finger.id) != -1) {
|
||||||
SDL_SetError("Finger ID already in use");
|
SDL_SetError("Finger ID already in use");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,14 +282,14 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*(touch->fingers[index]) = *finger;
|
*(touch->fingers[index]) = finger;
|
||||||
touch->num_fingers++;
|
touch->num_fingers++;
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_DelFinger(SDL_Touch* touch,int fingerid)
|
SDL_DelFinger(SDL_Touch* touch,long fingerid)
|
||||||
{
|
{
|
||||||
int index = SDL_GetFingerIndexId(touch,fingerid);
|
int index = SDL_GetFingerIndexId(touch,fingerid);
|
||||||
SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
|
SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
|
||||||
|
@ -307,7 +307,7 @@ SDL_DelFinger(SDL_Touch* touch,int fingerid)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressure)
|
SDL_SendFingerDown(long id, long fingerid, SDL_bool down, float x, float y, float pressure)
|
||||||
{
|
{
|
||||||
int posted;
|
int posted;
|
||||||
SDL_Touch* touch = SDL_GetTouch(id);
|
SDL_Touch* touch = SDL_GetTouch(id);
|
||||||
|
@ -330,7 +330,7 @@ SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressu
|
||||||
nf.last_y = y;
|
nf.last_y = y;
|
||||||
nf.last_pressure = pressure;
|
nf.last_pressure = pressure;
|
||||||
nf.down = SDL_FALSE;
|
nf.down = SDL_FALSE;
|
||||||
SDL_AddFinger(touch,&nf);
|
SDL_AddFinger(touch,nf);
|
||||||
finger = &nf;
|
finger = &nf;
|
||||||
}
|
}
|
||||||
else if(finger->down) return 0;
|
else if(finger->down) return 0;
|
||||||
|
@ -339,7 +339,7 @@ SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressu
|
||||||
if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
|
if (SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.tfinger.type = SDL_FINGERDOWN;
|
event.tfinger.type = SDL_FINGERDOWN;
|
||||||
event.tfinger.touchId = (Uint8) id;
|
event.tfinger.touchId = id;
|
||||||
event.tfinger.x = x;
|
event.tfinger.x = x;
|
||||||
event.tfinger.y = y;
|
event.tfinger.y = y;
|
||||||
event.tfinger.state = touch->buttonstate;
|
event.tfinger.state = touch->buttonstate;
|
||||||
|
@ -356,7 +356,7 @@ SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressu
|
||||||
if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
|
if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.tfinger.type = SDL_FINGERUP;
|
event.tfinger.type = SDL_FINGERUP;
|
||||||
event.tfinger.touchId = (Uint8) id;
|
event.tfinger.touchId = id;
|
||||||
event.tfinger.state = touch->buttonstate;
|
event.tfinger.state = touch->buttonstate;
|
||||||
event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
|
event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerId = fingerid;
|
||||||
|
@ -367,16 +367,16 @@ SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressu
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SendTouchMotion(int id, int fingerid, int relative,
|
SDL_SendTouchMotion(long id, long fingerid, int relative,
|
||||||
int x, int y, int pressure)
|
float x, float y, float pressure)
|
||||||
{
|
{
|
||||||
int index = SDL_GetTouchIndexId(id);
|
int index = SDL_GetTouchIndexId(id);
|
||||||
SDL_Touch *touch = SDL_GetTouch(id);
|
SDL_Touch *touch = SDL_GetTouch(id);
|
||||||
SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
|
SDL_Finger *finger = SDL_GetFinger(touch,fingerid);
|
||||||
int posted;
|
int posted;
|
||||||
int xrel;
|
float xrel;
|
||||||
int yrel;
|
float yrel;
|
||||||
int x_max = 0, y_max = 0;
|
float x_max = 0, y_max = 0;
|
||||||
|
|
||||||
if (!touch) {
|
if (!touch) {
|
||||||
return SDL_TouchNotFoundError(id);
|
return SDL_TouchNotFoundError(id);
|
||||||
|
@ -444,8 +444,8 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
|
||||||
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
|
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.tfinger.type = SDL_FINGERMOTION;
|
event.tfinger.type = SDL_FINGERMOTION;
|
||||||
event.tfinger.touchId = (Uint8) id;
|
event.tfinger.touchId = id;
|
||||||
event.tfinger.fingerId = (Uint8) fingerid;
|
event.tfinger.fingerId = fingerid;
|
||||||
event.tfinger.x = x;
|
event.tfinger.x = x;
|
||||||
event.tfinger.y = y;
|
event.tfinger.y = y;
|
||||||
event.tfinger.pressure = pressure;
|
event.tfinger.pressure = pressure;
|
||||||
|
@ -460,7 +460,7 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int
|
int
|
||||||
SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
|
SDL_SendTouchButton(long id, Uint8 state, Uint8 button)
|
||||||
{
|
{
|
||||||
SDL_Touch *touch = SDL_GetTouch(id);
|
SDL_Touch *touch = SDL_GetTouch(id);
|
||||||
int posted;
|
int posted;
|
||||||
|
@ -499,7 +499,7 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
|
||||||
if (SDL_GetEventState(type) == SDL_ENABLE) {
|
if (SDL_GetEventState(type) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = type;
|
event.type = type;
|
||||||
event.tbutton.touchId = (Uint8) touch->id;
|
event.tbutton.touchId = touch->id;
|
||||||
event.tbutton.state = state;
|
event.tbutton.state = state;
|
||||||
event.tbutton.button = button;
|
event.tbutton.button = button;
|
||||||
event.tbutton.windowID = touch->focus ? touch->focus->id : 0;
|
event.tbutton.windowID = touch->focus ? touch->focus->id : 0;
|
||||||
|
@ -509,7 +509,7 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
SDL_GetTouchName(int id)
|
SDL_GetTouchName(long id)
|
||||||
{
|
{
|
||||||
SDL_Touch *touch = SDL_GetTouch(id);
|
SDL_Touch *touch = SDL_GetTouch(id);
|
||||||
if (!touch) {
|
if (!touch) {
|
||||||
|
@ -518,12 +518,12 @@ SDL_GetTouchName(int id)
|
||||||
return touch->name;
|
return touch->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_TouchNotFoundError(int id) {
|
int SDL_TouchNotFoundError(long id) {
|
||||||
printf("ERROR: Cannot send touch on non-existent device with id: %i make sure SDL_AddTouch has been called\n",id);
|
printf("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id);
|
||||||
printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
|
printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i < SDL_num_touch;i++) {
|
for(i=0;i < SDL_num_touch;i++) {
|
||||||
printf("ERROR: %i\n",SDL_touchPads[i]->id);
|
printf("ERROR: %li\n",SDL_touchPads[i]->id);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ extern int SDL_TouchInit(void);
|
||||||
extern SDL_Touch *SDL_GetTouchIndex(int index);
|
extern SDL_Touch *SDL_GetTouchIndex(int index);
|
||||||
|
|
||||||
/* Get the touch with id = id */
|
/* Get the touch with id = id */
|
||||||
extern SDL_Touch *SDL_GetTouch(int id);
|
extern SDL_Touch *SDL_GetTouch(long id);
|
||||||
|
|
||||||
/*Get the finger at an index */
|
/*Get the finger at an index */
|
||||||
extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index);
|
extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index);
|
||||||
|
|
||||||
/* Get the finger with id = id */
|
/* Get the finger with id = id */
|
||||||
extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,int id);
|
extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,long id);
|
||||||
|
|
||||||
|
|
||||||
/* Add a touch, possibly reattaching at a particular index (or -1),
|
/* Add a touch, possibly reattaching at a particular index (or -1),
|
||||||
|
@ -49,26 +49,23 @@ extern int SDL_AddTouch(const SDL_Touch * touch, char *name);
|
||||||
|
|
||||||
|
|
||||||
/* Remove a touch at an index, clearing the slot for later */
|
/* Remove a touch at an index, clearing the slot for later */
|
||||||
extern void SDL_DelTouch(int index);
|
extern void SDL_DelTouch(long id);
|
||||||
|
|
||||||
/* Set the touch focus window */
|
/* Set the touch focus window */
|
||||||
extern void SDL_SetTouchFocus(int id, SDL_Window * window);
|
extern void SDL_SetTouchFocus(long id, SDL_Window * window);
|
||||||
|
|
||||||
/* Send a touch motion event for a touch */
|
/* Send a touch motion event for a touch */
|
||||||
extern int SDL_SendTouchMotion(int id, int fingerid,
|
extern int SDL_SendTouchMotion(long id, long fingerid,
|
||||||
int relative, int x, int y, int z);
|
int relative, float x, float y, float z);
|
||||||
|
|
||||||
/* Send a touch button event for a touch */
|
/* Send a touch button event for a touch */
|
||||||
extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
|
extern int SDL_SendTouchButton(long id, Uint8 state, Uint8 button);
|
||||||
|
|
||||||
/* Shutdown the touch subsystem */
|
/* Shutdown the touch subsystem */
|
||||||
extern void SDL_TouchQuit(void);
|
extern void SDL_TouchQuit(void);
|
||||||
|
|
||||||
/* Get the index of a touch device */
|
/* Get the index of a touch device */
|
||||||
extern int SDL_GetTouchIndexId(int id);
|
extern int SDL_GetTouchIndexId(long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SDL_touch_c_h */
|
#endif /* _SDL_touch_c_h */
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "../../events/SDL_mouse_c.h"
|
#include "../../events/SDL_mouse_c.h"
|
||||||
#include "../../events/SDL_touch_c.h"
|
#include "../../events/SDL_touch_c.h"
|
||||||
#include "../../events/SDL_windowevents_c.h"
|
#include "../../events/SDL_windowevents_c.h"
|
||||||
|
|
||||||
#include "SDL_cocoavideo.h"
|
#include "SDL_cocoavideo.h"
|
||||||
|
|
||||||
static __inline__ void ConvertNSRect(NSRect *r)
|
static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
|
@ -299,7 +298,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
while (touch) {
|
while (touch) {
|
||||||
long touchId = (long)[touch device];
|
long touchId = (long)[touch device];
|
||||||
if (!SDL_GetTouch(touchId)) {
|
if (!SDL_GetTouch(touchId)) {
|
||||||
printf("Adding touch: %i\n",touchId)
|
printf("Adding touch: %li\n",touchId);
|
||||||
SDL_Touch touch;
|
SDL_Touch touch;
|
||||||
|
|
||||||
touch.id = touchId;
|
touch.id = touchId;
|
||||||
|
@ -316,7 +315,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
if (SDL_AddTouch(&touch, "") < 0) {
|
if (SDL_AddTouch(&touch, "") < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("Success, added touch: %i\n",touchId)
|
printf("Success, added touch: %lin",touchId);
|
||||||
}
|
}
|
||||||
float x = [touch normalizedPosition].x;
|
float x = [touch normalizedPosition].x;
|
||||||
float y = [touch normalizedPosition].y;
|
float y = [touch normalizedPosition].y;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FIXED_MULTITOUCH
|
#if FIXED_MULTITOUCH
|
||||||
int touchId;
|
long touchId;
|
||||||
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
|
#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
|
||||||
UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
|
UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,7 +28,7 @@ int bstatus;
|
||||||
|
|
||||||
int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF};
|
int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF};
|
||||||
|
|
||||||
int index2fingerid[MAXFINGERS];
|
long index2fingerid[MAXFINGERS];
|
||||||
int fingersDown;
|
int fingersDown;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -38,7 +38,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Point p;
|
Point p;
|
||||||
float pressure;
|
float pressure;
|
||||||
int id;
|
long id;
|
||||||
} Finger;
|
} Finger;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -378,7 +378,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERDOWN:
|
case SDL_FINGERDOWN:
|
||||||
printf("Finger: %i down - x: %i, y: %i\n",event.tfinger.fingerId,
|
printf("Finger: %li down - x: %f, y: %f\n",event.tfinger.fingerId,
|
||||||
event.tfinger.x,event.tfinger.y);
|
event.tfinger.x,event.tfinger.y);
|
||||||
|
|
||||||
for(i = 0;i<MAXFINGERS;i++)
|
for(i = 0;i<MAXFINGERS;i++)
|
||||||
|
@ -390,7 +390,7 @@ int main(int argc, char* argv[])
|
||||||
finger[i].p.y = event.tfinger.y;
|
finger[i].p.y = event.tfinger.y;
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
printf("Figner: %i up - x: %i, y: %i\n",event.tfinger.fingerId,
|
printf("Figner: %li up - x: %f, y: %f\n",event.tfinger.fingerId,
|
||||||
event.tfinger.x,event.tfinger.y);
|
event.tfinger.x,event.tfinger.y);
|
||||||
for(i = 0;i<MAXFINGERS;i++)
|
for(i = 0;i<MAXFINGERS;i++)
|
||||||
if(index2fingerid[i] == event.tfinger.fingerId) {
|
if(index2fingerid[i] == event.tfinger.fingerId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue