Skip to content

Commit

Permalink
Gesture: remove warnings when ENABLE_DOLLAR is undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Dec 16, 2018
1 parent c3e3503 commit c0c8f2d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/events/SDL_gesture.c
Expand Up @@ -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]; */
Expand Down Expand Up @@ -444,6 +445,7 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu
}
return bestDiff;
}
#endif

int SDL_GestureAddTouch(SDL_TouchID touchId)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c0c8f2d

Please sign in to comment.