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
44280ae5
Commit
44280ae5
authored
Jul 07, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-implemented single mouse touches on the iPhone/iPad
parent
52b41472
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
10 deletions
+40
-10
SDL_uikitopengles.m
src/video/uikit/SDL_uikitopengles.m
+4
-1
SDL_uikitview.h
src/video/uikit/SDL_uikitview.h
+1
-1
SDL_uikitview.m
src/video/uikit/SDL_uikitview.m
+35
-8
No files found.
src/video/uikit/SDL_uikitopengles.m
View file @
44280ae5
...
...
@@ -126,6 +126,9 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
return
NULL
;
}
/*
Make
this
window
the
current
mouse
focus
for
touch
input
*/
SDL
_
SetMouseFocus
(
window
)
;
return
view
;
}
...
...
src/video/uikit/SDL_uikitview.h
View file @
44280ae5
src/video/uikit/SDL_uikitview.m
View file @
44280ae5
...
...
@@ -64,7 +64,7 @@
-
(
void
)
touchesBegan
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
NSEnumerator
*
enumerator
=
[
touches
objectEnumerator
];
UITouch
*
touch
=
(
UITouch
*
)[
enumerator
nextObject
];
UITouch
*
touch
=
(
UITouch
*
)[
enumerator
nextObject
];
#if FIXME_MULTITOUCH
/* associate touches with mice, so long as we have slots */
...
...
@@ -101,12 +101,21 @@
/* re-calibrate relative mouse motion */
SDL_GetRelativeMouseState
(
i
,
NULL
,
NULL
);
/* switch back to our old mouse */
SDL_SelectMouse
(
oldMouse
);
/* grab next touch */
touch
=
(
UITouch
*
)[
enumerator
nextObject
];
}
#else
if
(
touch
)
{
CGPoint
locationInView
=
[
touch
locationInView
:
self
];
/* s
witch back to our old mouse
*/
SDL_Se
lectMouse
(
oldMouse
);
/* s
end moved event
*/
SDL_Se
ndMouseMotion
(
NULL
,
0
,
locationInView
.
x
,
locationInView
.
y
);
/* send mouse down event */
SDL_SendMouseButton
(
NULL
,
SDL_PRESSED
,
SDL_BUTTON_LEFT
);
}
#endif
}
...
...
@@ -114,10 +123,10 @@
-
(
void
)
touchesEnded
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
NSEnumerator
*
enumerator
=
[
touches
objectEnumerator
];
UITouch
*
touch
=
nil
;
UITouch
*
touch
=
(
UITouch
*
)[
enumerator
nextObject
]
;
#if FIXME_MULTITOUCH
while
(
touch
=
(
UITouch
*
)[
enumerator
nextObject
]
)
{
while
(
touch
)
{
/* search for the mouse slot associated with this touch */
int
i
,
found
=
NO
;
for
(
i
=
0
;
i
<
MAX_SIMULTANEOUS_TOUCHES
&&
!
found
;
i
++
)
{
...
...
@@ -131,6 +140,14 @@
found
=
YES
;
}
}
/* grab next touch */
touch
=
(
UITouch
*
)[
enumerator
nextObject
];
}
#else
if
(
touch
)
{
/* send mouse up */
SDL_SendMouseButton
(
NULL
,
SDL_RELEASED
,
SDL_BUTTON_LEFT
);
}
#endif
}
...
...
@@ -147,10 +164,10 @@
-
(
void
)
touchesMoved
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
NSEnumerator
*
enumerator
=
[
touches
objectEnumerator
];
UITouch
*
touch
=
nil
;
UITouch
*
touch
=
(
UITouch
*
)[
enumerator
nextObject
]
;
#if FIXME_MULTITOUCH
while
(
touch
=
(
UITouch
*
)[
enumerator
nextObject
]
)
{
while
(
touch
)
{
/* try to find the mouse associated with this touch */
int
i
,
found
=
NO
;
for
(
i
=
0
;
i
<
MAX_SIMULTANEOUS_TOUCHES
&&
!
found
;
i
++
)
{
...
...
@@ -163,6 +180,16 @@
found
=
YES
;
}
}
/* grab next touch */
touch
=
(
UITouch
*
)[
enumerator
nextObject
];
}
#else
if
(
touch
)
{
CGPoint
locationInView
=
[
touch
locationInView
:
self
];
/* send moved event */
SDL_SendMouseMotion
(
NULL
,
0
,
locationInView
.
x
,
locationInView
.
y
);
}
#endif
}
...
...
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