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
7411f753
Commit
7411f753
authored
Aug 29, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed compiling with Visual Studio 2008
parent
adc9598f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
52 deletions
+94
-52
SDL_VS2008.vcproj
VisualC/SDL/SDL_VS2008.vcproj
+34
-2
SDL_gesture.c
src/events/SDL_gesture.c
+31
-30
SDL_touch.c
src/events/SDL_touch.c
+8
-3
SDL_syshaptic.c
src/haptic/nds/SDL_syshaptic.c
+2
-1
SDL_stdlib.c
src/stdlib/SDL_stdlib.c
+6
-0
SDL_win32events.c
src/video/win32/SDL_win32events.c
+12
-9
SDL_win32video.h
src/video/win32/SDL_win32video.h
+1
-7
No files found.
VisualC/SDL/SDL_VS2008.vcproj
View file @
7411f753
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
/>
/>
<Tool
<Tool
Name=
"VCLinkerTool"
Name=
"VCLinkerTool"
AdditionalDependencies=
"msimg32.lib winmm.lib"
AdditionalDependencies=
"msimg32.lib winmm.lib
imm32.lib version.lib
"
OutputFile=
"$(IntDir)\SDL.dll"
OutputFile=
"$(IntDir)\SDL.dll"
IgnoreAllDefaultLibraries=
"true"
IgnoreAllDefaultLibraries=
"true"
GenerateDebugInformation=
"true"
GenerateDebugInformation=
"true"
...
@@ -249,7 +249,7 @@
...
@@ -249,7 +249,7 @@
/>
/>
<Tool
<Tool
Name=
"VCLinkerTool"
Name=
"VCLinkerTool"
AdditionalDependencies=
"msimg32.lib winmm.lib"
AdditionalDependencies=
"msimg32.lib winmm.lib
imm32.lib version.lib
"
OutputFile=
"$(IntDir)\SDL.dll"
OutputFile=
"$(IntDir)\SDL.dll"
IgnoreAllDefaultLibraries=
"true"
IgnoreAllDefaultLibraries=
"true"
SubSystem=
"2"
SubSystem=
"2"
...
@@ -839,6 +839,14 @@
...
@@ -839,6 +839,14 @@
RelativePath=
"..\..\src\video\win32\SDL_gdirender.h"
RelativePath=
"..\..\src\video\win32\SDL_gdirender.h"
>
>
</File>
</File>
<File
RelativePath=
"..\..\src\events\SDL_gesture.c"
>
</File>
<File
RelativePath=
"..\..\src\events\SDL_gesture_c.h"
>
</File>
<File
<File
RelativePath=
"..\..\src\stdlib\SDL_getenv.c"
RelativePath=
"..\..\src\stdlib\SDL_getenv.c"
>
>
...
@@ -1003,6 +1011,14 @@
...
@@ -1003,6 +1011,14 @@
RelativePath=
"..\..\src\file\SDL_rwops.c"
RelativePath=
"..\..\src\file\SDL_rwops.c"
>
>
</File>
</File>
<File
RelativePath=
"..\..\src\video\SDL_shape.c"
>
</File>
<File
RelativePath=
"..\..\src\video\SDL_shape_internals.h"
>
</File>
<File
<File
RelativePath=
"..\..\src\stdlib\SDL_stdlib.c"
RelativePath=
"..\..\src\stdlib\SDL_stdlib.c"
>
>
...
@@ -1095,6 +1111,14 @@
...
@@ -1095,6 +1111,14 @@
RelativePath=
"..\..\src\timer\SDL_timer_c.h"
RelativePath=
"..\..\src\timer\SDL_timer_c.h"
>
>
</File>
</File>
<File
RelativePath=
"..\..\src\events\SDL_touch.c"
>
</File>
<File
RelativePath=
"..\..\src\events\SDL_touch_c.h"
>
</File>
<File
<File
RelativePath=
"..\..\src\video\SDL_video.c"
RelativePath=
"..\..\src\video\SDL_video.c"
>
>
...
@@ -1167,6 +1191,14 @@
...
@@ -1167,6 +1191,14 @@
RelativePath=
"..\..\src\video\win32\SDL_win32opengl.h"
RelativePath=
"..\..\src\video\win32\SDL_win32opengl.h"
>
>
</File>
</File>
<File
RelativePath=
"..\..\src\video\win32\SDL_win32shape.c"
>
</File>
<File
RelativePath=
"..\..\src\video\win32\SDL_win32shape.h"
>
</File>
<File
<File
RelativePath=
"..\..\src\video\win32\SDL_win32video.c"
RelativePath=
"..\..\src\video\win32\SDL_win32video.c"
>
>
...
...
src/events/SDL_gesture.c
View file @
7411f753
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
#define ENABLE_DOLLAR
#define ENABLE_DOLLAR
//PHI = ((sqrt(5)-1)/2)
#define PHI 0.618033989
#define PHI 0.618033989
typedef
struct
{
typedef
struct
{
...
@@ -80,7 +79,8 @@ SDL_GestureTouch *SDL_gestureTouch;
...
@@ -80,7 +79,8 @@ SDL_GestureTouch *SDL_gestureTouch;
int
SDL_numGestureTouches
=
0
;
int
SDL_numGestureTouches
=
0
;
SDL_bool
recordAll
;
SDL_bool
recordAll
;
void
SDL_PrintPath
(
SDL_FloatPoint
*
path
)
{
#if 0
static void PrintPath(SDL_FloatPoint *path) {
int i;
int i;
printf("Path:");
printf("Path:");
for(i=0;i<DOLLARNPOINTS;i++) {
for(i=0;i<DOLLARNPOINTS;i++) {
...
@@ -88,6 +88,7 @@ void SDL_PrintPath(SDL_FloatPoint *path) {
...
@@ -88,6 +88,7 @@ void SDL_PrintPath(SDL_FloatPoint *path) {
}
}
printf("\n");
printf("\n");
}
}
#endif
int
SDL_RecordGesture
(
SDL_TouchID
touchId
)
{
int
SDL_RecordGesture
(
SDL_TouchID
touchId
)
{
int
i
;
int
i
;
...
@@ -177,7 +178,7 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path)
...
@@ -177,7 +178,7 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path)
templ
=
templ
=
&
inTouch
->
dollarTemplate
[
inTouch
->
numDollarTemplates
];
&
inTouch
->
dollarTemplate
[
inTouch
->
numDollarTemplates
];
memcpy
(
templ
->
path
,
path
,
DOLLARNPOINTS
*
sizeof
(
SDL_FloatPoint
));
SDL_
memcpy
(
templ
->
path
,
path
,
DOLLARNPOINTS
*
sizeof
(
SDL_FloatPoint
));
templ
->
hash
=
SDL_HashDollar
(
templ
->
path
);
templ
->
hash
=
SDL_HashDollar
(
templ
->
path
);
inTouch
->
numDollarTemplates
++
;
inTouch
->
numDollarTemplates
++
;
}
}
...
@@ -196,7 +197,7 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path)
...
@@ -196,7 +197,7 @@ static int SDL_AddDollarGesture(SDL_GestureTouch* inTouch,SDL_FloatPoint* path)
templ
=
templ
=
&
inTouch
->
dollarTemplate
[
inTouch
->
numDollarTemplates
];
&
inTouch
->
dollarTemplate
[
inTouch
->
numDollarTemplates
];
memcpy
(
templ
->
path
,
path
,
DOLLARNPOINTS
*
sizeof
(
SDL_FloatPoint
));
SDL_
memcpy
(
templ
->
path
,
path
,
DOLLARNPOINTS
*
sizeof
(
SDL_FloatPoint
));
templ
->
hash
=
SDL_HashDollar
(
templ
->
path
);
templ
->
hash
=
SDL_HashDollar
(
templ
->
path
);
inTouch
->
numDollarTemplates
++
;
inTouch
->
numDollarTemplates
++
;
return
inTouch
->
numDollarTemplates
-
1
;
return
inTouch
->
numDollarTemplates
-
1
;
...
@@ -222,14 +223,14 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
...
@@ -222,14 +223,14 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) {
DOLLARNPOINTS
)
break
;
DOLLARNPOINTS
)
break
;
if
(
touchId
>=
0
)
{
if
(
touchId
>=
0
)
{
printf
(
"Adding loaded gesture to 1 touch
\n
"
);
//
printf("Adding loaded gesture to 1 touch\n");
if
(
SDL_AddDollarGesture
(
touch
,
templ
.
path
))
loaded
++
;
if
(
SDL_AddDollarGesture
(
touch
,
templ
.
path
))
loaded
++
;
}
}
else
{
else
{
printf
(
"Adding to: %i touches
\n
"
,
SDL_numGestureTouches
);
//
printf("Adding to: %i touches\n",SDL_numGestureTouches);
for
(
i
=
0
;
i
<
SDL_numGestureTouches
;
i
++
)
{
for
(
i
=
0
;
i
<
SDL_numGestureTouches
;
i
++
)
{
touch
=
&
SDL_gestureTouch
[
i
];
touch
=
&
SDL_gestureTouch
[
i
];
printf
(
"Adding loaded gesture to + touches
\n
"
);
//
printf("Adding loaded gesture to + touches\n");
//TODO: What if this fails?
//TODO: What if this fails?
SDL_AddDollarGesture
(
touch
,
templ
.
path
);
SDL_AddDollarGesture
(
touch
,
templ
.
path
);
}
}
...
@@ -247,9 +248,9 @@ float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
...
@@ -247,9 +248,9 @@ float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) {
SDL_FloatPoint
p
;
SDL_FloatPoint
p
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
DOLLARNPOINTS
;
i
++
)
{
for
(
i
=
0
;
i
<
DOLLARNPOINTS
;
i
++
)
{
p
.
x
=
(
float
)(
points
[
i
].
x
*
cos
(
ang
)
-
points
[
i
].
y
*
sin
(
ang
));
p
.
x
=
(
float
)(
points
[
i
].
x
*
SDL_cos
(
ang
)
-
points
[
i
].
y
*
SDL_
sin
(
ang
));
p
.
y
=
(
float
)(
points
[
i
].
x
*
sin
(
ang
)
+
points
[
i
].
y
*
cos
(
ang
));
p
.
y
=
(
float
)(
points
[
i
].
x
*
SDL_sin
(
ang
)
+
points
[
i
].
y
*
SDL_
cos
(
ang
));
dist
+=
(
float
)(
sqrt
((
p
.
x
-
templ
[
i
].
x
)
*
(
p
.
x
-
templ
[
i
].
x
)
+
dist
+=
(
float
)(
SDL_
sqrt
((
p
.
x
-
templ
[
i
].
x
)
*
(
p
.
x
-
templ
[
i
].
x
)
+
(
p
.
y
-
templ
[
i
].
y
)
*
(
p
.
y
-
templ
[
i
].
y
)));
(
p
.
y
-
templ
[
i
].
y
)
*
(
p
.
y
-
templ
[
i
].
y
)));
}
}
return
dist
/
DOLLARNPOINTS
;
return
dist
/
DOLLARNPOINTS
;
...
@@ -267,7 +268,7 @@ float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
...
@@ -267,7 +268,7 @@ float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) {
float
f1
=
dollarDifference
(
points
,
templ
,
x1
);
float
f1
=
dollarDifference
(
points
,
templ
,
x1
);
float
x2
=
(
float
)((
1
-
PHI
)
*
ta
+
PHI
*
tb
);
float
x2
=
(
float
)((
1
-
PHI
)
*
ta
+
PHI
*
tb
);
float
f2
=
dollarDifference
(
points
,
templ
,
x2
);
float
f2
=
dollarDifference
(
points
,
templ
,
x2
);
while
(
fabs
(
ta
-
tb
)
>
dt
)
{
while
(
SDL_
fabs
(
ta
-
tb
)
>
dt
)
{
if
(
f1
<
f2
)
{
if
(
f1
<
f2
)
{
tb
=
x2
;
tb
=
x2
;
x2
=
x1
;
x2
=
x1
;
...
@@ -310,7 +311,7 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
...
@@ -310,7 +311,7 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
path
.
p
[
i
-
1
].
x
;
path
.
p
[
i
-
1
].
x
;
float
dy
=
path
.
p
[
i
].
y
-
float
dy
=
path
.
p
[
i
].
y
-
path
.
p
[
i
-
1
].
y
;
path
.
p
[
i
-
1
].
y
;
path
.
length
+=
(
float
)(
sqrt
(
dx
*
dx
+
dy
*
dy
));
path
.
length
+=
(
float
)(
SDL_
sqrt
(
dx
*
dx
+
dy
*
dy
));
}
}
}
}
...
@@ -322,7 +323,7 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
...
@@ -322,7 +323,7 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
//printf("(%f,%f)\n",path.p[path.numPoints-1].x,path.p[path.numPoints-1].y);
//printf("(%f,%f)\n",path.p[path.numPoints-1].x,path.p[path.numPoints-1].y);
for
(
i
=
1
;
i
<
path
.
numPoints
;
i
++
)
{
for
(
i
=
1
;
i
<
path
.
numPoints
;
i
++
)
{
float
d
=
(
float
)(
sqrt
((
path
.
p
[
i
-
1
].
x
-
path
.
p
[
i
].
x
)
*
(
path
.
p
[
i
-
1
].
x
-
path
.
p
[
i
].
x
)
+
float
d
=
(
float
)(
SDL_
sqrt
((
path
.
p
[
i
-
1
].
x
-
path
.
p
[
i
].
x
)
*
(
path
.
p
[
i
-
1
].
x
-
path
.
p
[
i
].
x
)
+
(
path
.
p
[
i
-
1
].
y
-
path
.
p
[
i
].
y
)
*
(
path
.
p
[
i
-
1
].
y
-
path
.
p
[
i
].
y
)));
(
path
.
p
[
i
-
1
].
y
-
path
.
p
[
i
].
y
)
*
(
path
.
p
[
i
-
1
].
y
-
path
.
p
[
i
].
y
)));
//printf("d = %f dist = %f/%f\n",d,dist,interval);
//printf("d = %f dist = %f/%f\n",d,dist,interval);
while
(
dist
+
d
>
interval
)
{
while
(
dist
+
d
>
interval
)
{
...
@@ -339,7 +340,7 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
...
@@ -339,7 +340,7 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
dist
+=
d
;
dist
+=
d
;
}
}
if
(
numPoints
<
DOLLARNPOINTS
-
1
)
{
if
(
numPoints
<
DOLLARNPOINTS
-
1
)
{
printf
(
"ERROR: NumPoints = %i
\n
"
,
numPoints
);
SDL_SetError
(
"ERROR: NumPoints = %i
\n
"
,
numPoints
);
return
0
;
return
0
;
}
}
//copy the last point
//copy the last point
...
@@ -356,16 +357,16 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
...
@@ -356,16 +357,16 @@ int dollarNormalize(SDL_DollarPath path,SDL_FloatPoint *points) {
ymin
=
centroid
.
y
;
ymin
=
centroid
.
y
;
ymax
=
centroid
.
y
;
ymax
=
centroid
.
y
;
ang
=
(
float
)(
atan2
(
centroid
.
y
-
points
[
0
].
y
,
ang
=
(
float
)(
SDL_
atan2
(
centroid
.
y
-
points
[
0
].
y
,
centroid
.
x
-
points
[
0
].
x
));
centroid
.
x
-
points
[
0
].
x
));
for
(
i
=
0
;
i
<
numPoints
;
i
++
)
{
for
(
i
=
0
;
i
<
numPoints
;
i
++
)
{
float
px
=
points
[
i
].
x
;
float
px
=
points
[
i
].
x
;
float
py
=
points
[
i
].
y
;
float
py
=
points
[
i
].
y
;
points
[
i
].
x
=
(
float
)((
px
-
centroid
.
x
)
*
cos
(
ang
)
-
points
[
i
].
x
=
(
float
)((
px
-
centroid
.
x
)
*
SDL_
cos
(
ang
)
-
(
py
-
centroid
.
y
)
*
sin
(
ang
)
+
centroid
.
x
);
(
py
-
centroid
.
y
)
*
SDL_
sin
(
ang
)
+
centroid
.
x
);
points
[
i
].
y
=
(
float
)((
px
-
centroid
.
x
)
*
sin
(
ang
)
+
points
[
i
].
y
=
(
float
)((
px
-
centroid
.
x
)
*
SDL_
sin
(
ang
)
+
(
py
-
centroid
.
y
)
*
cos
(
ang
)
+
centroid
.
y
);
(
py
-
centroid
.
y
)
*
SDL_
cos
(
ang
)
+
centroid
.
y
);
if
(
points
[
i
].
x
<
xmin
)
xmin
=
points
[
i
].
x
;
if
(
points
[
i
].
x
<
xmin
)
xmin
=
points
[
i
].
x
;
...
@@ -389,10 +390,10 @@ float dollarRecognize(SDL_DollarPath path,int *bestTempl,SDL_GestureTouch* touch
...
@@ -389,10 +390,10 @@ float dollarRecognize(SDL_DollarPath path,int *bestTempl,SDL_GestureTouch* touch
SDL_FloatPoint
points
[
DOLLARNPOINTS
];
SDL_FloatPoint
points
[
DOLLARNPOINTS
];
int
numPoints
=
dollarNormalize
(
path
,
points
);
int
numPoints
=
dollarNormalize
(
path
,
points
);
//SDL_PrintPath(points);
int
i
;
int
i
;
float
bestDiff
=
10000
;
float
bestDiff
=
10000
;
//PrintPath(points);
*
bestTempl
=
-
1
;
*
bestTempl
=
-
1
;
for
(
i
=
0
;
i
<
touch
->
numDollarTemplates
;
i
++
)
{
for
(
i
=
0
;
i
<
touch
->
numDollarTemplates
;
i
++
)
{
float
diff
=
bestDollarDifference
(
points
,
touch
->
dollarTemplate
[
i
].
path
);
float
diff
=
bestDollarDifference
(
points
,
touch
->
dollarTemplate
[
i
].
path
);
...
@@ -430,10 +431,10 @@ int SDL_GestureAddTouch(SDL_Touch* touch) {
...
@@ -430,10 +431,10 @@ int SDL_GestureAddTouch(SDL_Touch* touch) {
int
SDL_GestureRemoveTouch
(
SDL_TouchID
id
)
{
int
SDL_GestureRemoveTouch
(
SDL_TouchID
id
)
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
SDL_numGestureTouches
;
i
++
)
{
for
(
i
=
0
;
i
<
SDL_numGestureTouches
;
i
++
)
{
if
(
SDL_gestureTouch
[
i
].
id
==
id
)
{
if
(
SDL_gestureTouch
[
i
].
id
==
id
)
{
SDL_numGestureTouches
--
;
SDL_numGestureTouches
--
;
SDL_
gestureTouch
[
i
]
=
SDL_gestureTouch
[
SDL_numGestureTouches
]
;
SDL_
memcpy
(
&
SDL_gestureTouch
[
i
],
&
SDL_gestureTouch
[
SDL_numGestureTouches
],
sizeof
(
SDL_gestureTouch
[
i
]))
;
return
1
;
return
1
;
}
}
}
}
...
@@ -528,7 +529,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
...
@@ -528,7 +529,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
if
(
inTouch
->
recording
)
{
if
(
inTouch
->
recording
)
{
inTouch
->
recording
=
SDL_FALSE
;
inTouch
->
recording
=
SDL_FALSE
;
dollarNormalize
(
inTouch
->
dollarPath
,
path
);
dollarNormalize
(
inTouch
->
dollarPath
,
path
);
//
SDL_
PrintPath(path);
//PrintPath(path);
if
(
recordAll
)
{
if
(
recordAll
)
{
index
=
SDL_AddDollarGesture
(
NULL
,
path
);
index
=
SDL_AddDollarGesture
(
NULL
,
path
);
for
(
i
=
0
;
i
<
SDL_numGestureTouches
;
i
++
)
for
(
i
=
0
;
i
<
SDL_numGestureTouches
;
i
++
)
...
@@ -579,7 +580,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
...
@@ -579,7 +580,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
(
path
->
p
[
path
->
numPoints
].
x
-
path
->
p
[
path
->
numPoints
-
1
].
x
);
(
path
->
p
[
path
->
numPoints
].
x
-
path
->
p
[
path
->
numPoints
-
1
].
x
);
pathDy
=
pathDy
=
(
path
->
p
[
path
->
numPoints
].
y
-
path
->
p
[
path
->
numPoints
-
1
].
y
);
(
path
->
p
[
path
->
numPoints
].
y
-
path
->
p
[
path
->
numPoints
-
1
].
y
);
path
->
length
+=
(
float
)
sqrt
(
pathDx
*
pathDx
+
pathDy
*
pathDy
);
path
->
length
+=
(
float
)
SDL_
sqrt
(
pathDx
*
pathDx
+
pathDy
*
pathDy
);
path
->
numPoints
++
;
path
->
numPoints
++
;
}
}
#endif
#endif
...
@@ -596,20 +597,20 @@ void SDL_GestureProcessEvent(SDL_Event* event)
...
@@ -596,20 +597,20 @@ void SDL_GestureProcessEvent(SDL_Event* event)
//lv = inTouch->gestureLast[j].cv;
//lv = inTouch->gestureLast[j].cv;
lv
.
x
=
lastP
.
x
-
lastCentroid
.
x
;
lv
.
x
=
lastP
.
x
-
lastCentroid
.
x
;
lv
.
y
=
lastP
.
y
-
lastCentroid
.
y
;
lv
.
y
=
lastP
.
y
-
lastCentroid
.
y
;
lDist
=
(
float
)
sqrt
(
lv
.
x
*
lv
.
x
+
lv
.
y
*
lv
.
y
);
lDist
=
(
float
)
SDL_
sqrt
(
lv
.
x
*
lv
.
x
+
lv
.
y
*
lv
.
y
);
//printf("lDist = %f\n",lDist);
//printf("lDist = %f\n",lDist);
v
.
x
=
x
-
inTouch
->
centroid
.
x
;
v
.
x
=
x
-
inTouch
->
centroid
.
x
;
v
.
y
=
y
-
inTouch
->
centroid
.
y
;
v
.
y
=
y
-
inTouch
->
centroid
.
y
;
//inTouch->gestureLast[j].cv = v;
//inTouch->gestureLast[j].cv = v;
Dist
=
(
float
)
sqrt
(
v
.
x
*
v
.
x
+
v
.
y
*
v
.
y
);
Dist
=
(
float
)
SDL_
sqrt
(
v
.
x
*
v
.
x
+
v
.
y
*
v
.
y
);
// cos(dTheta) = (v . lv)/(|v| * |lv|)
//
SDL_
cos(dTheta) = (v . lv)/(|v| * |lv|)
//Normalize Vectors to simplify angle calculation
//Normalize Vectors to simplify angle calculation
lv
.
x
/=
lDist
;
lv
.
x
/=
lDist
;
lv
.
y
/=
lDist
;
lv
.
y
/=
lDist
;
v
.
x
/=
Dist
;
v
.
x
/=
Dist
;
v
.
y
/=
Dist
;
v
.
y
/=
Dist
;
dtheta
=
(
float
)
atan2
(
lv
.
x
*
v
.
y
-
lv
.
y
*
v
.
x
,
lv
.
x
*
v
.
x
+
lv
.
y
*
v
.
y
);
dtheta
=
(
float
)
SDL_
atan2
(
lv
.
x
*
v
.
y
-
lv
.
y
*
v
.
x
,
lv
.
x
*
v
.
x
+
lv
.
y
*
v
.
y
);
dDist
=
(
Dist
-
lDist
);
dDist
=
(
Dist
-
lDist
);
if
(
lDist
==
0
)
{
dDist
=
0
;
dtheta
=
0
;}
//To avoid impossible values
if
(
lDist
==
0
)
{
dDist
=
0
;
dtheta
=
0
;}
//To avoid impossible values
...
...
src/events/SDL_touch.c
View file @
7411f753
...
@@ -366,7 +366,10 @@ SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down,
...
@@ -366,7 +366,10 @@ SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down,
return
posted
;
return
posted
;
}
}
else
{
else
{
if
(
finger
==
NULL
)
{
printf
(
"Finger not found...
\n
"
);
return
0
;}
if
(
finger
==
NULL
)
{
SDL_SetError
(
"Finger not found."
);
return
0
;
}
posted
=
0
;
posted
=
0
;
if
(
SDL_GetEventState
(
SDL_FINGERUP
)
==
SDL_ENABLE
)
{
if
(
SDL_GetEventState
(
SDL_FINGERUP
)
==
SDL_ENABLE
)
{
SDL_Event
event
;
SDL_Event
event
;
...
@@ -552,12 +555,14 @@ SDL_GetTouchName(SDL_TouchID id)
...
@@ -552,12 +555,14 @@ SDL_GetTouchName(SDL_TouchID id)
}
}
int
SDL_TouchNotFoundError
(
SDL_TouchID
id
)
{
int
SDL_TouchNotFoundError
(
SDL_TouchID
id
)
{
int
i
;
//int i;
printf
(
"ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called
\n
"
,
id
);
SDL_SetError
(
"ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called
\n
"
,
id
);
#if 0
printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch);
for(i=0;i < SDL_num_touch;i++) {
for(i=0;i < SDL_num_touch;i++) {
printf("ERROR: %li\n",SDL_touchPads[i]->id);
printf("ERROR: %li\n",SDL_touchPads[i]->id);
}
}
#endif
return
0
;
return
0
;
}
}
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
src/haptic/nds/SDL_syshaptic.c
View file @
7411f753
...
@@ -52,8 +52,9 @@ NDS_EZF_OpenNorWrite()
...
@@ -52,8 +52,9 @@ NDS_EZF_OpenNorWrite()
GBA_BUS
[
0x0020000
]
=
0x1500
;
GBA_BUS
[
0x0020000
]
=
0x1500
;
GBA_BUS
[
0x0E20000
]
=
0x1500
;
GBA_BUS
[
0x0E20000
]
=
0x1500
;
GBA_BUS
[
0x0FE0000
]
=
0x1500
;
GBA_BUS
[
0x0FE0000
]
=
0x1500
;
}
void
}
void
NDS_EZF_CloseNorWrite
()
NDS_EZF_CloseNorWrite
()
{
{
GBA_BUS
[
0x0FF0000
]
=
0xD200
;
GBA_BUS
[
0x0FF0000
]
=
0xD200
;
...
...
src/stdlib/SDL_stdlib.c
View file @
7411f753
...
@@ -39,6 +39,12 @@ __declspec(selectany) int _fltused = 1;
...
@@ -39,6 +39,12 @@ __declspec(selectany) int _fltused = 1;
#else
#else
void
__declspec
(
naked
)
_chkstk
()
{
}
/* Float to long */
/* Float to long */
void
void
__declspec
(
naked
)
__declspec
(
naked
)
...
...
src/video/win32/SDL_win32events.c
View file @
7411f753
...
@@ -20,11 +20,6 @@
...
@@ -20,11 +20,6 @@
slouken@libsdl.org
slouken@libsdl.org
*/
*/
#if (_WIN32_WINNT < 0x601)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x601
#endif
#include "SDL_config.h"
#include "SDL_config.h"
#include "SDL_win32video.h"
#include "SDL_win32video.h"
...
@@ -35,12 +30,11 @@
...
@@ -35,12 +30,11 @@
#define WMMSG_DEBUG
/*#define WMMSG_DEBUG*/
#ifdef WMMSG_DEBUG
#ifdef WMMSG_DEBUG
#include <stdio.h>
#include <stdio.h>
#include "wmmsg.h"
#include "wmmsg.h"
#endif
#endif
//#include <stdio.h>
/* Masks for processing the windows KEYDOWN and KEYUP messages */
/* Masks for processing the windows KEYDOWN and KEYUP messages */
#define REPEATED_KEYMASK (1<<30)
#define REPEATED_KEYMASK (1<<30)
...
@@ -61,6 +55,12 @@
...
@@ -61,6 +55,12 @@
#ifndef WM_INPUT
#ifndef WM_INPUT
#define WM_INPUT 0x00ff
#define WM_INPUT 0x00ff
#endif
#endif
#ifndef WM_GESTURE
#define WM_GESTURE 0x0119
#endif
#ifndef WM_TOUCH
#define WM_TOUCH 0x0240
#endif
static
WPARAM
static
WPARAM
RemapVKEY
(
WPARAM
wParam
,
LPARAM
lParam
)
RemapVKEY
(
WPARAM
wParam
,
LPARAM
lParam
)
...
@@ -138,8 +138,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -138,8 +138,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
fprintf
(
log
,
" -- 0x%X, 0x%X
\n
"
,
wParam
,
lParam
);
fprintf
(
log
,
" -- 0x%X, 0x%X
\n
"
,
wParam
,
lParam
);
fclose
(
log
);
fclose
(
log
);
}
}
#endif
#endif
if
(
IME_HandleMessage
(
hwnd
,
msg
,
wParam
,
&
lParam
,
data
->
videodata
))
if
(
IME_HandleMessage
(
hwnd
,
msg
,
wParam
,
&
lParam
,
data
->
videodata
))
return
0
;
return
0
;
...
@@ -522,6 +522,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -522,6 +522,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
{
//printf("Got Touch Event!\n");
//printf("Got Touch Event!\n");
#ifdef WMMSG_DEBUG
FILE
*
log
=
fopen
(
"wmmsg.txt"
,
"a"
);
FILE
*
log
=
fopen
(
"wmmsg.txt"
,
"a"
);
fprintf
(
log
,
"Received Touch Message: %p "
,
hwnd
);
fprintf
(
log
,
"Received Touch Message: %p "
,
hwnd
);
if
(
msg
>
MAX_WMMSG
)
{
if
(
msg
>
MAX_WMMSG
)
{
...
@@ -531,6 +532,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -531,6 +532,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
}
fprintf
(
log
,
"WM_TOUCH = %d -- 0x%X, 0x%X
\n
"
,
msg
,
wParam
,
lParam
);
fprintf
(
log
,
"WM_TOUCH = %d -- 0x%X, 0x%X
\n
"
,
msg
,
wParam
,
lParam
);
fclose
(
log
);
fclose
(
log
);
#endif
}
}
break
;
break
;
...
@@ -538,6 +540,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -538,6 +540,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
{
//printf("Got Touch Event!\n");
//printf("Got Touch Event!\n");
#ifdef WMMSG_DEBUG
FILE
*
log
=
fopen
(
"wmmsg.txt"
,
"a"
);
FILE
*
log
=
fopen
(
"wmmsg.txt"
,
"a"
);
fprintf
(
log
,
"Received Gesture Message: %p "
,
hwnd
);
fprintf
(
log
,
"Received Gesture Message: %p "
,
hwnd
);
if
(
msg
>
MAX_WMMSG
)
{
if
(
msg
>
MAX_WMMSG
)
{
...
@@ -547,7 +550,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -547,7 +550,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
}
fprintf
(
log
,
"WM_GESTURE = %d -- 0x%X, 0x%X
\n
"
,
msg
,
wParam
,
lParam
);
fprintf
(
log
,
"WM_GESTURE = %d -- 0x%X, 0x%X
\n
"
,
msg
,
wParam
,
lParam
);
fclose
(
log
);
fclose
(
log
);
#endif
}
}
break
;
break
;
}
}
...
...
src/video/win32/SDL_win32video.h
View file @
7411f753
...
@@ -32,13 +32,7 @@
...
@@ -32,13 +32,7 @@
#define UNICODE
#define UNICODE
#endif
#endif
#undef WINVER
#undef WINVER
//#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
#define WINVER 0x500
/* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
#define WINVER 0x601
/* Need 0x600 (_WIN32_WINNT_WIN7) for WM_Touch */
#if (_WIN32_WINNT < 0x601)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x601
#endif
#include <windows.h>
#include <windows.h>
...
...
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