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
36b60b6f
Commit
36b60b6f
authored
Jun 03, 2010
by
jimtla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed windo build errors. Should now be compilable.
parent
2ab139c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
90 deletions
+90
-90
SDL_touch.c
src/events/SDL_touch.c
+89
-89
SDL_touch_c.h
src/events/SDL_touch_c.h
+1
-1
No files found.
src/events/SDL_touch.c
View file @
36b60b6f
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
#include "SDL_events_c.h"
#include "SDL_events_c.h"
#include "../video/SDL_sysvideo.h"
#include "../video/SDL_sysvideo.h"
#include <stdio.h>
static
int
SDL_num_touch
=
0
;
static
int
SDL_num_touch
=
0
;
static
SDL_Touch
**
SDL_touchPads
=
NULL
;
static
SDL_Touch
**
SDL_touchPads
=
NULL
;
...
@@ -99,9 +101,7 @@ int
...
@@ -99,9 +101,7 @@ int
SDL_AddTouch
(
const
SDL_Touch
*
touch
,
char
*
name
)
SDL_AddTouch
(
const
SDL_Touch
*
touch
,
char
*
name
)
{
{
SDL_Touch
**
touchPads
;
SDL_Touch
**
touchPads
;
int
selected_touch
;
int
index
,
length
;
int
index
;
size_t
length
;
if
(
SDL_GetTouchIndexId
(
touch
->
id
)
!=
-
1
)
{
if
(
SDL_GetTouchIndexId
(
touch
->
id
)
!=
-
1
)
{
SDL_SetError
(
"Touch ID already in use"
);
SDL_SetError
(
"Touch ID already in use"
);
...
@@ -252,7 +252,6 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
...
@@ -252,7 +252,6 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
{
{
int
index
;
int
index
;
SDL_Finger
**
fingers
;
SDL_Finger
**
fingers
;
size_t
length
;
//printf("Adding Finger...\n");
//printf("Adding Finger...\n");
if
(
SDL_GetFingerIndexId
(
touch
,
finger
->
id
)
!=
-
1
)
{
if
(
SDL_GetFingerIndexId
(
touch
,
finger
->
id
)
!=
-
1
)
{
SDL_SetError
(
"Finger ID already in use"
);
SDL_SetError
(
"Finger ID already in use"
);
...
@@ -260,15 +259,14 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
...
@@ -260,15 +259,14 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
/* Add the touch to the list of touch */
/* Add the touch to the list of touch */
if
(
touch
->
num_fingers
>=
touch
->
max_fingers
){
if
(
touch
->
num_fingers
>=
touch
->
max_fingers
){
printf
(
"Making room for it!
\n
"
);
//
printf("Making room for it!\n");
fingers
=
(
SDL_Finger
**
)
SDL_realloc
(
touch
->
fingers
,
fingers
=
(
SDL_Finger
**
)
SDL_realloc
(
touch
->
fingers
,
(
touch
->
num_fingers
+
1
)
*
sizeof
(
SDL_Finger
*
));
(
touch
->
num_fingers
+
1
)
*
sizeof
(
SDL_Finger
*
));
touch
->
max_fingers
=
touch
->
num_fingers
+
1
;
touch
->
max_fingers
=
touch
->
num_fingers
+
1
;
if
(
!
fingers
)
{
if
(
!
fingers
)
{
SDL_OutOfMemory
();
SDL_OutOfMemory
();
return
-
1
;
return
-
1
;
}
}
else
{
else
{
touch
->
max_fingers
=
touch
->
num_fingers
+
1
;
touch
->
max_fingers
=
touch
->
num_fingers
+
1
;
touch
->
fingers
=
fingers
;
touch
->
fingers
=
fingers
;
}
}
...
@@ -295,13 +293,14 @@ SDL_DelFinger(SDL_Touch* touch,int fingerid)
...
@@ -295,13 +293,14 @@ SDL_DelFinger(SDL_Touch* touch,int fingerid)
SDL_Finger
*
finger
=
SDL_GetFinger
(
touch
,
fingerid
);
SDL_Finger
*
finger
=
SDL_GetFinger
(
touch
,
fingerid
);
if
(
!
finger
)
{
if
(
!
finger
)
{
return
;
return
-
1
;
}
}
SDL_free
(
finger
);
SDL_free
(
finger
);
touch
->
num_fingers
--
;
touch
->
num_fingers
--
;
touch
->
fingers
[
index
]
=
touch
->
fingers
[
touch
->
num_fingers
];
touch
->
fingers
[
index
]
=
touch
->
fingers
[
touch
->
num_fingers
];
return
0
;
}
}
...
@@ -370,9 +369,10 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
...
@@ -370,9 +369,10 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
return
0
;
return
0
;
}
}
if
(
finger
==
NULL
)
if
(
finger
==
NULL
)
{
SDL_SendFingerDown
(
id
,
fingerid
,
SDL_TRUE
,
x
,
y
,
pressure
);
SDL_SendFingerDown
(
id
,
fingerid
,
SDL_TRUE
,
x
,
y
,
pressure
);
else
{
return
0
;
}
else
{
/* the relative motion is calculated regarding the last position */
/* the relative motion is calculated regarding the last position */
if
(
relative
)
{
if
(
relative
)
{
xrel
=
x
;
xrel
=
x
;
...
@@ -389,9 +389,9 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
...
@@ -389,9 +389,9 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
/* Drop events that don't change state */
/* Drop events that don't change state */
if
(
!
xrel
&&
!
yrel
)
{
if
(
!
xrel
&&
!
yrel
)
{
#if 0
#if 0
printf("Touch event didn't change state - dropped!\n");
printf("Touch event didn't change state - dropped!\n");
#endif
#endif
return
0
;
return
0
;
}
}
...
@@ -483,7 +483,7 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
...
@@ -483,7 +483,7 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
if
(
SDL_GetEventState
(
type
)
==
SDL_ENABLE
)
{
if
(
SDL_GetEventState
(
type
)
==
SDL_ENABLE
)
{
SDL_Event
event
;
SDL_Event
event
;
event
.
type
=
type
;
event
.
type
=
type
;
event
.
tbutton
.
touchId
=
(
Uint8
)
index
;
event
.
tbutton
.
touchId
=
(
Uint8
)
touch
->
id
;
event
.
tbutton
.
state
=
state
;
event
.
tbutton
.
state
=
state
;
event
.
tbutton
.
button
=
button
;
event
.
tbutton
.
button
=
button
;
event
.
tbutton
.
windowID
=
touch
->
focus
?
touch
->
focus
->
id
:
0
;
event
.
tbutton
.
windowID
=
touch
->
focus
?
touch
->
focus
->
id
:
0
;
...
...
src/events/SDL_touch_c.h
View file @
36b60b6f
...
@@ -65,7 +65,7 @@ extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
...
@@ -65,7 +65,7 @@ extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
extern
void
SDL_TouchQuit
(
void
);
extern
void
SDL_TouchQuit
(
void
);
/* Get the index of a touch device */
/* Get the index of a touch device */
extern
int
SDL_GetTouchIndexId
(
int
id
)
extern
int
SDL_GetTouchIndexId
(
int
id
)
;
...
...
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