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
99b869fe
Commit
99b869fe
authored
Jul 08, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated iPhone keyboard code (which builds and runs on the iPad and iPhone simulator now)
Updated iPhone demos (which build and run again)
parent
2c5a878c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
39 deletions
+55
-39
project.pbxproj
Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj
+17
-2
fireworks.c
Xcode-iPhoneOS/Demos/src/fireworks.c
+0
-2
mixer.c
Xcode-iPhoneOS/Demos/src/mixer.c
+2
-3
touch.c
Xcode-iPhoneOS/Demos/src/touch.c
+0
-1
project.pbxproj
Xcode-iPhoneOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj
+18
-7
SDL_config_iphoneos.h
include/SDL_config_iphoneos.h
+2
-5
SDL_keyboard.c
src/events/SDL_keyboard.c
+4
-0
SDL_uikitopengles.m
src/video/uikit/SDL_uikitopengles.m
+3
-0
SDL_uikitview.h
src/video/uikit/SDL_uikitview.h
+0
-2
SDL_uikitview.m
src/video/uikit/SDL_uikitview.m
+9
-17
No files found.
Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj
View file @
99b869fe
...
...
@@ -105,6 +105,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
04AB757011E563D200BE9753
/* PBXContainerItemProxy */
=
{
isa
=
PBXContainerItemProxy
;
containerPortal
=
FD1B48920E313154007AB34E
/* SDLiPhoneOS.xcodeproj */
;
proxyType
=
2
;
remoteGlobalIDString
=
006E982211955059001DE610
/* testsdl.app */
;
remoteInfo
=
testsdl
;
};
FD1B489D0E313154007AB34E
/* PBXContainerItemProxy */
=
{
isa
=
PBXContainerItemProxy
;
containerPortal
=
FD1B48920E313154007AB34E
/* SDLiPhoneOS.xcodeproj */
;
...
...
@@ -318,6 +325,7 @@
isa
=
PBXGroup
;
children
=
(
FD1B489E0E313154007AB34E
/* libSDLiPhoneOS.a */
,
04AB757111E563D200BE9753
/* testsdl.app */
,
);
name
=
Products
;
sourceTree
=
"<group>"
;
...
...
@@ -523,6 +531,13 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
04AB757111E563D200BE9753
/* testsdl.app */
=
{
isa
=
PBXReferenceProxy
;
fileType
=
wrapper.application
;
path
=
testsdl.app
;
remoteRef
=
04AB757011E563D200BE9753
/* PBXContainerItemProxy */
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
FD1B489E0E313154007AB34E
/* libSDLiPhoneOS.a */
=
{
isa
=
PBXReferenceProxy
;
fileType
=
archive.ar
;
...
...
@@ -731,7 +746,7 @@
OTHER_CFLAGS
=
""
;
PREBINDING
=
NO
;
PRELINK_LIBS
=
""
;
SDKROOT
=
iphoneos
2.0
;
SDKROOT
=
iphoneos
3.2
;
};
name
=
Debug
;
};
...
...
@@ -749,7 +764,7 @@
OTHER_CFLAGS
=
""
;
PREBINDING
=
NO
;
PRELINK_LIBS
=
""
;
SDKROOT
=
iphoneos
2.0
;
SDKROOT
=
iphoneos
3.2
;
};
name
=
Release
;
};
...
...
Xcode-iPhoneOS/Demos/src/fireworks.c
View file @
99b869fe
...
...
@@ -430,9 +430,7 @@ main(int argc, char *argv[])
done
=
1
;
}
if
(
event
.
type
==
SDL_MOUSEBUTTONDOWN
)
{
int
which
=
event
.
button
.
which
;
int
x
,
y
;
SDL_SelectMouse
(
which
);
SDL_GetMouseState
(
&
x
,
&
y
);
spawnEmitterParticle
(
x
,
y
);
}
...
...
Xcode-iPhoneOS/Demos/src/mixer.c
View file @
99b869fe
...
...
@@ -124,10 +124,9 @@ handleMouseButtonDown(SDL_Event * event)
int
x
,
y
,
mouseIndex
,
i
,
drumIndex
;
mouseIndex
=
event
->
button
.
which
;
mouseIndex
=
0
;
drumIndex
=
-
1
;
SDL_SelectMouse
(
mouseIndex
);
SDL_GetMouseState
(
&
x
,
&
y
);
/* check if we hit any of the drum buttons */
for
(
i
=
0
;
i
<
NUM_DRUMS
;
i
++
)
{
...
...
@@ -153,7 +152,7 @@ void
handleMouseButtonUp
(
SDL_Event
*
event
)
{
int
i
;
int
mouseIndex
=
event
->
button
.
which
;
int
mouseIndex
=
0
;
/* check if this should cause any of the buttons to become unpressed */
for
(
i
=
0
;
i
<
NUM_DRUMS
;
i
++
)
{
if
(
buttons
[
i
].
touchIndex
==
mouseIndex
)
{
...
...
Xcode-iPhoneOS/Demos/src/touch.c
View file @
99b869fe
...
...
@@ -106,7 +106,6 @@ main(int argc, char *argv[])
done
=
1
;
break
;
case
SDL_MOUSEMOTION
:
SDL_SelectMouse
(
event
.
motion
.
which
);
/* select 'mouse' (touch) that moved */
state
=
SDL_GetMouseState
(
&
x
,
&
y
);
/* get its location */
SDL_GetRelativeMouseState
(
&
dx
,
&
dy
);
/* find how much the mouse moved */
if
(
state
&
SDL_BUTTON_LMASK
)
{
/* is the mouse (touch) down? */
...
...
Xcode-iPhoneOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj
View file @
99b869fe
...
...
@@ -287,6 +287,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
0466EE6F11E565E4000198A4
/* PBXContainerItemProxy */
=
{
isa
=
PBXContainerItemProxy
;
containerPortal
=
FD1B48AC0E3131CA007AB34E
/* SDLiPhoneOS.xcodeproj */
;
proxyType
=
2
;
remoteGlobalIDString
=
006E982211955059001DE610
/* testsdl.app */
;
remoteInfo
=
testsdl
;
};
FD1B48B70E3131CA007AB34E
/* PBXContainerItemProxy */
=
{
isa
=
PBXContainerItemProxy
;
containerPortal
=
FD1B48AC0E3131CA007AB34E
/* SDLiPhoneOS.xcodeproj */
;
...
...
@@ -298,9 +305,7 @@
/* Begin PBXFileReference section */
1D6058910D05DD3D006BFB54
/* testwm2.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
testwm2.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
56ED04F7118A8FCC00A56AA6
/* testpower-Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
"testpower-Info.plist"
;
sourceTree
=
"<group>"
;
};
56ED050D118A8FE400A56AA6
/* testpower.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
testpower.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
56ED050F118A8FE400A56AA6
/* Info copy.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
"Info copy.plist"
;
sourceTree
=
"<group>"
;
};
56ED0510118A904200A56AA6
/* testpower.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
name
=
testpower.c
;
path
=
../../test/testpower.c
;
sourceTree
=
SOURCE_ROOT
;
};
FD1B48AC0E3131CA007AB34E
/* SDLiPhoneOS.xcodeproj */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"wrapper.pb-project"
;
name
=
SDLiPhoneOS.xcodeproj
;
path
=
../SDL/SDLiPhoneOS.xcodeproj
;
sourceTree
=
SOURCE_ROOT
;
};
FDA8A7400E2D0F1600EA573E
/* testalpha.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
name
=
testalpha.c
;
path
=
../../test/testalpha.c
;
sourceTree
=
SOURCE_ROOT
;
};
...
...
@@ -861,14 +866,11 @@
29B97314FDCFA39411CA2CEA
/* CustomTemplate */
=
{
isa
=
PBXGroup
;
children
=
(
56ED0510118A904200A56AA6
/* testpower.c */
,
FD1B48AC0E3131CA007AB34E
/* SDLiPhoneOS.xcodeproj */
,
FDA8AAD60E2D339A00EA573E
/* Resources */
,
FDA8A7C30E2D10FA00EA573E
/* Linked Frameworks */
,
FDA8A73B0E2D0F0400EA573E
/* src */
,
19C28FACFE9D520D11CA2CBB
/* Products */
,
56ED04F7118A8FCC00A56AA6
/* testpower-Info.plist */
,
56ED050F118A8FE400A56AA6
/* Info copy.plist */
,
);
name
=
CustomTemplate
;
sourceTree
=
"<group>"
;
...
...
@@ -877,6 +879,7 @@
isa
=
PBXGroup
;
children
=
(
FD1B48B80E3131CA007AB34E
/* libSDLiPhoneOS.a */
,
0466EE7011E565E4000198A4
/* testsdl.app */
,
);
name
=
Products
;
sourceTree
=
"<group>"
;
...
...
@@ -910,6 +913,7 @@
FDA8A7540E2D0F1600EA573E
/* testoverlay2.c */
,
FDA8A7550E2D0F1600EA573E
/* testpalette.c */
,
FDA8A7560E2D0F1600EA573E
/* testplatform.c */
,
56ED0510118A904200A56AA6
/* testpower.c */
,
FDA8A7570E2D0F1600EA573E
/* testsem.c */
,
FDA8A7580E2D0F1600EA573E
/* testsprite.c */
,
FDA8A7590E2D0F1600EA573E
/* testsprite2.c */
,
...
...
@@ -1502,6 +1506,13 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
0466EE7011E565E4000198A4
/* testsdl.app */
=
{
isa
=
PBXReferenceProxy
;
fileType
=
wrapper.application
;
path
=
testsdl.app
;
remoteRef
=
0466EE6F11E565E4000198A4
/* PBXContainerItemProxy */
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
FD1B48B80E3131CA007AB34E
/* libSDLiPhoneOS.a */
=
{
isa
=
PBXReferenceProxy
;
fileType
=
archive.ar
;
...
...
@@ -2034,7 +2045,7 @@
ONLY_ACTIVE_ARCH
=
YES
;
PREBINDING
=
NO
;
"PROVISIONING_PROFILE[sdk=iphoneos*]"
=
""
;
SDKROOT
=
iphoneos
2.2.1
;
SDKROOT
=
iphoneos
3.2
;
};
name
=
Debug
;
};
...
...
@@ -2049,7 +2060,7 @@
HEADER_SEARCH_PATHS
=
../../include
;
PREBINDING
=
NO
;
"PROVISIONING_PROFILE[sdk=iphoneos*]"
=
""
;
SDKROOT
=
iphoneos
2.2.1
;
SDKROOT
=
iphoneos
3.2
;
};
name
=
Release
;
};
...
...
include/SDL_config_iphoneos.h
View file @
99b869fe
...
...
@@ -145,12 +145,9 @@ typedef unsigned long uintptr_t;
#define SDL_POWER_UIKIT 1
/* enable iPhone keyboard support */
#define SDL_IPHONE_KEYBOARD
0
#define SDL_IPHONE_KEYBOARD
1
/* Enable emulation of multiple mice through multi-touch */
#define SDL_IPHONE_MULTIPLE_MICE 1
/* Set max recognized G-force from acceleromter
/* Set max recognized G-force from accelerometer
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
*/
#define SDL_IPHONE_MAX_GFORCE 5.0
...
...
src/events/SDL_keyboard.c
View file @
99b869fe
...
...
@@ -551,6 +551,10 @@ SDL_UCS4ToUTF8(Uint32 ch, char *dst)
int
SDL_KeyboardInit
(
void
)
{
SDL_Keyboard
*
keyboard
=
&
SDL_keyboard
;
/* Set the default keymap */
SDL_memcpy
(
keyboard
->
keymap
,
SDL_default_keymap
,
sizeof
(
SDL_default_keymap
));
return
(
0
);
}
...
...
src/video/uikit/SDL_uikitopengles.m
View file @
99b869fe
...
...
@@ -26,6 +26,8 @@
#include
"SDL_uikitwindow.h"
#include
"jumphack.h"
#include
"SDL_sysvideo.h"
#include
"../../events/SDL_keyboard_c.h"
#include
"../../events/SDL_mouse_c.h"
#include
"SDL_loadso.h"
#include
<
dlfcn
.
h
>
...
...
@@ -128,6 +130,7 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
/*
Make
this
window
the
current
mouse
focus
for
touch
input
*/
SDL
_
SetMouseFocus
(
window
)
;
SDL
_
SetKeyboardFocus
(
window
)
;
return
view
;
}
...
...
src/video/uikit/SDL_uikitview.h
View file @
99b869fe
...
...
@@ -22,8 +22,6 @@
#import <UIKit/UIKit.h>
#include "SDL_stdinc.h"
#include "SDL_mouse.h"
#include "SDL_mouse_c.h"
#include "SDL_events.h"
#if SDL_IPHONE_MULTIPLE_MICE
...
...
src/video/uikit/SDL_uikitview.m
View file @
99b869fe
...
...
@@ -22,8 +22,10 @@
#import "SDL_uikitview.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_mouse_c.h"
#if SDL_IPHONE_KEYBOARD
#import "SDL_keyboard_c.h"
#import "keyinfotable.h"
#import "SDL_uikitappdelegate.h"
#import "SDL_uikitwindow.h"
...
...
@@ -33,7 +35,6 @@
-
(
void
)
dealloc
{
#if SDL_IPHONE_KEYBOARD
SDL_DelKeyboard
(
0
);
[
textField
release
];
#endif
[
super
dealloc
];
...
...
@@ -225,15 +226,6 @@
keyboardVisible
=
NO
;
/* add the UITextField (hidden) to our view */
[
self
addSubview
:
textField
];
/* create our SDL_Keyboard */
SDL_Keyboard
keyboard
;
SDL_zero
(
keyboard
);
SDL_AddKeyboard
(
&
keyboard
,
0
);
SDLKey
keymap
[
SDL_NUM_SCANCODES
];
SDL_GetDefaultKeymap
(
keymap
);
SDL_SetKeymap
(
0
,
0
,
keymap
,
SDL_NUM_SCANCODES
);
}
/* reveal onscreen virtual keyboard */
...
...
@@ -253,8 +245,8 @@
if
([
string
length
]
==
0
)
{
/* it wants to replace text with nothing, ie a delete */
SDL_SendKeyboardKey
(
0
,
SDL_PRESSED
,
SDL_SCANCODE_DELETE
);
SDL_SendKeyboardKey
(
0
,
SDL_RELEASED
,
SDL_SCANCODE_DELETE
);
SDL_SendKeyboardKey
(
SDL_PRESSED
,
SDL_SCANCODE_DELETE
);
SDL_SendKeyboardKey
(
SDL_RELEASED
,
SDL_SCANCODE_DELETE
);
}
else
{
/* go through all the characters in the string we've been sent
...
...
@@ -280,14 +272,14 @@
if
(
mod
&
KMOD_SHIFT
)
{
/* If character uses shift, press shift down */
SDL_SendKeyboardKey
(
0
,
SDL_PRESSED
,
SDL_SCANCODE_LSHIFT
);
SDL_SendKeyboardKey
(
SDL_PRESSED
,
SDL_SCANCODE_LSHIFT
);
}
/* send a keydown and keyup even for the character */
SDL_SendKeyboardKey
(
0
,
SDL_PRESSED
,
code
);
SDL_SendKeyboardKey
(
0
,
SDL_RELEASED
,
code
);
SDL_SendKeyboardKey
(
SDL_PRESSED
,
code
);
SDL_SendKeyboardKey
(
SDL_RELEASED
,
code
);
if
(
mod
&
KMOD_SHIFT
)
{
/* If character uses shift, press shift back up */
SDL_SendKeyboardKey
(
0
,
SDL_RELEASED
,
SDL_SCANCODE_LSHIFT
);
SDL_SendKeyboardKey
(
SDL_RELEASED
,
SDL_SCANCODE_LSHIFT
);
}
}
}
...
...
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