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
b7caec8a
Commit
b7caec8a
authored
Aug 01, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed various type and print format issues
parent
39ee818f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
18 deletions
+37
-18
SDL_gesture.h
include/SDL_gesture.h
+5
-8
SDL_touch.h
include/SDL_touch.h
+2
-2
SDL_touch.c
src/events/SDL_touch.c
+1
-1
SDL_cocoawindow.m
src/video/cocoa/SDL_cocoawindow.m
+1
-1
gestureSDLTest.c
touchTest/gestureSDLTest.c
+28
-6
No files found.
include/SDL_gesture.h
View file @
b7caec8a
...
...
@@ -44,7 +44,7 @@ extern "C" {
/* *INDENT-ON* */
#endif
typedef
U
int64
SDL_GestureID
;
typedef
S
int64
SDL_GestureID
;
/* Function prototypes */
...
...
@@ -53,7 +53,7 @@ extern "C" {
*
*
*/
extern
DECLSPEC
int
SDLCALL
SDL_RecordGesture
(
SDL_TouchID
touchId
);
extern
DECLSPEC
int
SDLCALL
SDL_RecordGesture
(
SDL_TouchID
touchId
);
/**
...
...
@@ -61,15 +61,14 @@ extern "C" {
*
*
*/
extern
DECLSPEC
int
SDLCALL
SDL_SaveAllDollarTemplates
(
SDL_RWops
*
src
);
extern
DECLSPEC
int
SDLCALL
SDL_SaveAllDollarTemplates
(
SDL_RWops
*
src
);
/**
* \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
*
src
);
/**
...
...
@@ -77,9 +76,7 @@ extern "C" {
*
*
*/
extern
DECLSPEC
int
SDLCALL
SDL_LoadDollarTemplates
(
SDL_TouchID
touchId
,
SDL_RWops
*
src
);
extern
DECLSPEC
int
SDLCALL
SDL_LoadDollarTemplates
(
SDL_TouchID
touchId
,
SDL_RWops
*
src
);
/* Ends C function definitions when using C++ */
...
...
include/SDL_touch.h
View file @
b7caec8a
...
...
@@ -42,8 +42,8 @@ extern "C" {
#endif
typedef
U
int64
SDL_TouchID
;
typedef
U
int64
SDL_FingerID
;
typedef
S
int64
SDL_TouchID
;
typedef
S
int64
SDL_FingerID
;
struct
SDL_Finger
{
...
...
src/events/SDL_touch.c
View file @
b7caec8a
...
...
@@ -393,7 +393,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative,
Uint16
x
=
(
xin
+
touch
->
x_min
)
*
(
touch
->
xres
)
/
(
touch
->
native_xres
);
Uint16
y
=
(
yin
+
touch
->
y_min
)
*
(
touch
->
yres
)
/
(
touch
->
native_yres
);
Uint16
pressure
=
(
yin
+
touch
->
pressure_min
)
*
(
touch
->
pressureres
)
/
(
touch
->
native_pressureres
);
printf
(
"(%f,%f) --> (%i,%i)"
,
xin
,
yin
,
x
,
y
);
printf
(
"(%f,%f) --> (%i,%i)
\n
"
,
xin
,
yin
,
x
,
y
);
if
(
touch
->
flush_motion
)
{
return
0
;
}
...
...
src/video/cocoa/SDL_cocoawindow.m
View file @
b7caec8a
...
...
@@ -315,7 +315,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
if
(
SDL_AddTouch
(
&
touch
,
""
)
<
0
)
{
continue
;
}
printf
(
"Success, added touch: %lin"
,
touchId
);
printf
(
"Success, added touch: %li
\
n
"
,
touchId
);
}
float
x
=
[
touch
normalizedPosition
].
x
;
float
y
=
[
touch
normalizedPosition
].
y
;
...
...
touchTest/gestureSDLTest.c
View file @
b7caec8a
...
...
@@ -4,6 +4,28 @@
#include <SDL_touch.h>
#include <SDL_gesture.h>
/* Make sure we have good macros for printing 32 and 64 bit values */
#ifndef PRIs32
#define PRIs32 "d"
#endif
#ifndef PRIu32
#define PRIu32 "u"
#endif
#ifndef PRIs64
#ifdef __WIN32__
#define PRIs64 "I64"
#else
#define PRIs64 "lld"
#endif
#endif
#ifndef PRIu64
#ifdef __WIN32__
#define PRIu64 "I64u"
#else
#define PRIu64 "llu"
#endif
#endif
#define PI 3.1415926535897
#define PHI ((sqrt(5)-1)/2)
#define WIDTH 640
...
...
@@ -28,7 +50,7 @@ int bstatus;
int
colors
[
7
]
=
{
0xFF
,
0xFF00
,
0xFF0000
,
0xFFFF00
,
0x00FFFF
,
0xFF00FF
,
0xFFFFFF
};
long
index2fingerid
[
MAXFINGERS
];
SDL_FingerID
index2fingerid
[
MAXFINGERS
];
int
fingersDown
;
typedef
struct
{
...
...
@@ -38,7 +60,7 @@ typedef struct {
typedef
struct
{
Point
p
;
float
pressure
;
long
id
;
SDL_FingerID
id
;
}
Finger
;
typedef
struct
{
...
...
@@ -378,7 +400,7 @@ int main(int argc, char* argv[])
break
;
case
SDL_FINGERDOWN
:
printf
(
"Finger: %
li down - x: %f, y: %f
\n
"
,
event
.
tfinger
.
fingerId
,
printf
(
"Finger: %
"
PRIs64
" down - x: %i, y: %i
\n
"
,
event
.
tfinger
.
fingerId
,
event
.
tfinger
.
x
,
event
.
tfinger
.
y
);
for
(
i
=
0
;
i
<
MAXFINGERS
;
i
++
)
...
...
@@ -390,7 +412,7 @@ int main(int argc, char* argv[])
finger
[
i
].
p
.
y
=
event
.
tfinger
.
y
;
break
;
case
SDL_FINGERUP
:
printf
(
"Fi
gner: %li up - x: %f, y: %f
\n
"
,
event
.
tfinger
.
fingerId
,
printf
(
"Fi
nger: %"
PRIs64
" up - x: %i, y: %i
\n
"
,
event
.
tfinger
.
fingerId
,
event
.
tfinger
.
x
,
event
.
tfinger
.
y
);
for
(
i
=
0
;
i
<
MAXFINGERS
;
i
++
)
if
(
index2fingerid
[
i
]
==
event
.
tfinger
.
fingerId
)
{
...
...
@@ -407,12 +429,12 @@ int main(int argc, char* argv[])
knob
.
r
+=
event
.
mgesture
.
dDist
;
break
;
case
SDL_DOLLARGESTURE
:
printf
(
"Gesture %
lu
performed, error: %f
\n
"
,
printf
(
"Gesture %
"
PRIs64
"
performed, error: %f
\n
"
,
event
.
dgesture
.
gestureId
,
event
.
dgesture
.
error
);
break
;
case
SDL_DOLLARRECORD
:
printf
(
"Recorded gesture: %
lu
\n
"
,
event
.
dgesture
.
gestureId
);
printf
(
"Recorded gesture: %
"
PRIs64
"
\n
"
,
event
.
dgesture
.
gestureId
);
break
;
}
}
...
...
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