Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
428e61a4
Commit
428e61a4
authored
Oct 27, 2011
by
Kees Bakker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat SDL_gesture.c (part 1, reindent using Emacs, c-basic-offset 4)
parent
61d3a02e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
536 additions
and
519 deletions
+536
-519
SDL_gesture.c
src/events/SDL_gesture.c
+536
-519
No files found.
src/events/SDL_gesture.c
View file @
428e61a4
...
...
@@ -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: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment