mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-12-29 06:03:44 +00:00
Changed parameter name for gesture template save functions from "src" to "dst".
This commit is contained in:
parent
95bbf5f443
commit
cd37485e3c
@ -34,9 +34,9 @@ Most programs will want to define an appropriate error threshold and check to be
|
||||
|
||||
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.
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
*
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -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 */
|
||||
/* 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)
|
||||
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;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
SDL_GestureTouch* touch = &SDL_gestureTouch[i];
|
||||
for (j = 0; j < touch->numDollarTemplates; j++) {
|
||||
rtrn += SaveTemplate(&touch->dollarTemplate[i],src);
|
||||
rtrn += SaveTemplate(&touch->dollarTemplate[i], dst);
|
||||
}
|
||||
}
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src)
|
||||
int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst)
|
||||
{
|
||||
int i,j;
|
||||
for (i = 0; i < SDL_numGestureTouches; i++) {
|
||||
SDL_GestureTouch* touch = &SDL_gestureTouch[i];
|
||||
for (j = 0; j < touch->numDollarTemplates; j++) {
|
||||
if (touch->dollarTemplate[i].hash == gestureId) {
|
||||
return SaveTemplate(&touch->dollarTemplate[i],src);
|
||||
return SaveTemplate(&touch->dollarTemplate[i], dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ int main(int argc, char* argv[])
|
||||
SDL_Surface *screen;
|
||||
SDL_Event event;
|
||||
SDL_bool quitting = SDL_FALSE;
|
||||
SDL_RWops *src;
|
||||
SDL_RWops *stream;
|
||||
|
||||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
@ -241,14 +241,14 @@ int main(int argc, char* argv[])
|
||||
SDL_RecordGesture(-1);
|
||||
break;
|
||||
case SDLK_s:
|
||||
src = SDL_RWFromFile("gestureSave","w");
|
||||
SDL_Log("Wrote %i templates",SDL_SaveAllDollarTemplates(src));
|
||||
SDL_RWclose(src);
|
||||
stream = SDL_RWFromFile("gestureSave", "w");
|
||||
SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream));
|
||||
SDL_RWclose(stream);
|
||||
break;
|
||||
case SDLK_l:
|
||||
src = SDL_RWFromFile("gestureSave","r");
|
||||
SDL_Log("Loaded: %i",SDL_LoadDollarTemplates(-1,src));
|
||||
SDL_RWclose(src);
|
||||
stream = SDL_RWFromFile("gestureSave", "r");
|
||||
SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream));
|
||||
SDL_RWclose(stream);
|
||||
break;
|
||||
case SDLK_ESCAPE:
|
||||
quitting = SDL_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user