Changed parameter name for gesture template save functions from "src" to "dst".

This commit is contained in:
Philipp Wiesemann committed 2013-11-02 12:07:21 +01:00
1 parent 95bbf5f443
commit cd37485e3c
4 files changed
+19 -20

No files matched your search

+2 -2
View File
@@ -34,9 +34,9 @@ Most programs will want to define an appropriate error threshold and check to be
Saving: Saving:
------- -------
To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId is the id of the gesture you want to save, and src is an SDL_RWops pointer to the file where the gesture will be stored. To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(src) where source is an SDL_RWops pointer to the file where the gesture will be stored. To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
Both functions return the number of gestures successfully saved. Both functions return the number of gestures successfully saved.
+2 -2
View File
@@ -58,14 +58,14 @@ extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
* *
* *
*/ */
extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src); extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
/** /**
* \brief Save a currently loaded Dollar Gesture template * \brief Save a currently loaded Dollar Gesture template
* *
* *
*/ */
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src); extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
/** /**
+8 -9
View File
@@ -116,15 +116,14 @@ static unsigned long SDL_HashDollar(SDL_FloatPoint* points)
} }
static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst)
{ {
if (src == NULL) return 0; if (dst == NULL) return 0;
/* No Longer storing the Hash, rehash on load */ /* No Longer storing the Hash, rehash on load */
/* if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0; */ /* if (SDL_RWops.write(dst, &(templ->hash), sizeof(templ->hash), 1) != 1) return 0; */
if (SDL_RWwrite(src,templ->path, if (SDL_RWwrite(dst, templ->path,
sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS)
return 0; return 0;
@@ -132,26 +131,26 @@ static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src)
} }
int SDL_SaveAllDollarTemplates(SDL_RWops *src) int SDL_SaveAllDollarTemplates(SDL_RWops *dst)
{ {
int i,j,rtrn = 0; int i,j,rtrn = 0;
for (i = 0; i < SDL_numGestureTouches; i++) { for (i = 0; i < SDL_numGestureTouches; i++) {
SDL_GestureTouch* touch = &SDL_gestureTouch[i]; SDL_GestureTouch* touch = &SDL_gestureTouch[i];
for (j = 0; j < touch->numDollarTemplates; j++) { for (j = 0; j < touch->numDollarTemplates; j++) {
rtrn += SaveTemplate(&touch->dollarTemplate[i],src); rtrn += SaveTemplate(&touch->dollarTemplate[i], dst);
} }
} }
return rtrn; return rtrn;
} }
int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst)
{ {
int i,j; int i,j;
for (i = 0; i < SDL_numGestureTouches; i++) { for (i = 0; i < SDL_numGestureTouches; i++) {
SDL_GestureTouch* touch = &SDL_gestureTouch[i]; SDL_GestureTouch* touch = &SDL_gestureTouch[i];
for (j = 0; j < touch->numDollarTemplates; j++) { for (j = 0; j < touch->numDollarTemplates; j++) {
if (touch->dollarTemplate[i].hash == gestureId) { if (touch->dollarTemplate[i].hash == gestureId) {
return SaveTemplate(&touch->dollarTemplate[i],src); return SaveTemplate(&touch->dollarTemplate[i], dst);
} }
} }
} }
+7 -7
View File
@@ -205,7 +205,7 @@ int main(int argc, char* argv[])
SDL_Surface *screen; SDL_Surface *screen;
SDL_Event event; SDL_Event event;
SDL_bool quitting = SDL_FALSE; SDL_bool quitting = SDL_FALSE;
SDL_RWops *src; SDL_RWops *stream;
/* Enable standard application logging */ /* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
@@ -241,14 +241,14 @@ int main(int argc, char* argv[])
SDL_RecordGesture(-1); SDL_RecordGesture(-1);
break; break;
case SDLK_s: case SDLK_s:
src = SDL_RWFromFile("gestureSave","w"); stream = SDL_RWFromFile("gestureSave", "w");
SDL_Log("Wrote %i templates",SDL_SaveAllDollarTemplates(src)); SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream));
SDL_RWclose(src); SDL_RWclose(stream);
break; break;
case SDLK_l: case SDLK_l:
src = SDL_RWFromFile("gestureSave","r"); stream = SDL_RWFromFile("gestureSave", "r");
SDL_Log("Loaded: %i",SDL_LoadDollarTemplates(-1,src)); SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream));
SDL_RWclose(src); SDL_RWclose(stream);
break; break;
case SDLK_ESCAPE: case SDLK_ESCAPE:
quitting = SDL_TRUE; quitting = SDL_TRUE;