Commit 428e61a4 authored by Kees Bakker's avatar Kees Bakker

Reformat SDL_gesture.c (part 1, reindent using Emacs, c-basic-offset 4)

parent 61d3a02e
......@@ -80,7 +80,8 @@ int SDL_numGestureTouches = 0;
SDL_bool recordAll;
#if 0
static void PrintPath(SDL_FloatPoint *path) {
static void PrintPath(SDL_FloatPoint *path)
{
int i;
printf("Path:");
for(i=0;i<DOLLARNPOINTS;i++) {
......@@ -90,7 +91,8 @@ static void PrintPath(SDL_FloatPoint *path) {
}
#endif
int SDL_RecordGesture(SDL_TouchID touchId) {
int SDL_RecordGesture(SDL_TouchID touchId)
{
int i;
if(touchId < 0) recordAll = SDL_TRUE;
for(i = 0;i < SDL_numGestureTouches; i++) {
......@@ -103,7 +105,8 @@ int SDL_RecordGesture(SDL_TouchID touchId) {
return (touchId < 0);
}
unsigned long SDL_HashDollar(SDL_FloatPoint* points) {
unsigned long SDL_HashDollar(SDL_FloatPoint* points)
{
unsigned long hash = 5381;
int i;
for(i = 0;i < DOLLARNPOINTS; i++) {
......@@ -114,7 +117,8 @@ unsigned long SDL_HashDollar(SDL_FloatPoint* points) {
}
static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) {
static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src)
{
if(src == NULL) return 0;
......@@ -129,7 +133,8 @@ static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) {
}
int SDL_SaveAllDollarTemplates(SDL_RWops *src) {
int SDL_SaveAllDollarTemplates(SDL_RWops *src)
{
int i,j,rtrn = 0;
for(i = 0; i < SDL_numGestureTouches; i++) {
SDL_GestureTouch* touch = &SDL_gestureTouch[i];
......@@ -140,7 +145,8 @@ int SDL_SaveAllDollarTemplates(SDL_RWops *src) {
return rtrn;
}
int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) {
int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src)
{
int i,j;
for(i = 0; i < SDL_numGestureTouches; i++) {
SDL_GestureTouch* touch = &SDL_gestureTouch[i];
......@@ -156,7 +162,8 @@ int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) {
//path is an already sampled set of points
//Returns the index of the gesture on success, or -1
static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path) {
static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path)
{
SDL_DollarTemplate* dollarTemplate;
SDL_DollarTemplate *templ;
int i = 0;
......@@ -205,7 +212,8 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path)
return -1;
}
int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src)
{
int i,loaded = 0;
SDL_GestureTouch *touch = NULL;
if(src == NULL) return 0;
......@@ -242,7 +250,8 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
}
float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang)
{
// SDL_FloatPoint p[DOLLARNPOINTS];
float dist = 0;
SDL_FloatPoint p;
......@@ -257,7 +266,8 @@ float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
}
float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
{
//------------BEGIN DOLLAR BLACKBOX----------------//
//-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-//
//-"http://depts.washington.edu/aimgroup/proj/dollar/"-//
......@@ -294,7 +304,8 @@ float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
}
//DollarPath contains raw points, plus (possibly) the calculated length
int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
{
int i;
float interval;
float dist;
......@@ -387,7 +398,8 @@ int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
return numPoints;
}
float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) {
float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch)
{
SDL_FloatPoint points[DOLLARNPOINTS];
int i;
......@@ -404,7 +416,8 @@ float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch
return bestDiff;
}
int SDL_GestureAddTouch(SDL_Touch* touch) {
int SDL_GestureAddTouch(SDL_Touch* touch)
{
SDL_GestureTouch *gestureTouch = (SDL_GestureTouch *)SDL_realloc(SDL_gestureTouch,
(SDL_numGestureTouches + 1) *
sizeof(SDL_GestureTouch));
......@@ -431,7 +444,8 @@ int SDL_GestureAddTouch(SDL_Touch* touch) {
return 0;
}
int SDL_GestureRemoveTouch(SDL_TouchID id) {
int SDL_GestureRemoveTouch(SDL_TouchID id)
{
int i;
for (i = 0; i < SDL_numGestureTouches; i++) {
if (SDL_gestureTouch[i].id == id) {
......@@ -444,7 +458,8 @@ int SDL_GestureRemoveTouch(SDL_TouchID id) {
}
SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
{
int i;
for(i = 0;i < SDL_numGestureTouches; i++) {
//printf("%i ?= %i\n",SDL_gestureTouch[i].id,id);
......@@ -453,7 +468,8 @@ SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) {
return NULL;
}
int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) {
int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
{
SDL_Event event;
event.mgesture.type = SDL_MULTIGESTURE;
event.mgesture.touchId = touch->id;
......@@ -466,7 +482,8 @@ int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) {
}
int SDL_SendGestureDollar(SDL_GestureTouch* touch,
SDL_GestureID gestureId,float error) {
SDL_GestureID gestureId,float error)
{
SDL_Event event;
event.dgesture.type = SDL_DOLLARGESTURE;
event.dgesture.touchId = touch->id;
......@@ -483,7 +500,8 @@ int SDL_SendGestureDollar(SDL_GestureTouch* touch,
}
int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) {
int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
{
SDL_Event event;
event.dgesture.type = SDL_DOLLARRECORD;
event.dgesture.touchId = touch->id;
......@@ -661,5 +679,4 @@ void SDL_GestureProcessEvent(SDL_Event* event)
}
}
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment