Gesture: remove warnings when ENABLE_DOLLAR is undefined.

This commit is contained in:
Sylvain Becker 2018-12-16 11:15:21 +01:00
parent c3e3503ee8
commit c0c8f2d703
1 changed files with 11 additions and 3 deletions

View File

@ -279,6 +279,7 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
}
#if defined(ENABLE_DOLLAR)
static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang)
{
/* SDL_FloatPoint p[DOLLARNPOINTS]; */
@ -444,6 +445,7 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu
}
return bestDiff;
}
#endif
int SDL_GestureAddTouch(SDL_TouchID touchId)
{
@ -509,6 +511,7 @@ static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist
return SDL_PushEvent(&event) > 0;
}
#if defined(ENABLE_DOLLAR)
static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
SDL_GestureID gestureId,float error)
{
@ -533,14 +536,17 @@ static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
event.dgesture.gestureId = gestureId;
return SDL_PushEvent(&event) > 0;
}
#endif
void SDL_GestureProcessEvent(SDL_Event* event)
{
float x,y;
#if defined(ENABLE_DOLLAR)
int index;
int i;
float pathDx, pathDy;
#endif
SDL_FloatPoint lastP;
SDL_FloatPoint lastCentroid;
float lDist;
@ -561,11 +567,13 @@ void SDL_GestureProcessEvent(SDL_Event* event)
/* Finger Up */
if (event->type == SDL_FINGERUP) {
#if defined(ENABLE_DOLLAR)
SDL_FloatPoint path[DOLLARNPOINTS];
#endif
inTouch->numDownFingers--;
#ifdef ENABLE_DOLLAR
#if defined(ENABLE_DOLLAR)
if (inTouch->recording) {
inTouch->recording = SDL_FALSE;
dollarNormalize(&inTouch->dollarPath,path);
@ -610,7 +618,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
else if (event->type == SDL_FINGERMOTION) {
float dx = event->tfinger.dx;
float dy = event->tfinger.dy;
#ifdef ENABLE_DOLLAR
#if defined(ENABLE_DOLLAR)
SDL_DollarPath* path = &inTouch->dollarPath;
if (path->numPoints < MAXPATHSIZE) {
path->p[path->numPoints].x = inTouch->centroid.x;
@ -687,7 +695,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
/* printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
inTouch->centroid.x,inTouch->centroid.y); */
#ifdef ENABLE_DOLLAR
#if defined(ENABLE_DOLLAR)
inTouch->dollarPath.length = 0;
inTouch->dollarPath.p[0].x = x;
inTouch->dollarPath.p[0].y = y;