Renamed documentation files to .txt and converted them to DOS line endings so they would open properly on all systems.
Updated Makefile.in so "make dist" includes everything necessary for release. --HG-- rename : BUGS => BUGS.txt rename : COPYING => COPYING.txt rename : CREDITS => CREDITS.txt rename : INSTALL => INSTALL.txt rename : README.android => README-android.txt rename : README.cmake => README-cmake.txt rename : README.DirectFB => README-directfb.txt rename : README.gesture => README-gesture.txt rename : README.HG => README-hg.txt rename : README.iOS => README-ios.txt rename : README.MacOSX => README-macosx.txt rename : README.pandora => README-pandora.txt rename : README.Platforms => README-platforms.txt rename : README.Porting => README-porting.txt rename : README.psp => README-psp.txt rename : README.touch => README-touch.txt rename : README.WinCE => README-wince.txt rename : README => README.txt rename : TODO => TODO.txt
This commit is contained in:
parent
27d4a625ba
commit
2b824bd331
30 changed files with 1415 additions and 10851 deletions
|
@ -1,57 +0,0 @@
|
||||||
[patterns]
|
|
||||||
.hgeol = native
|
|
||||||
.hgignore = native
|
|
||||||
BUGS = native
|
|
||||||
CREDITS = native
|
|
||||||
INSTALL = native
|
|
||||||
NOTES = native
|
|
||||||
TODO = native
|
|
||||||
WhatsNew = native
|
|
||||||
**COPYING = native
|
|
||||||
**README = native
|
|
||||||
**doxyfile = native
|
|
||||||
**Doxyfile = native
|
|
||||||
**install-sh = LF
|
|
||||||
**mkinstalldirs = LF
|
|
||||||
**Makefile = LF
|
|
||||||
**Makefile.* = LF
|
|
||||||
test/automated/rwops/read = LF
|
|
||||||
**README.* = native
|
|
||||||
**.S = native
|
|
||||||
**.bmp = BIN
|
|
||||||
**.c = native
|
|
||||||
**.cc = native
|
|
||||||
**.cpp = native
|
|
||||||
**.csh = LF
|
|
||||||
**.dat = BIN
|
|
||||||
**.gdbinit = LF
|
|
||||||
build-scripts/config.guess = LF
|
|
||||||
**.h = native
|
|
||||||
**.htm = native
|
|
||||||
**.html = native
|
|
||||||
**.icns = BIN
|
|
||||||
**.in = LF
|
|
||||||
**.java = native
|
|
||||||
**.m = native
|
|
||||||
**.m4 = native
|
|
||||||
**.mk = LF
|
|
||||||
**.nib = BIN
|
|
||||||
**.pch = BIN
|
|
||||||
**.pdf = BIN
|
|
||||||
**.pl = native
|
|
||||||
**.plist = native
|
|
||||||
**.png = BIN
|
|
||||||
.indent.pro = LF
|
|
||||||
**.rc = native
|
|
||||||
**.rtf = BIN
|
|
||||||
**.sh = LF
|
|
||||||
**.sln = native
|
|
||||||
**.txt = native
|
|
||||||
**.vcp = native
|
|
||||||
**.vcproj = native
|
|
||||||
**.vcw = native
|
|
||||||
**.vcxproj = native
|
|
||||||
**.wav = BIN
|
|
||||||
**.xbm = BIN
|
|
||||||
**.xml = native
|
|
||||||
**.zip = BIN
|
|
1
.indent.pro
vendored
1
.indent.pro
vendored
|
@ -1 +0,0 @@
|
||||||
-i4 -nut -nsc -br -ce -cdw -npcs
|
|
|
@ -1,18 +1,17 @@
|
||||||
|
|
||||||
Bugs are now managed in the SDL bug tracker, here:
|
Bugs are now managed in the SDL bug tracker, here:
|
||||||
|
|
||||||
http://bugzilla.libsdl.org/
|
http://bugzilla.libsdl.org/
|
||||||
|
|
||||||
You may report bugs there, and search to see if a given issue has already
|
You may report bugs there, and search to see if a given issue has already
|
||||||
been reported, discussed, and maybe even fixed.
|
been reported, discussed, and maybe even fixed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
You may also find help at the SDL mailing list. Subscription information:
|
You may also find help at the SDL mailing list. Subscription information:
|
||||||
|
|
||||||
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
|
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
|
||||||
|
|
||||||
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
|
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
|
||||||
bugs discussed on the mailing list may be forgotten or missed.
|
bugs discussed on the mailing list may be forgotten or missed.
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
|
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
arising from the use of this software.
|
arising from the use of this software.
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute it
|
including commercial applications, and to alter it and redistribute it
|
||||||
freely, subject to the following restrictions:
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
claim that you wrote the original software. If you use this software
|
claim that you wrote the original software. If you use this software
|
||||||
in a product, an acknowledgment in the product documentation would be
|
in a product, an acknowledgment in the product documentation would be
|
||||||
appreciated but is not required.
|
appreciated but is not required.
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
misrepresented as being the original software.
|
misrepresented as being the original software.
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
70
CREDITS
70
CREDITS
|
@ -1,70 +0,0 @@
|
||||||
|
|
||||||
Simple DirectMedia Layer CREDITS
|
|
||||||
Thanks to everyone who made this possible, including:
|
|
||||||
|
|
||||||
* Cliff Matthews, for giving me a reason to start this project. :)
|
|
||||||
-- Executor rocks! *grin*
|
|
||||||
|
|
||||||
* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
|
|
||||||
Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
|
|
||||||
Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
|
|
||||||
and Phoenix Kokido for financial contributions
|
|
||||||
|
|
||||||
* Edgar "bobbens" Simo for his force feedback API development during the
|
|
||||||
Google Summer of Code 2008
|
|
||||||
|
|
||||||
* Aaron Wishnick for his work on audio resampling and pitch shifting during
|
|
||||||
the Google Summer of Code 2008
|
|
||||||
|
|
||||||
* Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
|
|
||||||
Google Summer of Code 2008
|
|
||||||
|
|
||||||
* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
|
|
||||||
during the Google Summer of Code 2008
|
|
||||||
|
|
||||||
* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
|
|
||||||
Dmytro Bogovych, and Couriersud for helping find SDL 1.3 bugs in the great
|
|
||||||
SDL Bug Hunt of January 2009!
|
|
||||||
|
|
||||||
* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
|
|
||||||
January 2009!
|
|
||||||
|
|
||||||
* Luke Benstead for OpenGL 3.0 support
|
|
||||||
|
|
||||||
* Gaëtan de Menten for writing the PHP and SQL behind the SDL website
|
|
||||||
|
|
||||||
* Tim Jones for the new look of the SDL website
|
|
||||||
|
|
||||||
* Ryan Gordon for helping everybody out and keeping the dream alive. :)
|
|
||||||
|
|
||||||
* Mattias Engdegård, for help with the Solaris port and lots of other help
|
|
||||||
|
|
||||||
* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
|
|
||||||
|
|
||||||
* David Carré, for the Pandora port
|
|
||||||
|
|
||||||
* Couriersud for the DirectFB driver
|
|
||||||
|
|
||||||
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
|
|
||||||
|
|
||||||
* Arne Claus, for the 2004 winning SDL logo,
|
|
||||||
and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann,
|
|
||||||
Daniel Liljeberg, Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella,
|
|
||||||
Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson,
|
|
||||||
S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand,
|
|
||||||
Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller,
|
|
||||||
Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja
|
|
||||||
for other logo entries.
|
|
||||||
|
|
||||||
* Bob Pendleton and David Olofson for being long time contributors to
|
|
||||||
the SDL mailing list.
|
|
||||||
|
|
||||||
* Everybody at Loki Software, Inc. for their great contributions!
|
|
||||||
|
|
||||||
And a big hand to everyone else who gave me appreciation, advice,
|
|
||||||
and suggestions, especially the good folks on the SDL mailing list.
|
|
||||||
|
|
||||||
THANKS! :)
|
|
||||||
|
|
||||||
-- Sam Lantinga <slouken@libsdl.org>
|
|
||||||
|
|
33
CREDITS.txt
Normal file
33
CREDITS.txt
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
Simple DirectMedia Layer CREDITS
|
||||||
|
Thanks to everyone who made this possible, including:
|
||||||
|
|
||||||
|
* Cliff Matthews, for giving me a reason to start this project. :)
|
||||||
|
-- Executor rocks! *grin*
|
||||||
|
|
||||||
|
* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
|
||||||
|
Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
|
||||||
|
Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
|
||||||
|
and Phoenix Kokido for financial contributions
|
||||||
|
|
||||||
|
* Edgar "bobbens" Simo for his force feedback API development during the
|
||||||
|
Google Summer of Code 2008
|
||||||
|
|
||||||
|
* Aaron Wishnick for his work on audio resampling and pitch shifting during
|
||||||
|
the Google Summer of Code 2008
|
||||||
|
|
||||||
|
* Holmes Futrell for port of SDL to the iPhone and iPod Touch during the
|
||||||
|
Google Summer of Code 2008
|
||||||
|
|
||||||
|
* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
|
||||||
|
during the Google Summer of Code 2008
|
||||||
|
|
||||||
|
* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
|
||||||
|
Dmytro Bogovych, and Couriersud for helping find SDL 1.3 bugs in the great
|
||||||
|
SDL Bug Hunt of January 2009!
|
||||||
|
|
||||||
|
* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
|
||||||
|
January 2009!
|
||||||
|
|
||||||
|
* Luke Benstead for OpenGL 3.0 support
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
|
|
||||||
To compile and install SDL:
|
To compile and install SDL:
|
||||||
|
|
||||||
0. If you have downloaded this from the website, skip to the next step.
|
0. If you have downloaded this from the website, skip to the next step.
|
||||||
If you have checked this out from subversion, you'll need to run
|
If you have checked this out from subversion, you'll need to run
|
||||||
./autogen.sh to build the configure script.
|
./autogen.sh to build the configure script.
|
||||||
|
|
||||||
1. Run './configure; make; make install'
|
1. Run './configure; make; make install'
|
||||||
|
|
||||||
If you are compiling for Windows using gcc, read the FAQ at:
|
If you are compiling for Windows using gcc, read the FAQ at:
|
||||||
http://www.libsdl.org/faq.php?action=listentries&category=4#42
|
http://www.libsdl.org/faq.php?action=listentries&category=4#42
|
||||||
|
|
||||||
If you are compiling using Visual C++ on Win32, you should read
|
If you are compiling using Visual C++ on Win32, you should read
|
||||||
the file VisualC.html
|
the file VisualC.html
|
||||||
|
|
||||||
2. Look at the example programs in ./test, and check out the online
|
2. Look at the example programs in ./test, and check out the online
|
||||||
documentation at http://wiki.libsdl.org/
|
documentation at http://wiki.libsdl.org/
|
||||||
|
|
||||||
3. Join the SDL developer mailing list by sending E-mail to
|
3. Join the SDL developer mailing list by sending E-mail to
|
||||||
sdl-request@libsdl.org
|
sdl-request@libsdl.org
|
||||||
and put "subscribe" in the subject of the message.
|
and put "subscribe" in the subject of the message.
|
||||||
|
|
||||||
Or alternatively you can use the web interface:
|
Or alternatively you can use the web interface:
|
||||||
http://www.libsdl.org/mailing-list.php
|
http://www.libsdl.org/mailing-list.php
|
||||||
|
|
||||||
That's it!
|
That's it!
|
||||||
Sam Lantinga <slouken@libsdl.org>
|
Sam Lantinga <slouken@libsdl.org>
|
27
Makefile.in
27
Makefile.in
|
@ -39,7 +39,7 @@ SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
|
||||||
SDLTEST_TARGET = libSDL2_test.a
|
SDLTEST_TARGET = libSDL2_test.a
|
||||||
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
|
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
|
||||||
|
|
||||||
SRC_DIST = acinclude Android.mk autogen.sh BUGS build-scripts configure configure.in COPYING CREDITS debian include INSTALL Makefile.minimal Makefile.in README* sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test TODO VisualC.html VisualC WhatsNew Xcode Xcode-iOS
|
SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake configure configure.in debian include Makefile.* sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC WhatsNew Xcode Xcode-iOS
|
||||||
GEN_DIST = SDL2.spec
|
GEN_DIST = SDL2.spec
|
||||||
|
|
||||||
HDRS = \
|
HDRS = \
|
||||||
|
@ -47,7 +47,7 @@ HDRS = \
|
||||||
SDL_assert.h \
|
SDL_assert.h \
|
||||||
SDL_atomic.h \
|
SDL_atomic.h \
|
||||||
SDL_audio.h \
|
SDL_audio.h \
|
||||||
SDL_bits.h \
|
SDL_bits.h \
|
||||||
SDL_blendmode.h \
|
SDL_blendmode.h \
|
||||||
SDL_clipboard.h \
|
SDL_clipboard.h \
|
||||||
SDL_cpuinfo.h \
|
SDL_cpuinfo.h \
|
||||||
|
@ -216,26 +216,3 @@ dist $(distfile):
|
||||||
|
|
||||||
rpm: $(distfile)
|
rpm: $(distfile)
|
||||||
rpmbuild -ta $?
|
rpmbuild -ta $?
|
||||||
|
|
||||||
# Run indent on the source to standardize coding style
|
|
||||||
indent:
|
|
||||||
@echo "Running indent... modified files:"
|
|
||||||
@cd $(srcdir) && \
|
|
||||||
find . \( \
|
|
||||||
-name '*.h' -o \
|
|
||||||
-name '*.c' -o \
|
|
||||||
-name '*.cc' \) \
|
|
||||||
-print | fgrep -v ./Xcode | \
|
|
||||||
while read file; do \
|
|
||||||
indent "$$file" -o "$$file.indent"; \
|
|
||||||
if cmp "$$file" "$$file.indent" >/dev/null; then \
|
|
||||||
rm -f "$$file.indent"; \
|
|
||||||
else \
|
|
||||||
echo "$$file"; \
|
|
||||||
mv -f "$$file.indent" "$$file"; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# Run indent and then commit modified files
|
|
||||||
commit: indent
|
|
||||||
hg commit
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
Please distribute this file with the SDL runtime environment:
|
Please distribute this file with the SDL runtime environment:
|
||||||
|
|
||||||
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
||||||
designed to make it easy to write multi-media software, such as games and
|
designed to make it easy to write multi-media software, such as games and
|
||||||
emulators.
|
emulators.
|
||||||
|
|
||||||
The Simple DirectMedia Layer library source code is available from:
|
The Simple DirectMedia Layer library source code is available from:
|
||||||
http://www.libsdl.org/
|
http://www.libsdl.org/
|
||||||
|
|
||||||
This library is distributed under the terms of the zlib license:
|
This library is distributed under the terms of the zlib license:
|
||||||
http://www.zlib.net/zlib_license.html
|
http://www.zlib.net/zlib_license.html
|
||||||
|
|
||||||
|
|
|
@ -1,384 +1,384 @@
|
||||||
================================================================================
|
================================================================================
|
||||||
Simple DirectMedia Layer for Android
|
Simple DirectMedia Layer for Android
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
Android SDK (version 10 or later)
|
Android SDK (version 10 or later)
|
||||||
http://developer.android.com/sdk/index.html
|
http://developer.android.com/sdk/index.html
|
||||||
|
|
||||||
Android NDK r7 or later
|
Android NDK r7 or later
|
||||||
http://developer.android.com/sdk/ndk/index.html
|
http://developer.android.com/sdk/ndk/index.html
|
||||||
|
|
||||||
Minimum API level supported by SDL: 10 (Android 2.3.3)
|
inimum API level supported by SDL: 10 (Android 2.3.3)
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
How the port works
|
How the port works
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
- Android applications are Java-based, optionally with parts written in C
|
- Android applications are Java-based, optionally with parts written in C
|
||||||
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
|
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
|
||||||
the SDL library
|
the SDL library
|
||||||
- This means that your application C code must be placed inside an Android
|
- This means that your application C code must be placed inside an Android
|
||||||
Java project, along with some C support code that communicates with Java
|
Java project, along with some C support code that communicates with Java
|
||||||
- This eventually produces a standard Android .apk package
|
- This eventually produces a standard Android .apk package
|
||||||
|
|
||||||
The Android Java code implements an "Activity" and can be found in:
|
The Android Java code implements an "Activity" and can be found in:
|
||||||
android-project/src/org/libsdl/app/SDLActivity.java
|
android-project/src/org/libsdl/app/SDLActivity.java
|
||||||
|
|
||||||
The Java code loads your game code, the SDL shared library, and
|
The Java code loads your game code, the SDL shared library, and
|
||||||
dispatches to native functions implemented in the SDL library:
|
dispatches to native functions implemented in the SDL library:
|
||||||
src/SDL_android.cpp
|
src/SDL_android.cpp
|
||||||
|
|
||||||
Your project must include some glue code that starts your main() routine:
|
Your project must include some glue code that starts your main() routine:
|
||||||
src/main/android/SDL_android_main.cpp
|
src/main/android/SDL_android_main.cpp
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Building an app
|
Building an app
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
1. Copy the android-project directory wherever you want to keep your projects
|
1. Copy the android-project directory wherever you want to keep your projects
|
||||||
and rename it to the name of your project.
|
and rename it to the name of your project.
|
||||||
2. Move or symlink this SDL directory into the <project>/jni directory
|
2. Move or symlink this SDL directory into the <project>/jni directory
|
||||||
3. Edit <project>/jni/src/Android.mk to include your source files
|
3. Edit <project>/jni/src/Android.mk to include your source files
|
||||||
4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
|
4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
|
||||||
|
|
||||||
If you want to use the Eclipse IDE, skip to the Eclipse section below.
|
If you want to use the Eclipse IDE, skip to the Eclipse section below.
|
||||||
|
|
||||||
5. Create <project>/local.properties and use that to point to the Android SDK directory, by writing a line with the following form:
|
5. Create <project>/local.properties and use that to point to the Android SDK directory, by writing a line with the following form:
|
||||||
sdk.dir=PATH_TO_ANDROID_SDK
|
sdk.dir=PATH_TO_ANDROID_SDK
|
||||||
6. Run 'ant debug' in android/project. This compiles the .java and eventually
|
6. Run 'ant debug' in android/project. This compiles the .java and eventually
|
||||||
creates a .apk with the native code embedded
|
creates a .apk with the native code embedded
|
||||||
7. 'ant debug install' will push the apk to the device or emulator (if connected)
|
7. 'ant debug install' will push the apk to the device or emulator (if connected)
|
||||||
|
|
||||||
Here's an explanation of the files in the Android project, so you can customize them:
|
Here's an explanation of the files in the Android project, so you can customize them:
|
||||||
|
|
||||||
android-project/
|
android-project/
|
||||||
AndroidManifest.xml - package manifest. Among others, it contains the class name
|
AndroidManifest.xml - package manifest. Among others, it contains the class name
|
||||||
of the main Activity and the package name of the application.
|
of the main Activity and the package name of the application.
|
||||||
build.properties - empty
|
build.properties - empty
|
||||||
build.xml - build description file, used by ant. The actual application name
|
build.xml - build description file, used by ant. The actual application name
|
||||||
is specified here.
|
is specified here.
|
||||||
default.properties - holds the target ABI for the application, android-10 and up
|
default.properties - holds the target ABI for the application, android-10 and up
|
||||||
project.properties - holds the target ABI for the application, android-10 and up
|
project.properties - holds the target ABI for the application, android-10 and up
|
||||||
local.properties - holds the SDK path, you should change this to the path to your SDK
|
local.properties - holds the SDK path, you should change this to the path to your SDK
|
||||||
jni/ - directory holding native code
|
jni/ - directory holding native code
|
||||||
jni/Android.mk - Android makefile that can call recursively the Android.mk files
|
jni/Android.mk - Android makefile that can call recursively the Android.mk files
|
||||||
in all subdirectories
|
in all subdirectories
|
||||||
jni/SDL/ - (symlink to) directory holding the SDL library files
|
jni/SDL/ - (symlink to) directory holding the SDL library files
|
||||||
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
||||||
jni/src/ - directory holding your C/C++ source
|
jni/src/ - directory holding your C/C++ source
|
||||||
jni/src/Android.mk - Android makefile that you should customize to include your
|
jni/src/Android.mk - Android makefile that you should customize to include your
|
||||||
source code and any library references
|
source code and any library references
|
||||||
res/ - directory holding resources for your application
|
res/ - directory holding resources for your application
|
||||||
res/drawable-* - directories holding icons for different phone hardware. Could be
|
res/drawable-* - directories holding icons for different phone hardware. Could be
|
||||||
one dir called "drawable".
|
one dir called "drawable".
|
||||||
res/layout/main.xml - Usually contains a file main.xml, which declares the screen layout.
|
res/layout/main.xml - Usually contains a file main.xml, which declares the screen layout.
|
||||||
We don't need it because we use the SDL video output.
|
We don't need it because we use the SDL video output.
|
||||||
res/values/strings.xml - strings used in your application, including the application name
|
res/values/strings.xml - strings used in your application, including the application name
|
||||||
shown on the phone.
|
shown on the phone.
|
||||||
src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding
|
src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding
|
||||||
to SDL. Be very careful changing this, as the SDL library relies
|
to SDL. Be very careful changing this, as the SDL library relies
|
||||||
on this implementation.
|
on this implementation.
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Customizing your application name
|
Customizing your application name
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
To customize your application name, edit AndroidManifest.xml and replace
|
To customize your application name, edit AndroidManifest.xml and replace
|
||||||
"org.libsdl.app" with an identifier for your product package.
|
"org.libsdl.app" with an identifier for your product package.
|
||||||
|
|
||||||
Then create a Java class extending SDLActivity and place it in a directory
|
Then create a Java class extending SDLActivity and place it in a directory
|
||||||
under src matching your package, e.g.
|
under src matching your package, e.g.
|
||||||
src/com/gamemaker/game/MyGame.java
|
src/com/gamemaker/game/MyGame.java
|
||||||
|
|
||||||
Here's an example of a minimal class file:
|
Here's an example of a minimal class file:
|
||||||
--- MyGame.java --------------------------
|
--- MyGame.java --------------------------
|
||||||
package com.gamemaker.game;
|
package com.gamemaker.game;
|
||||||
|
|
||||||
import org.libsdl.app.SDLActivity;
|
import org.libsdl.app.SDLActivity;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A sample wrapper class that just calls SDLActivity
|
* A sample wrapper class that just calls SDLActivity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MyGame extends SDLActivity { }
|
public class MyGame extends SDLActivity { }
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
|
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
|
||||||
class, .e.g. "MyGame"
|
class, .e.g. "MyGame"
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Customizing your application icon
|
Customizing your application icon
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Conceptually changing your icon is just replacing the "ic_launcher.png" files in
|
Conceptually changing your icon is just replacing the "ic_launcher.png" files in
|
||||||
the drawable directories under the res directory. There are four directories for
|
the drawable directories under the res directory. There are four directories for
|
||||||
different screen sizes. These can be replaced with one dir called "drawable",
|
different screen sizes. These can be replaced with one dir called "drawable",
|
||||||
containing an icon file "ic_launcher.png" with dimensions 48x48 or 72x72.
|
containing an icon file "ic_launcher.png" with dimensions 48x48 or 72x72.
|
||||||
|
|
||||||
You may need to change the name of your icon in AndroidManifest.xml to match
|
You may need to change the name of your icon in AndroidManifest.xml to match
|
||||||
this icon filename.
|
this icon filename.
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Loading assets
|
Loading assets
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Any files you put in the "assets" directory of your android-project directory
|
Any files you put in the "assets" directory of your android-project directory
|
||||||
will get bundled into the application package and you can load them using the
|
will get bundled into the application package and you can load them using the
|
||||||
standard functions in SDL_rwops.h.
|
standard functions in SDL_rwops.h.
|
||||||
|
|
||||||
There are also a few Android specific functions that allow you to get other
|
There are also a few Android specific functions that allow you to get other
|
||||||
useful paths for saving and loading data:
|
useful paths for saving and loading data:
|
||||||
SDL_AndroidGetInternalStoragePath()
|
SDL_AndroidGetInternalStoragePath()
|
||||||
SDL_AndroidGetExternalStorageState()
|
SDL_AndroidGetExternalStorageState()
|
||||||
SDL_AndroidGetExternalStoragePath()
|
SDL_AndroidGetExternalStoragePath()
|
||||||
|
|
||||||
See SDL_system.h for more details on these functions.
|
See SDL_system.h for more details on these functions.
|
||||||
|
|
||||||
The asset packaging system will, by default, compress certain file extensions.
|
The asset packaging system will, by default, compress certain file extensions.
|
||||||
SDL includes two asset file access mechanisms, the preferred one is the so
|
SDL includes two asset file access mechanisms, the preferred one is the so
|
||||||
called "File Descriptor" method, which is faster and doesn't involve the Dalvik
|
called "File Descriptor" method, which is faster and doesn't involve the Dalvik
|
||||||
GC, but given this method does not work on compressed assets, there is also the
|
GC, but given this method does not work on compressed assets, there is also the
|
||||||
"Input Stream" method, which is automatically used as a fall back by SDL. You
|
"Input Stream" method, which is automatically used as a fall back by SDL. You
|
||||||
may want to keep this fact in mind when building your APK, specially when large
|
may want to keep this fact in mind when building your APK, specially when large
|
||||||
files are involved.
|
files are involved.
|
||||||
For more information on which extensions get compressed by default and how to
|
For more information on which extensions get compressed by default and how to
|
||||||
disable this behaviour, see for example:
|
disable this behaviour, see for example:
|
||||||
|
|
||||||
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
|
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Pause / Resume behaviour
|
Pause / Resume behaviour
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
If SDL is compiled with SDL_ANDROID_BLOCK_ON_PAUSE defined (the default),
|
If SDL is compiled with SDL_ANDROID_BLOCK_ON_PAUSE defined (the default),
|
||||||
the event loop will block itself when the app is paused (ie, when the user
|
the event loop will block itself when the app is paused (ie, when the user
|
||||||
returns to the main Android dashboard). Blocking is better in terms of battery
|
returns to the main Android dashboard). Blocking is better in terms of battery
|
||||||
use, and it allows your app to spring back to life instantaneously after resume
|
use, and it allows your app to spring back to life instantaneously after resume
|
||||||
(versus polling for a resume message).
|
(versus polling for a resume message).
|
||||||
|
|
||||||
Upon resume, SDL will attempt to restore the GL context automatically.
|
Upon resume, SDL will attempt to restore the GL context automatically.
|
||||||
In modern devices (Android 3.0 and up) this will most likely succeed and your
|
In modern devices (Android 3.0 and up) this will most likely succeed and your
|
||||||
app can continue to operate as it was.
|
app can continue to operate as it was.
|
||||||
|
|
||||||
However, there's a chance (on older hardware, or on systems under heavy load),
|
However, there's a chance (on older hardware, or on systems under heavy load),
|
||||||
where the GL context can not be restored. In that case you have to listen for
|
where the GL context can not be restored. In that case you have to listen for
|
||||||
a specific message, (which is not yet implemented!) and restore your textures
|
a specific message, (which is not yet implemented!) and restore your textures
|
||||||
manually or quit the app (which is actually the kind of behaviour you'll see
|
manually or quit the app (which is actually the kind of behaviour you'll see
|
||||||
under iOS, if the OS can not restore your GL context it will just kill your app)
|
under iOS, if the OS can not restore your GL context it will just kill your app)
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Threads and the Java VM
|
Threads and the Java VM
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
For a quick tour on how Linux native threads interoperate with the Java VM, take
|
For a quick tour on how Linux native threads interoperate with the Java VM, take
|
||||||
a look here: http://developer.android.com/guide/practices/jni.html
|
a look here: http://developer.android.com/guide/practices/jni.html
|
||||||
If you want to use threads in your SDL app, it's strongly recommended that you
|
If you want to use threads in your SDL app, it's strongly recommended that you
|
||||||
do so by creating them using SDL functions. This way, the required attach/detach
|
do so by creating them using SDL functions. This way, the required attach/detach
|
||||||
handling is managed by SDL automagically. If you have threads created by other
|
handling is managed by SDL automagically. If you have threads created by other
|
||||||
means and they make calls to SDL functions, make sure that you call
|
means and they make calls to SDL functions, make sure that you call
|
||||||
Android_JNI_SetupThread before doing anything else otherwise SDL will attach
|
Android_JNI_SetupThread before doing anything else otherwise SDL will attach
|
||||||
your thread automatically anyway (when you make an SDL call), but it'll never
|
your thread automatically anyway (when you make an SDL call), but it'll never
|
||||||
detach it.
|
detach it.
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Using STL
|
Using STL
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
You can use STL in your project by creating an Application.mk file in the jni
|
You can use STL in your project by creating an Application.mk file in the jni
|
||||||
folder and adding the following line:
|
folder and adding the following line:
|
||||||
APP_STL := stlport_static
|
APP_STL := stlport_static
|
||||||
|
|
||||||
For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
|
For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Additional documentation
|
Additional documentation
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
The documentation in the NDK docs directory is very helpful in understanding the
|
The documentation in the NDK docs directory is very helpful in understanding the
|
||||||
build process and how to work with native code on the Android platform.
|
build process and how to work with native code on the Android platform.
|
||||||
|
|
||||||
The best place to start is with docs/OVERVIEW.TXT
|
The best place to start is with docs/OVERVIEW.TXT
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Using Eclipse
|
Using Eclipse
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
First make sure that you've installed Eclipse and the Android extensions as described here:
|
First make sure that you've installed Eclipse and the Android extensions as described here:
|
||||||
http://developer.android.com/sdk/eclipse-adt.html
|
http://developer.android.com/sdk/eclipse-adt.html
|
||||||
|
|
||||||
Once you've copied the SDL android project and customized it, you can create an Eclipse project from it:
|
Once you've copied the SDL android project and customized it, you can create an Eclipse project from it:
|
||||||
* File -> New -> Other
|
* File -> New -> Other
|
||||||
* Select the Android -> Android Project wizard and click Next
|
* Select the Android -> Android Project wizard and click Next
|
||||||
* Enter the name you'd like your project to have
|
* Enter the name you'd like your project to have
|
||||||
* Select "Create project from existing source" and browse for your project directory
|
* Select "Create project from existing source" and browse for your project directory
|
||||||
* Make sure the Build Target is set to Android 2.0
|
* Make sure the Build Target is set to Android 2.0
|
||||||
* Click Finish
|
* Click Finish
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Using the emulator
|
Using the emulator
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
There are some good tips and tricks for getting the most out of the
|
There are some good tips and tricks for getting the most out of the
|
||||||
emulator here: http://developer.android.com/tools/devices/emulator.html
|
emulator here: http://developer.android.com/tools/devices/emulator.html
|
||||||
|
|
||||||
Especially useful is the info on setting up OpenGL ES 2.0 emulation.
|
Especially useful is the info on setting up OpenGL ES 2.0 emulation.
|
||||||
|
|
||||||
Notice that this software emulator is incredibly slow and needs a lot of disk space.
|
Notice that this software emulator is incredibly slow and needs a lot of disk space.
|
||||||
Using a real device works better.
|
Using a real device works better.
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
You can create and run an emulator from the Eclipse IDE:
|
You can create and run an emulator from the Eclipse IDE:
|
||||||
* Window -> Android SDK and AVD Manager
|
* Window -> Android SDK and AVD Manager
|
||||||
|
|
||||||
You can see if adb can see any devices with the following command:
|
You can see if adb can see any devices with the following command:
|
||||||
adb devices
|
adb devices
|
||||||
|
|
||||||
You can see the output of log messages on the default device with:
|
You can see the output of log messages on the default device with:
|
||||||
adb logcat
|
adb logcat
|
||||||
|
|
||||||
You can push files to the device with:
|
You can push files to the device with:
|
||||||
adb push local_file remote_path_and_file
|
adb push local_file remote_path_and_file
|
||||||
|
|
||||||
You can push files to the SD Card at /sdcard, for example:
|
You can push files to the SD Card at /sdcard, for example:
|
||||||
adb push moose.dat /sdcard/moose.dat
|
adb push moose.dat /sdcard/moose.dat
|
||||||
|
|
||||||
You can see the files on the SD card with a shell command:
|
You can see the files on the SD card with a shell command:
|
||||||
adb shell ls /sdcard/
|
adb shell ls /sdcard/
|
||||||
|
|
||||||
You can start a command shell on the default device with:
|
You can start a command shell on the default device with:
|
||||||
adb shell
|
adb shell
|
||||||
|
|
||||||
You can remove the library files of your project (and not the SDL lib files) with:
|
You can remove the library files of your project (and not the SDL lib files) with:
|
||||||
ndk-build clean
|
ndk-build clean
|
||||||
|
|
||||||
You can do a build with the following command:
|
You can do a build with the following command:
|
||||||
ndk-build
|
ndk-build
|
||||||
|
|
||||||
You can see the complete command line that ndk-build is using by passing V=1 on the command line:
|
You can see the complete command line that ndk-build is using by passing V=1 on the command line:
|
||||||
ndk-build V=1
|
ndk-build V=1
|
||||||
|
|
||||||
If your application crashes in native code, you can use addr2line to convert the
|
If your application crashes in native code, you can use addr2line to convert the
|
||||||
addresses in the stack trace to lines in your code.
|
addresses in the stack trace to lines in your code.
|
||||||
|
|
||||||
For example, if your crash looks like this:
|
For example, if your crash looks like this:
|
||||||
I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
|
I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
|
||||||
I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
|
I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
|
||||||
I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
|
I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
|
||||||
I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
|
I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
|
||||||
I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
|
I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
|
||||||
I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
|
I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
|
||||||
I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
|
I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
|
||||||
I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
|
I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
|
||||||
I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
|
I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
|
||||||
|
|
||||||
You can see that there's a crash in the C library being called from the main code.
|
You can see that there's a crash in the C library being called from the main code.
|
||||||
I run addr2line with the debug version of my code:
|
I run addr2line with the debug version of my code:
|
||||||
arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
|
arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
|
||||||
and then paste in the number after "pc" in the call stack, from the line that I care about:
|
and then paste in the number after "pc" in the call stack, from the line that I care about:
|
||||||
000014bc
|
000014bc
|
||||||
|
|
||||||
I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
|
I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
|
||||||
|
|
||||||
You can add logging to your code to help show what's happening:
|
You can add logging to your code to help show what's happening:
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
|
__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
|
||||||
|
|
||||||
If you need to build without optimization turned on, you can create a file called
|
If you need to build without optimization turned on, you can create a file called
|
||||||
"Application.mk" in the jni directory, with the following line in it:
|
"Application.mk" in the jni directory, with the following line in it:
|
||||||
APP_OPTIM := debug
|
APP_OPTIM := debug
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Memory debugging
|
Memory debugging
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
The best (and slowest) way to debug memory issues on Android is valgrind.
|
The best (and slowest) way to debug memory issues on Android is valgrind.
|
||||||
Valgrind has support for Android out of the box, just grab code using:
|
Valgrind has support for Android out of the box, just grab code using:
|
||||||
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
|
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
|
||||||
... and follow the instructions in the file README.android to build it.
|
... and follow the instructions in the file README.android to build it.
|
||||||
|
|
||||||
One thing I needed to do on Mac OS X was change the path to the toolchain,
|
One thing I needed to do on Mac OS X was change the path to the toolchain,
|
||||||
and add ranlib to the environment variables:
|
and add ranlib to the environment variables:
|
||||||
export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
|
export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
|
||||||
|
|
||||||
Once valgrind is built, you can create a wrapper script to launch your
|
Once valgrind is built, you can create a wrapper script to launch your
|
||||||
application with it, changing org.libsdl.app to your package identifier:
|
application with it, changing org.libsdl.app to your package identifier:
|
||||||
--- start_valgrind_app -------------------
|
--- start_valgrind_app -------------------
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
export TMPDIR=/data/data/org.libsdl.app
|
export TMPDIR=/data/data/org.libsdl.app
|
||||||
exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
|
exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
Then push it to the device:
|
Then push it to the device:
|
||||||
adb push start_valgrind_app /data/local
|
adb push start_valgrind_app /data/local
|
||||||
|
|
||||||
and make it executable:
|
and make it executable:
|
||||||
adb shell chmod 755 /data/local/start_valgrind_app
|
adb shell chmod 755 /data/local/start_valgrind_app
|
||||||
|
|
||||||
and tell Android to use the script to launch your application:
|
and tell Android to use the script to launch your application:
|
||||||
adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
|
adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
|
||||||
|
|
||||||
If the setprop command says "could not set property", it's likely that
|
If the setprop command says "could not set property", it's likely that
|
||||||
your package name is too long and you should make it shorter by changing
|
your package name is too long and you should make it shorter by changing
|
||||||
AndroidManifest.xml and the path to your class file in android-project/src
|
AndroidManifest.xml and the path to your class file in android-project/src
|
||||||
|
|
||||||
You can then launch your application normally and waaaaaaaiiittt for it.
|
You can then launch your application normally and waaaaaaaiiittt for it.
|
||||||
You can monitor the startup process with the logcat command above, and
|
You can monitor the startup process with the logcat command above, and
|
||||||
when it's done (or even while it's running) you can grab the valgrind
|
when it's done (or even while it's running) you can grab the valgrind
|
||||||
output file:
|
output file:
|
||||||
adb pull /sdcard/valgrind.log
|
adb pull /sdcard/valgrind.log
|
||||||
|
|
||||||
When you're done instrumenting with valgrind, you can disable the wrapper:
|
When you're done instrumenting with valgrind, you can disable the wrapper:
|
||||||
adb shell setprop wrap.org.libsdl.app ""
|
adb shell setprop wrap.org.libsdl.app ""
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Why is API level 10 the minimum required?
|
Why is API level 10 the minimum required?
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
API level 10 is required because SDL requires some functionality for running not
|
API level 10 is required because SDL requires some functionality for running not
|
||||||
available on older devices and some for building which is not in older NDK/SDKs.
|
available on older devices and some for building which is not in older NDK/SDKs.
|
||||||
|
|
||||||
Support for native OpenGL ES and ES2 applications was introduced in the NDK for
|
Support for native OpenGL ES and ES2 applications was introduced in the NDK for
|
||||||
API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which
|
API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which
|
||||||
has since then been obsoleted, with the recommendation to developers to bump the
|
has since then been obsoleted, with the recommendation to developers to bump the
|
||||||
required API level to 10.
|
required API level to 10.
|
||||||
As of this writing, according to http://developer.android.com/about/dashboards/index.html
|
As of this writing, according to http://developer.android.com/about/dashboards/index.html
|
||||||
about 90% of the Android devices accessing Google Play support API level 10 or
|
about 90% of the Android devices accessing Google Play support API level 10 or
|
||||||
higher (March 2013).
|
higher (March 2013).
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
A note regarding the use of the "dirty rectangles" rendering technique
|
A note regarding the use of the "dirty rectangles" rendering technique
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
If your app uses a variation of the "dirty rectangles" rendering technique,
|
If your app uses a variation of the "dirty rectangles" rendering technique,
|
||||||
where you only update a portion of the screen on each frame, you may notice a
|
where you only update a portion of the screen on each frame, you may notice a
|
||||||
variety of visual glitches on Android, that are not present on other platforms.
|
variety of visual glitches on Android, that are not present on other platforms.
|
||||||
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
|
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
|
||||||
contexts, in particular the use of the eglSwapBuffers function. As stated in the
|
contexts, in particular the use of the eglSwapBuffers function. As stated in the
|
||||||
documentation for the function "The contents of ancillary buffers are always
|
documentation for the function "The contents of ancillary buffers are always
|
||||||
undefined after calling eglSwapBuffers".
|
undefined after calling eglSwapBuffers".
|
||||||
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
|
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
|
||||||
is not possible for SDL as it requires EGL 1.4, available only on the API level
|
is not possible for SDL as it requires EGL 1.4, available only on the API level
|
||||||
17+, so the only workaround available on this platform is to redraw the entire
|
17+, so the only workaround available on this platform is to redraw the entire
|
||||||
screen each frame.
|
screen each frame.
|
||||||
|
|
||||||
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
|
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Known issues
|
Known issues
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
- TODO. I'm sure there's a bunch more stuff I haven't thought of
|
- TODO. I'm sure there's a bunch more stuff I haven't thought of
|
|
@ -1,31 +1,31 @@
|
||||||
================================================================================
|
================================================================================
|
||||||
CMake build system for SDL (www.cmake.org)
|
CMake build system for SDL (www.cmake.org)
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
SDL's build system was traditionally based on autotools. Over time, this
|
SDL's build system was traditionally based on autotools. Over time, this
|
||||||
approach has suffered from several issues across the different supported
|
approach has suffered from several issues across the different supported
|
||||||
platforms.
|
platforms.
|
||||||
To solve these problems, a new build system based on CMake is under development.
|
To solve these problems, a new build system based on CMake is under development.
|
||||||
It works in parallel to the legacy system, so users can experiment with it
|
It works in parallel to the legacy system, so users can experiment with it
|
||||||
without complication.
|
without complication.
|
||||||
While still experimental, the build system should be usable on the following
|
While still experimental, the build system should be usable on the following
|
||||||
platforms:
|
platforms:
|
||||||
|
|
||||||
* FreeBSD
|
* FreeBSD
|
||||||
* Linux
|
* Linux
|
||||||
* VS.NET 2010
|
* VS.NET 2010
|
||||||
* MinGW and Msys
|
* MinGW and Msys
|
||||||
* OS X with support for XCode
|
* OS X with support for XCode
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Usage
|
Usage
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Assuming the source for SDL is located at ~/sdl
|
Assuming the source for SDL is located at ~/sdl
|
||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ../sdl
|
cmake ../sdl
|
||||||
|
|
||||||
This will build the static and dynamic versions of SDL in the ~/build directory.
|
This will build the static and dynamic versions of SDL in the ~/build directory.
|
|
@ -1,106 +1,106 @@
|
||||||
SDL on DirectFB
|
SDL on DirectFB
|
||||||
|
|
||||||
Supports:
|
Supports:
|
||||||
|
|
||||||
- Hardware YUV overlays
|
- Hardware YUV overlays
|
||||||
- OpenGL - software only
|
- OpenGL - software only
|
||||||
- 2D/3D accelerations (depends on directfb driver)
|
- 2D/3D accelerations (depends on directfb driver)
|
||||||
- multiple displays
|
- multiple displays
|
||||||
- windows
|
- windows
|
||||||
|
|
||||||
What you need:
|
What you need:
|
||||||
|
|
||||||
DirectFB 1.0.1, 1.2.x, 1.3.0
|
DirectFB 1.0.1, 1.2.x, 1.3.0
|
||||||
Kernel-Framebuffer support: required: vesafb, radeonfb ....
|
Kernel-Framebuffer support: required: vesafb, radeonfb ....
|
||||||
Mesa 7.0.x - optional for OpenGL
|
esa 7.0.x - optional for OpenGL
|
||||||
|
|
||||||
/etc/directfbrc
|
/etc/directfbrc
|
||||||
|
|
||||||
This file should contain the following lines to make
|
This file should contain the following lines to make
|
||||||
your joystick work and avoid crashes:
|
your joystick work and avoid crashes:
|
||||||
------------------------
|
------------------------
|
||||||
disable-module=joystick
|
disable-module=joystick
|
||||||
disable-module=cle266
|
disable-module=cle266
|
||||||
disable-module=cyber5k
|
disable-module=cyber5k
|
||||||
no-linux-input-grab
|
no-linux-input-grab
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
To disable to use x11 backend when DISPLAY variable is found use
|
To disable to use x11 backend when DISPLAY variable is found use
|
||||||
|
|
||||||
export SDL_DIRECTFB_X11_CHECK=0
|
export SDL_DIRECTFB_X11_CHECK=0
|
||||||
|
|
||||||
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
|
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
|
||||||
use
|
use
|
||||||
|
|
||||||
export SDL_DIRECTFB_LINUX_INPUT=0
|
export SDL_DIRECTFB_LINUX_INPUT=0
|
||||||
|
|
||||||
To use hardware accelerated YUV-overlays for YUV-textures, use:
|
To use hardware accelerated YUV-overlays for YUV-textures, use:
|
||||||
|
|
||||||
export SDL_DIRECTFB_YUV_DIRECT=1
|
export SDL_DIRECTFB_YUV_DIRECT=1
|
||||||
|
|
||||||
This is disabled by default. It will only support one
|
This is disabled by default. It will only support one
|
||||||
YUV texture, namely the first. Every other YUV texture will be
|
YUV texture, namely the first. Every other YUV texture will be
|
||||||
rendered in software.
|
rendered in software.
|
||||||
|
|
||||||
In addition, you may use (directfb-1.2.x)
|
In addition, you may use (directfb-1.2.x)
|
||||||
|
|
||||||
export SDL_DIRECTFB_YUV_UNDERLAY=1
|
export SDL_DIRECTFB_YUV_UNDERLAY=1
|
||||||
|
|
||||||
to make the YUV texture an underlay. This will make the cursor to
|
to make the YUV texture an underlay. This will make the cursor to
|
||||||
be shown.
|
be shown.
|
||||||
|
|
||||||
Simple Window Manager
|
Simple Window Manager
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
The driver has support for a very, very basic window manager you may
|
The driver has support for a very, very basic window manager you may
|
||||||
want to use when running with "wm=default". Use
|
want to use when running with "wm=default". Use
|
||||||
|
|
||||||
export SDL_DIRECTFB_WM=1
|
export SDL_DIRECTFB_WM=1
|
||||||
|
|
||||||
to enable basic window borders. In order to have the window title rendered,
|
to enable basic window borders. In order to have the window title rendered,
|
||||||
you need to have the following font installed:
|
you need to have the following font installed:
|
||||||
|
|
||||||
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
||||||
|
|
||||||
OpenGL Support
|
OpenGL Support
|
||||||
==============
|
==============
|
||||||
|
|
||||||
The following instructions will give you *software* OpenGL. However this
|
The following instructions will give you *software* OpenGL. However this
|
||||||
works at least on all directfb supported platforms.
|
works at least on all directfb supported platforms.
|
||||||
|
|
||||||
As of this writing 20100802 you need to pull Mesa from git and do the following:
|
As of this writing 20100802 you need to pull Mesa from git and do the following:
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
git clone git://anongit.freedesktop.org/git/mesa/mesa
|
git clone git://anongit.freedesktop.org/git/mesa/mesa
|
||||||
cd mesa
|
cd mesa
|
||||||
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
|
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Edit configs/linux-directfb so that the Directories-section looks like
|
Edit configs/linux-directfb so that the Directories-section looks like
|
||||||
------------------------
|
------------------------
|
||||||
# Directories
|
# Directories
|
||||||
SRC_DIRS = mesa glu
|
SRC_DIRS = mesa glu
|
||||||
GLU_DIRS = sgi
|
GLU_DIRS = sgi
|
||||||
DRIVER_DIRS = directfb
|
DRIVER_DIRS = directfb
|
||||||
PROGRAM_DIRS =
|
PROGRAM_DIRS =
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
make linux-directfb
|
make linux-directfb
|
||||||
make
|
make
|
||||||
|
|
||||||
echo Installing - please enter sudo pw.
|
echo Installing - please enter sudo pw.
|
||||||
|
|
||||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||||
cd src/mesa/drivers/directfb
|
cd src/mesa/drivers/directfb
|
||||||
make
|
make
|
||||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
To run the SDL - testprograms:
|
To run the SDL - testprograms:
|
||||||
|
|
||||||
export SDL_VIDEODRIVER=directfb
|
export SDL_VIDEODRIVER=directfb
|
||||||
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
|
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
|
||||||
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
|
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
|
||||||
|
|
||||||
./testgl
|
./testgl
|
||||||
|
|
|
@ -1,72 +1,72 @@
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Dollar Gestures
|
Dollar Gestures
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL Provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
|
SDL Provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
|
||||||
|
|
||||||
Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
|
Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
|
||||||
|
|
||||||
Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
|
Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
|
||||||
|
|
||||||
Recording:
|
Recording:
|
||||||
----------
|
----------
|
||||||
To begin recording on a touch device call:
|
To begin recording on a touch device call:
|
||||||
SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
|
SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
|
||||||
|
|
||||||
Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
|
Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
|
||||||
A SDL_DOLLARRECORD event is a dgesture with the following fields:
|
A SDL_DOLLARRECORD event is a dgesture with the following fields:
|
||||||
|
|
||||||
event.dgesture.touchId - the Id of the touch used to record the gesture.
|
event.dgesture.touchId - the Id of the touch used to record the gesture.
|
||||||
event.dgesture.gestureId - the unique id of the recorded gesture.
|
event.dgesture.gestureId - the unique id of the recorded gesture.
|
||||||
|
|
||||||
|
|
||||||
Performing:
|
Performing:
|
||||||
-----------
|
-----------
|
||||||
As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
|
As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
|
||||||
|
|
||||||
event.dgesture.touchId - the Id of the touch which performed the gesture.
|
event.dgesture.touchId - the Id of the touch which performed the gesture.
|
||||||
event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
|
event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
|
||||||
event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
|
event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
|
||||||
event.dgesture.numFingers - the number of fingers used to draw the stroke.
|
event.dgesture.numFingers - the number of fingers used to draw the stroke.
|
||||||
|
|
||||||
Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
ost programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Saving:
|
Saving:
|
||||||
-------
|
-------
|
||||||
To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId is the id of the gesture you want to save, and src is an SDL_RWops pointer to the file where the gesture will be stored.
|
To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId is the id of the gesture you want to save, and src is an SDL_RWops pointer to the file where the gesture will be stored.
|
||||||
|
|
||||||
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(src) where source is an SDL_RWops pointer to the file where the gesture will be stored.
|
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(src) where source is an SDL_RWops pointer to the file where the gesture will be stored.
|
||||||
|
|
||||||
Both functions return the number of gestures successfully saved.
|
Both functions return the number of gestures successfully saved.
|
||||||
|
|
||||||
|
|
||||||
Loading:
|
Loading:
|
||||||
--------
|
--------
|
||||||
To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
|
To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
|
||||||
|
|
||||||
SDL_LoadDollarTemplates returns the number of templates successfully loaded.
|
SDL_LoadDollarTemplates returns the number of templates successfully loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Multi Gestures
|
ulti Gestures
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL provides simple support for pinch/rotate/swipe gestures.
|
SDL provides simple support for pinch/rotate/swipe gestures.
|
||||||
Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
|
Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
|
||||||
|
|
||||||
event.mgesture.touchId - the Id of the touch on which the gesture was performed.
|
event.mgesture.touchId - the Id of the touch on which the gesture was performed.
|
||||||
event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
|
event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
|
||||||
event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
|
event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
|
||||||
event.mgesture.dTheta - the amount that the fingers rotated during this motion.
|
event.mgesture.dTheta - the amount that the fingers rotated during this motion.
|
||||||
event.mgesture.dDist - the amount that the fingers pinched during this motion.
|
event.mgesture.dDist - the amount that the fingers pinched during this motion.
|
||||||
event.mgesture.numFingers - the number of fingers used in the gesture.
|
event.mgesture.numFingers - the number of fingers used in the gesture.
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Notes
|
Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
For a complete example see test/testgesture.c
|
For a complete example see test/testgesture.c
|
||||||
|
|
||||||
Please direct questions/comments to:
|
Please direct questions/comments to:
|
||||||
jim.tla+sdl_touch@gmail.com
|
jim.tla+sdl_touch@gmail.com
|
|
@ -1,23 +1,23 @@
|
||||||
The latest development version of SDL is available via Mercurial.
|
The latest development version of SDL is available via Mercurial.
|
||||||
Mercurial allows you to get up-to-the-minute fixes and enhancements;
|
ercurial allows you to get up-to-the-minute fixes and enhancements;
|
||||||
as a developer works on a source tree, you can use "hg" to mirror that
|
as a developer works on a source tree, you can use "hg" to mirror that
|
||||||
source tree instead of waiting for an official release. Please look
|
source tree instead of waiting for an official release. Please look
|
||||||
at the Mercurial website ( http://mercurial.selenic.com/ ) for more
|
at the Mercurial website ( http://mercurial.selenic.com/ ) for more
|
||||||
information on using hg, where you can also download software for
|
information on using hg, where you can also download software for
|
||||||
Mac OS X, Windows, and Unix systems.
|
ac OS X, Windows, and Unix systems.
|
||||||
|
|
||||||
hg clone http://hg.libsdl.org/SDL
|
hg clone http://hg.libsdl.org/SDL
|
||||||
|
|
||||||
If you are building SDL with an IDE, you will need to copy the file
|
If you are building SDL with an IDE, you will need to copy the file
|
||||||
include/SDL_config.h.default to include/SDL_config.h before building.
|
include/SDL_config.h.default to include/SDL_config.h before building.
|
||||||
|
|
||||||
If you are building SDL via configure, you will need to run autogen.sh
|
If you are building SDL via configure, you will need to run autogen.sh
|
||||||
before running configure.
|
before running configure.
|
||||||
|
|
||||||
There is a web interface to the subversion repository at:
|
There is a web interface to the subversion repository at:
|
||||||
|
|
||||||
http://hg.libsdl.org/SDL/
|
http://hg.libsdl.org/SDL/
|
||||||
|
|
||||||
There is an RSS feed available at that URL, for those that want to
|
There is an RSS feed available at that URL, for those that want to
|
||||||
track commits in real time.
|
track commits in real time.
|
||||||
|
|
|
@ -1,222 +1,222 @@
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Building the Simple DirectMedia Layer for iPhone OS 2.0
|
Building the Simple DirectMedia Layer for iPhone OS 2.0
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Requirements: Mac OS X v10.5 or later and the iPhone SDK.
|
Requirements: Mac OS X v10.5 or later and the iPhone SDK.
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in XCode.
|
1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in XCode.
|
||||||
2. Select your desired target, and hit build.
|
2. Select your desired target, and hit build.
|
||||||
|
|
||||||
There are three build targets:
|
There are three build targets:
|
||||||
- libSDL.a:
|
- libSDL.a:
|
||||||
Build SDL as a statically linked library
|
Build SDL as a statically linked library
|
||||||
- testsdl
|
- testsdl
|
||||||
Build a test program (there are known test failures which are fine)
|
Build a test program (there are known test failures which are fine)
|
||||||
- Template:
|
- Template:
|
||||||
Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers. The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen.
|
Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers. The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Build SDL for iOS from the command line
|
Build SDL for iOS from the command line
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
1. cd (PATH WHERE THE SDL CODE IS)/build-scripts
|
1. cd (PATH WHERE THE SDL CODE IS)/build-scripts
|
||||||
2. ./iosbuild.sh
|
2. ./iosbuild.sh
|
||||||
|
|
||||||
If everything goes fine, you should see a build/ios directory, inside there's
|
If everything goes fine, you should see a build/ios directory, inside there's
|
||||||
two directories "lib" and "include".
|
two directories "lib" and "include".
|
||||||
"include" contains a copy of the SDL headers that you'll need for your project,
|
"include" contains a copy of the SDL headers that you'll need for your project,
|
||||||
make sure to configure XCode to look for headers there.
|
make sure to configure XCode to look for headers there.
|
||||||
"lib" contains find two files, libSDL2.a and libSDL2main.a, you have to add both
|
"lib" contains find two files, libSDL2.a and libSDL2main.a, you have to add both
|
||||||
to your XCode project. These libraries contain three architectures in them,
|
to your XCode project. These libraries contain three architectures in them,
|
||||||
armv6 for legacy devices, armv7, and i386 (for the simulator).
|
armv6 for legacy devices, armv7, and i386 (for the simulator).
|
||||||
By default, iosbuild.sh will autodetect the SDK version you have installed using
|
By default, iosbuild.sh will autodetect the SDK version you have installed using
|
||||||
xcodebuild -showsdks, and build for iOS >= 3.0, you can override this behaviour
|
xcodebuild -showsdks, and build for iOS >= 3.0, you can override this behaviour
|
||||||
by setting the MIN_OS_VERSION variable, ie:
|
by setting the MIN_OS_VERSION variable, ie:
|
||||||
|
|
||||||
MIN_OS_VERSION=4.2 ./iosbuild.sh
|
IN_OS_VERSION=4.2 ./iosbuild.sh
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Using the Simple DirectMedia Layer for iOS
|
Using the Simple DirectMedia Layer for iOS
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
FIXME: This needs to be updated for the latest methods
|
FIXME: This needs to be updated for the latest methods
|
||||||
|
|
||||||
Here is the easiest method:
|
Here is the easiest method:
|
||||||
1. Build the SDL libraries (libSDL.a and libSDLSimulator.a) and the iPhone SDL Application template.
|
1. Build the SDL libraries (libSDL.a and libSDLSimulator.a) and the iPhone SDL Application template.
|
||||||
1. Install the iPhone SDL Application template by copying it to one of XCode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there.
|
1. Install the iPhone SDL Application template by copying it to one of XCode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there.
|
||||||
2. Start a new project using the template. The project should be immediately ready for use with SDL.
|
2. Start a new project using the template. The project should be immediately ready for use with SDL.
|
||||||
|
|
||||||
Here is a more manual method:
|
Here is a more manual method:
|
||||||
1. Create a new iPhone view based application.
|
1. Create a new iPhone view based application.
|
||||||
2. Build the SDL static libraries (libSDL.a and libSDLSimulator.a) for iPhone and include them in your project. XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator.
|
2. Build the SDL static libraries (libSDL.a and libSDLSimulator.a) for iPhone and include them in your project. XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator.
|
||||||
3. Include the SDL header files in your project.
|
3. Include the SDL header files in your project.
|
||||||
4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically.
|
4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically.
|
||||||
5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code.
|
5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Notes -- Application events
|
Notes -- Application events
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
On iOS the application goes through a fixed life cycle and you will get
|
On iOS the application goes through a fixed life cycle and you will get
|
||||||
notifications of state changes via application events. When these events
|
notifications of state changes via application events. When these events
|
||||||
are delivered you must handle them in an event callback because the OS may
|
are delivered you must handle them in an event callback because the OS may
|
||||||
not give you any processing time after the events are delivered.
|
not give you any processing time after the events are delivered.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
int HandleAppEvents(void *userdata, SDL_Event *event)
|
int HandleAppEvents(void *userdata, SDL_Event *event)
|
||||||
{
|
{
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case SDL_APP_TERMINATING:
|
case SDL_APP_TERMINATING:
|
||||||
/* Terminate the app.
|
/* Terminate the app.
|
||||||
Shut everything down before returning from this function.
|
Shut everything down before returning from this function.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_LOWMEMORY:
|
case SDL_APP_LOWMEMORY:
|
||||||
/* You will get this when your app is paused and iOS wants more memory.
|
/* You will get this when your app is paused and iOS wants more memory.
|
||||||
Release as much memory as possible.
|
Release as much memory as possible.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_WILLENTERBACKGROUND:
|
case SDL_APP_WILLENTERBACKGROUND:
|
||||||
/* Prepare your app to go into the background. Stop loops, etc.
|
/* Prepare your app to go into the background. Stop loops, etc.
|
||||||
This gets called when the user hits the home button, or gets a call.
|
This gets called when the user hits the home button, or gets a call.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_DIDENTERBACKGROUND:
|
case SDL_APP_DIDENTERBACKGROUND:
|
||||||
/* This will get called if the user accepted whatever sent your app to the background.
|
/* This will get called if the user accepted whatever sent your app to the background.
|
||||||
If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
|
If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
|
||||||
When you get this, you have 5 seconds to save all your state or the app will be terminated.
|
When you get this, you have 5 seconds to save all your state or the app will be terminated.
|
||||||
Your app is NOT active at this point.
|
Your app is NOT active at this point.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_WILLENTERFOREGROUND:
|
case SDL_APP_WILLENTERFOREGROUND:
|
||||||
/* This call happens when your app is coming back to the foreground.
|
/* This call happens when your app is coming back to the foreground.
|
||||||
Restore all your state here.
|
Restore all your state here.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_DIDENTERFOREGROUND:
|
case SDL_APP_DIDENTERFOREGROUND:
|
||||||
/* Restart your loops here.
|
/* Restart your loops here.
|
||||||
Your app is interactive and getting CPU again.
|
Your app is interactive and getting CPU again.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
/* No special processing, add it to the event queue */
|
/* No special processing, add it to the event queue */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_SetEventFilter(HandleAppEvents, NULL);
|
SDL_SetEventFilter(HandleAppEvents, NULL);
|
||||||
|
|
||||||
... run your main loop
|
... run your main loop
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Notes -- Accelerometer as Joystick
|
Notes -- Accelerometer as Joystick
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory.
|
SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory.
|
||||||
|
|
||||||
The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
|
The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Notes -- OpenGL ES
|
Notes -- OpenGL ES
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Your SDL application for iPhone uses OpenGL ES for video by default.
|
Your SDL application for iPhone uses OpenGL ES for video by default.
|
||||||
|
|
||||||
OpenGL ES for iPhone supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute.
|
OpenGL ES for iPhone supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute.
|
||||||
|
|
||||||
If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
|
If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
|
||||||
|
|
||||||
Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 1.
|
Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 1.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Notes -- Keyboard
|
Notes -- Keyboard
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
The SDL keyboard API has been extended to support on-screen keyboards:
|
The SDL keyboard API has been extended to support on-screen keyboards:
|
||||||
|
|
||||||
void SDL_StartTextInput()
|
void SDL_StartTextInput()
|
||||||
-- enables text events and reveals the onscreen keyboard.
|
-- enables text events and reveals the onscreen keyboard.
|
||||||
void SDL_StopTextInput()
|
void SDL_StopTextInput()
|
||||||
-- disables text events and hides the onscreen keyboard.
|
-- disables text events and hides the onscreen keyboard.
|
||||||
SDL_bool SDL_IsTextInputActive()
|
SDL_bool SDL_IsTextInputActive()
|
||||||
-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
|
-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Notes -- Reading and Writing files
|
Notes -- Reading and Writing files
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory.
|
Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory.
|
||||||
|
|
||||||
Once your application is installed its directory tree looks like:
|
Once your application is installed its directory tree looks like:
|
||||||
|
|
||||||
MySDLApp Home/
|
ySDLApp Home/
|
||||||
MySDLApp.app
|
MySDLApp.app
|
||||||
Documents/
|
Documents/
|
||||||
Library/
|
Library/
|
||||||
Preferences/
|
Preferences/
|
||||||
tmp/
|
tmp/
|
||||||
|
|
||||||
When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
|
When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
|
||||||
|
|
||||||
More information on this subject is available here:
|
ore information on this subject is available here:
|
||||||
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
|
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Notes -- iPhone SDL limitations
|
Notes -- iPhone SDL limitations
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS).
|
Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS).
|
||||||
|
|
||||||
Textures:
|
Textures:
|
||||||
The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
|
The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
|
||||||
|
|
||||||
Loading Shared Objects:
|
Loading Shared Objects:
|
||||||
This is disabled by default since it seems to break the terms of the iPhone SDK agreement. It can be re-enabled in SDL_config_iphoneos.h.
|
This is disabled by default since it seems to break the terms of the iPhone SDK agreement. It can be re-enabled in SDL_config_iphoneos.h.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Game Center
|
Game Center
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Game Center integration requires that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
|
Game Center integration requires that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
|
||||||
|
|
||||||
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
||||||
|
|
||||||
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
|
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
void ShowFrame(void*)
|
void ShowFrame(void*)
|
||||||
{
|
{
|
||||||
... do event handling, frame logic and rendering
|
... do event handling, frame logic and rendering
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
... initialize game ...
|
... initialize game ...
|
||||||
|
|
||||||
#if __IPHONEOS__
|
#if __IPHONEOS__
|
||||||
// Initialize the Game Center for scoring and matchmaking
|
// Initialize the Game Center for scoring and matchmaking
|
||||||
InitGameCenter();
|
InitGameCenter();
|
||||||
|
|
||||||
// Set up the game to run in the window animation callback on iOS
|
// Set up the game to run in the window animation callback on iOS
|
||||||
// so that Game Center and so forth works correctly.
|
// so that Game Center and so forth works correctly.
|
||||||
SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
|
SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
|
||||||
#else
|
#else
|
||||||
while ( running ) {
|
while ( running ) {
|
||||||
ShowFrame(0);
|
ShowFrame(0);
|
||||||
DelayFrame();
|
DelayFrame();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -1,186 +1,186 @@
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Using the Simple DirectMedia Layer with Mac OS X
|
Using the Simple DirectMedia Layer with Mac OS X
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
These instructions are for people using Apple's Mac OS X (pronounced
|
These instructions are for people using Apple's Mac OS X (pronounced
|
||||||
"ten").
|
"ten").
|
||||||
|
|
||||||
From the developer's point of view, OS X is a sort of hybrid Mac and
|
From the developer's point of view, OS X is a sort of hybrid Mac and
|
||||||
Unix system, and you have the option of using either traditional
|
Unix system, and you have the option of using either traditional
|
||||||
command line tools or Apple's IDE Xcode.
|
command line tools or Apple's IDE Xcode.
|
||||||
|
|
||||||
To build SDL using the command line, use the standard configure and make
|
To build SDL using the command line, use the standard configure and make
|
||||||
process:
|
process:
|
||||||
|
|
||||||
./configure
|
./configure
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
You can also build SDL as a Universal library (a single binary for both
|
You can also build SDL as a Universal library (a single binary for both
|
||||||
PowerPC and Intel architectures), on Mac OS X 10.4 and newer, by using
|
PowerPC and Intel architectures), on Mac OS X 10.4 and newer, by using
|
||||||
the fatbuild.sh script in build-scripts:
|
the fatbuild.sh script in build-scripts:
|
||||||
sh build-scripts/fatbuild.sh
|
sh build-scripts/fatbuild.sh
|
||||||
sudo build-scripts/fatbuild.sh install
|
sudo build-scripts/fatbuild.sh install
|
||||||
This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
|
This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
|
||||||
ABI compatibility on Intel architectures. For best compatibility you
|
ABI compatibility on Intel architectures. For best compatibility you
|
||||||
should compile your application the same way. A script which wraps
|
should compile your application the same way. A script which wraps
|
||||||
gcc to make this easy is provided in test/gcc-fat.sh
|
gcc to make this easy is provided in test/gcc-fat.sh
|
||||||
|
|
||||||
To use the library once it's built, you essential have two possibilities:
|
To use the library once it's built, you essential have two possibilities:
|
||||||
use the traditional autoconf/automake/make method, or use Xcode.
|
use the traditional autoconf/automake/make method, or use Xcode.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Using the Simple DirectMedia Layer with a traditional Makefile
|
Using the Simple DirectMedia Layer with a traditional Makefile
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
An existing autoconf/automake build system for your SDL app has good chances
|
An existing autoconf/automake build system for your SDL app has good chances
|
||||||
to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
|
to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
|
||||||
that you can distribute to users, you need to put the generated binary into a
|
that you can distribute to users, you need to put the generated binary into a
|
||||||
so called "bundle", which basically is a fancy folder with a name like
|
so called "bundle", which basically is a fancy folder with a name like
|
||||||
"MyCoolGame.app".
|
"MyCoolGame.app".
|
||||||
|
|
||||||
To get this build automatically, add something like the following rule to
|
To get this build automatically, add something like the following rule to
|
||||||
your Makefile.am:
|
your Makefile.am:
|
||||||
|
|
||||||
bundle_contents = APP_NAME.app/Contents
|
bundle_contents = APP_NAME.app/Contents
|
||||||
APP_NAME_bundle: EXE_NAME
|
APP_NAME_bundle: EXE_NAME
|
||||||
mkdir -p $(bundle_contents)/MacOS
|
mkdir -p $(bundle_contents)/MacOS
|
||||||
mkdir -p $(bundle_contents)/Resources
|
mkdir -p $(bundle_contents)/Resources
|
||||||
echo "APPL????" > $(bundle_contents)/PkgInfo
|
echo "APPL????" > $(bundle_contents)/PkgInfo
|
||||||
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
|
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
|
||||||
|
|
||||||
You should replace EXE_NAME with the name of the executable. APP_NAME is what
|
You should replace EXE_NAME with the name of the executable. APP_NAME is what
|
||||||
will be visible to the user in the Finder. Usually it will be the same
|
will be visible to the user in the Finder. Usually it will be the same
|
||||||
as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME
|
as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME
|
||||||
usually is "TestGame". You might also want to use @PACKAGE@ to use the package
|
usually is "TestGame". You might also want to use @PACKAGE@ to use the package
|
||||||
name as specified in your configure.in file.
|
name as specified in your configure.in file.
|
||||||
|
|
||||||
If your project builds more than one application, you will have to do a bit
|
If your project builds more than one application, you will have to do a bit
|
||||||
more. For each of your target applications, you need a separate rule.
|
more. For each of your target applications, you need a separate rule.
|
||||||
|
|
||||||
If you want the created bundles to be installed, you may want to add this
|
If you want the created bundles to be installed, you may want to add this
|
||||||
rule to your Makefile.am:
|
rule to your Makefile.am:
|
||||||
|
|
||||||
install-exec-hook: APP_NAME_bundle
|
install-exec-hook: APP_NAME_bundle
|
||||||
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
|
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
|
||||||
mkdir -p $(DESTDIR)$(prefix)/Applications/
|
mkdir -p $(DESTDIR)$(prefix)/Applications/
|
||||||
cp -r $< /$(DESTDIR)$(prefix)Applications/
|
cp -r $< /$(DESTDIR)$(prefix)Applications/
|
||||||
|
|
||||||
This rule takes the Bundle created by the rule from step 3 and installs them
|
This rule takes the Bundle created by the rule from step 3 and installs them
|
||||||
into $(DESTDIR)$(prefix)/Applications/.
|
into $(DESTDIR)$(prefix)/Applications/.
|
||||||
|
|
||||||
Again, if you want to install multiple applications, you will have to augment
|
Again, if you want to install multiple applications, you will have to augment
|
||||||
the make rule accordingly.
|
the make rule accordingly.
|
||||||
|
|
||||||
|
|
||||||
But beware! That is only part of the story! With the above, you end up with
|
But beware! That is only part of the story! With the above, you end up with
|
||||||
a bare bone .app bundle, which is double clickable from the Finder. But
|
a bare bone .app bundle, which is double clickable from the Finder. But
|
||||||
there are some more things you should do before shipping your product...
|
there are some more things you should do before shipping your product...
|
||||||
|
|
||||||
1) The bundle right now probably is dynamically linked against SDL. That
|
1) The bundle right now probably is dynamically linked against SDL. That
|
||||||
means that when you copy it to another computer, *it will not run*,
|
means that when you copy it to another computer, *it will not run*,
|
||||||
unless you also install SDL on that other computer. A good solution
|
unless you also install SDL on that other computer. A good solution
|
||||||
for this dilemma is to static link against SDL. On OS X, you can
|
for this dilemma is to static link against SDL. On OS X, you can
|
||||||
achieve that by linking against the libraries listed by
|
achieve that by linking against the libraries listed by
|
||||||
sdl-config --static-libs
|
sdl-config --static-libs
|
||||||
instead of those listed by
|
instead of those listed by
|
||||||
sdl-config --libs
|
sdl-config --libs
|
||||||
Depending on how exactly SDL is integrated into your build systems, the
|
Depending on how exactly SDL is integrated into your build systems, the
|
||||||
way to achieve that varies, so I won't describe it here in detail
|
way to achieve that varies, so I won't describe it here in detail
|
||||||
2) Add an 'Info.plist' to your application. That is a special XML file which
|
2) Add an 'Info.plist' to your application. That is a special XML file which
|
||||||
contains some meta-information about your application (like some copyright
|
contains some meta-information about your application (like some copyright
|
||||||
information, the version of your app, the name of an optional icon file,
|
information, the version of your app, the name of an optional icon file,
|
||||||
and other things). Part of that information is displayed by the Finder
|
and other things). Part of that information is displayed by the Finder
|
||||||
when you click on the .app, or if you look at the "Get Info" window.
|
when you click on the .app, or if you look at the "Get Info" window.
|
||||||
More information about Info.plist files can be found on Apple's homepage.
|
More information about Info.plist files can be found on Apple's homepage.
|
||||||
|
|
||||||
|
|
||||||
As a final remark, let me add that I use some of the techniques (and some
|
As a final remark, let me add that I use some of the techniques (and some
|
||||||
variations of them) in Exult and ScummVM; both are available in source on
|
variations of them) in Exult and ScummVM; both are available in source on
|
||||||
the net, so feel free to take a peek at them for inspiration!
|
the net, so feel free to take a peek at them for inspiration!
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Using the Simple DirectMedia Layer with Xcode
|
Using the Simple DirectMedia Layer with Xcode
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
These instructions are for using Apple's Xcode IDE to build SDL applications.
|
These instructions are for using Apple's Xcode IDE to build SDL applications.
|
||||||
|
|
||||||
- First steps
|
- First steps
|
||||||
|
|
||||||
The first thing to do is to unpack the Xcode.tar.gz archive in the
|
The first thing to do is to unpack the Xcode.tar.gz archive in the
|
||||||
top level SDL directory (where the Xcode.tar.gz archive resides).
|
top level SDL directory (where the Xcode.tar.gz archive resides).
|
||||||
Because Stuffit Expander will unpack the archive into a subdirectory,
|
Because Stuffit Expander will unpack the archive into a subdirectory,
|
||||||
you should unpack the archive manually from the command line:
|
you should unpack the archive manually from the command line:
|
||||||
cd [path_to_SDL_source]
|
cd [path_to_SDL_source]
|
||||||
tar zxf Xcode.tar.gz
|
tar zxf Xcode.tar.gz
|
||||||
This will create a new folder called Xcode, which you can browse
|
This will create a new folder called Xcode, which you can browse
|
||||||
normally from the Finder.
|
normally from the Finder.
|
||||||
|
|
||||||
- Building the Framework
|
- Building the Framework
|
||||||
|
|
||||||
The SDL Library is packaged as a framework bundle, an organized
|
The SDL Library is packaged as a framework bundle, an organized
|
||||||
relocatable folder hierarchy of executable code, interface headers,
|
relocatable folder hierarchy of executable code, interface headers,
|
||||||
and additional resources. For practical purposes, you can think of a
|
and additional resources. For practical purposes, you can think of a
|
||||||
framework as a more user and system-friendly shared library, whose library
|
framework as a more user and system-friendly shared library, whose library
|
||||||
file behaves more or less like a standard UNIX shared library.
|
file behaves more or less like a standard UNIX shared library.
|
||||||
|
|
||||||
To build the framework, simply open the framework project and build it.
|
To build the framework, simply open the framework project and build it.
|
||||||
By default, the framework bundle "SDL.framework" is installed in
|
By default, the framework bundle "SDL.framework" is installed in
|
||||||
/Library/Frameworks. Therefore, the testers and project stationary expect
|
/Library/Frameworks. Therefore, the testers and project stationary expect
|
||||||
it to be located there. However, it will function the same in any of the
|
it to be located there. However, it will function the same in any of the
|
||||||
following locations:
|
following locations:
|
||||||
|
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
/Local/Library/Frameworks
|
/Local/Library/Frameworks
|
||||||
/System/Library/Frameworks
|
/System/Library/Frameworks
|
||||||
|
|
||||||
- Build Options
|
- Build Options
|
||||||
There are two "Build Styles" (See the "Targets" tab) for SDL.
|
There are two "Build Styles" (See the "Targets" tab) for SDL.
|
||||||
"Deployment" should be used if you aren't tweaking the SDL library.
|
"Deployment" should be used if you aren't tweaking the SDL library.
|
||||||
"Development" should be used to debug SDL apps or the library itself.
|
"Development" should be used to debug SDL apps or the library itself.
|
||||||
|
|
||||||
- Building the Testers
|
- Building the Testers
|
||||||
Open the SDLTest project and build away!
|
Open the SDLTest project and build away!
|
||||||
|
|
||||||
- Using the Project Stationary
|
- Using the Project Stationary
|
||||||
Copy the stationary to the indicated folders to access it from
|
Copy the stationary to the indicated folders to access it from
|
||||||
the "New Project" and "Add target" menus. What could be easier?
|
the "New Project" and "Add target" menus. What could be easier?
|
||||||
|
|
||||||
- Setting up a new project by hand
|
- Setting up a new project by hand
|
||||||
Some of you won't want to use the Stationary so I'll give some tips:
|
Some of you won't want to use the Stationary so I'll give some tips:
|
||||||
* Create a new "Cocoa Application"
|
* Create a new "Cocoa Application"
|
||||||
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
|
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
|
||||||
* Remove "main.c" from your project
|
* Remove "main.c" from your project
|
||||||
* Remove "MainMenu.nib" from your project
|
* Remove "MainMenu.nib" from your project
|
||||||
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
|
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
|
||||||
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
|
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
|
||||||
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
|
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
|
||||||
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
|
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
|
||||||
* Add your files
|
* Add your files
|
||||||
* Clean and build
|
* Clean and build
|
||||||
|
|
||||||
- Building from command line
|
- Building from command line
|
||||||
Use pbxbuild in the same directory as your .pbproj file
|
Use pbxbuild in the same directory as your .pbproj file
|
||||||
|
|
||||||
- Running your app
|
- Running your app
|
||||||
You can send command line args to your app by either invoking it from
|
You can send command line args to your app by either invoking it from
|
||||||
the command line (in *.app/Contents/MacOS) or by entering them in the
|
the command line (in *.app/Contents/MacOS) or by entering them in the
|
||||||
"Executables" panel of the target settings.
|
"Executables" panel of the target settings.
|
||||||
|
|
||||||
- Implementation Notes
|
- Implementation Notes
|
||||||
Some things that may be of interest about how it all works...
|
Some things that may be of interest about how it all works...
|
||||||
* Working directory
|
* Working directory
|
||||||
As defined in the SDL_main.m file, the working directory of your SDL app
|
As defined in the SDL_main.m file, the working directory of your SDL app
|
||||||
is by default set to its parent. You may wish to change this to better
|
is by default set to its parent. You may wish to change this to better
|
||||||
suit your needs.
|
suit your needs.
|
||||||
* You have a Cocoa App!
|
* You have a Cocoa App!
|
||||||
Your SDL app is essentially a Cocoa application. When your app
|
Your SDL app is essentially a Cocoa application. When your app
|
||||||
starts up and the libraries finish loading, a Cocoa procedure is called,
|
starts up and the libraries finish loading, a Cocoa procedure is called,
|
||||||
which sets up the working directory and calls your main() method.
|
which sets up the working directory and calls your main() method.
|
||||||
You are free to modify your Cocoa app with generally no consequence
|
You are free to modify your Cocoa app with generally no consequence
|
||||||
to SDL. You cannot, however, easily change the SDL window itself.
|
to SDL. You cannot, however, easily change the SDL window itself.
|
||||||
Functionality may be added in the future to help this.
|
Functionality may be added in the future to help this.
|
||||||
|
|
||||||
|
|
||||||
Known bugs are listed in the file "BUGS"
|
Known bugs are listed in the file "BUGS"
|
|
@ -1,16 +1,16 @@
|
||||||
SDL 2.0 with open pandora console support ( http://openpandora.org/ )
|
SDL 2.0 with open pandora console support ( http://openpandora.org/ )
|
||||||
=====================================================================
|
=====================================================================
|
||||||
|
|
||||||
- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
|
- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
|
||||||
support to work on the pandora under the framebuffer. This driver do not have
|
support to work on the pandora under the framebuffer. This driver do not have
|
||||||
input support for now, so if you use it you will have to add your own control code.
|
input support for now, so if you use it you will have to add your own control code.
|
||||||
The video driver name is "pandora" so if you have problem running it from
|
The video driver name is "pandora" so if you have problem running it from
|
||||||
the framebuffer, try to set the following variable before starting your application :
|
the framebuffer, try to set the following variable before starting your application :
|
||||||
"export SDL_VIDEODRIVER=pandora"
|
"export SDL_VIDEODRIVER=pandora"
|
||||||
|
|
||||||
- OpenGL ES support was added to the x11 driver, so it's working like the normal
|
- OpenGL ES support was added to the x11 driver, so it's working like the normal
|
||||||
x11 driver one with OpenGLX support, with SDL input event's etc..
|
x11 driver one with OpenGLX support, with SDL input event's etc..
|
||||||
|
|
||||||
|
|
||||||
David Carré (Cpasjuste)
|
David Carré (Cpasjuste)
|
||||||
cpasjuste@gmail.com
|
cpasjuste@gmail.com
|
|
@ -1,32 +1,32 @@
|
||||||
|
|
||||||
This is a list of the platforms SDL supports, and who maintains them.
|
This is a list of the platforms SDL supports, and who maintains them.
|
||||||
|
|
||||||
Officially supported platforms
|
Officially supported platforms
|
||||||
==============================
|
==============================
|
||||||
(code compiles, and thoroughly tested for release)
|
(code compiles, and thoroughly tested for release)
|
||||||
==============================
|
==============================
|
||||||
Windows XP
|
Windows XP
|
||||||
Windows Vista
|
Windows Vista
|
||||||
Windows 7
|
Windows 7
|
||||||
Mac OS X 10.4+
|
ac OS X 10.4+
|
||||||
Linux 2.6+
|
Linux 2.6+
|
||||||
iOS 3.1.3+
|
iOS 3.1.3+
|
||||||
Android 2.3.3+
|
Android 2.3.3+
|
||||||
|
|
||||||
Unofficially supported platforms
|
Unofficially supported platforms
|
||||||
================================
|
================================
|
||||||
(code compiles, but not thoroughly tested)
|
(code compiles, but not thoroughly tested)
|
||||||
================================
|
================================
|
||||||
FreeBSD
|
FreeBSD
|
||||||
NetBSD
|
NetBSD
|
||||||
OpenBSD
|
OpenBSD
|
||||||
Solaris
|
Solaris
|
||||||
|
|
||||||
Platforms supported by volunteers
|
Platforms supported by volunteers
|
||||||
=================================
|
=================================
|
||||||
Haiku - maintained by Axel Dörfler <axeld@pinc-software.de>
|
Haiku - maintained by Axel Dörfler <axeld@pinc-software.de>
|
||||||
PSP - maintained by 527721088@qq.com
|
PSP - maintained by 527721088@qq.com
|
||||||
Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
|
Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
|
||||||
|
|
||||||
Platforms that need maintainers
|
Platforms that need maintainers
|
||||||
===============================
|
===============================
|
|
@ -1,61 +1,61 @@
|
||||||
|
|
||||||
* Porting To A New Platform
|
* Porting To A New Platform
|
||||||
|
|
||||||
The first thing you have to do when porting to a new platform, is look at
|
The first thing you have to do when porting to a new platform, is look at
|
||||||
include/SDL_platform.h and create an entry there for your operating system.
|
include/SDL_platform.h and create an entry there for your operating system.
|
||||||
The standard format is __PLATFORM__, where PLATFORM is the name of the OS.
|
The standard format is __PLATFORM__, where PLATFORM is the name of the OS.
|
||||||
Ideally SDL_platform.h will be able to auto-detect the system it's building
|
Ideally SDL_platform.h will be able to auto-detect the system it's building
|
||||||
on based on C preprocessor symbols.
|
on based on C preprocessor symbols.
|
||||||
|
|
||||||
There are two basic ways of building SDL at the moment:
|
There are two basic ways of building SDL at the moment:
|
||||||
|
|
||||||
1. The "UNIX" way: ./configure; make; make install
|
1. The "UNIX" way: ./configure; make; make install
|
||||||
|
|
||||||
If you have a GNUish system, then you might try this. Edit configure.in,
|
If you have a GNUish system, then you might try this. Edit configure.in,
|
||||||
take a look at the large section labelled:
|
take a look at the large section labelled:
|
||||||
"Set up the configuration based on the target platform!"
|
"Set up the configuration based on the target platform!"
|
||||||
Add a section for your platform, and then re-run autogen.sh and build!
|
Add a section for your platform, and then re-run autogen.sh and build!
|
||||||
|
|
||||||
2. Using an IDE:
|
2. Using an IDE:
|
||||||
|
|
||||||
If you're using an IDE or other non-configure build system, you'll probably
|
If you're using an IDE or other non-configure build system, you'll probably
|
||||||
want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
|
want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
|
||||||
add a section for your platform, and create a custom SDL_config_{platform}.h,
|
add a section for your platform, and create a custom SDL_config_{platform}.h,
|
||||||
based on SDL_config.h.minimal and SDL_config.h.in
|
based on SDL_config.h.minimal and SDL_config.h.in
|
||||||
|
|
||||||
Add the top level include directory to the header search path, and then add
|
Add the top level include directory to the header search path, and then add
|
||||||
the following sources to the project:
|
the following sources to the project:
|
||||||
src/*.c
|
src/*.c
|
||||||
src/atomic/*.c
|
src/atomic/*.c
|
||||||
src/audio/*.c
|
src/audio/*.c
|
||||||
src/cpuinfo/*.c
|
src/cpuinfo/*.c
|
||||||
src/events/*.c
|
src/events/*.c
|
||||||
src/file/*.c
|
src/file/*.c
|
||||||
src/haptic/*.c
|
src/haptic/*.c
|
||||||
src/joystick/*.c
|
src/joystick/*.c
|
||||||
src/power/*.c
|
src/power/*.c
|
||||||
src/render/*.c
|
src/render/*.c
|
||||||
src/stdlib/*.c
|
src/stdlib/*.c
|
||||||
src/thread/*.c
|
src/thread/*.c
|
||||||
src/timer/*.c
|
src/timer/*.c
|
||||||
src/video/*.c
|
src/video/*.c
|
||||||
src/audio/disk/*.c
|
src/audio/disk/*.c
|
||||||
src/audio/dummy/*.c
|
src/audio/dummy/*.c
|
||||||
src/video/dummy/*.c
|
src/video/dummy/*.c
|
||||||
src/haptic/dummy/*.c
|
src/haptic/dummy/*.c
|
||||||
src/joystick/dummy/*.c
|
src/joystick/dummy/*.c
|
||||||
src/main/dummy/*.c
|
src/main/dummy/*.c
|
||||||
src/thread/generic/*.c
|
src/thread/generic/*.c
|
||||||
src/timer/dummy/*.c
|
src/timer/dummy/*.c
|
||||||
src/loadso/dummy/*.c
|
src/loadso/dummy/*.c
|
||||||
|
|
||||||
|
|
||||||
Once you have a working library without any drivers, you can go back to each
|
Once you have a working library without any drivers, you can go back to each
|
||||||
of the major subsystems and start implementing drivers for your platform.
|
of the major subsystems and start implementing drivers for your platform.
|
||||||
|
|
||||||
If you have any questions, don't hesitate to ask on the SDL mailing list:
|
If you have any questions, don't hesitate to ask on the SDL mailing list:
|
||||||
http://www.libsdl.org/mailing-list.php
|
http://www.libsdl.org/mailing-list.php
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
Sam Lantinga (slouken@libsdl.org)
|
Sam Lantinga (slouken@libsdl.org)
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
SDL port for the Sony PSP contributed by
|
SDL port for the Sony PSP contributed by
|
||||||
Captian Lex
|
Captian Lex
|
||||||
|
|
||||||
Credit to
|
Credit to
|
||||||
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
|
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
|
||||||
Geecko for his PSP GU lib "Glib2d"
|
Geecko for his PSP GU lib "Glib2d"
|
||||||
|
|
||||||
Building
|
Building
|
||||||
--------
|
--------
|
||||||
To build for the PSP, make sure psp-config is in the path and run:
|
To build for the PSP, make sure psp-config is in the path and run:
|
||||||
make -f Makefile.psp
|
make -f Makefile.psp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To Do
|
To Do
|
||||||
------
|
------
|
||||||
PSP Screen Keyboard
|
PSP Screen Keyboard
|
|
@ -1,84 +1,84 @@
|
||||||
===========================================================================
|
===========================================================================
|
||||||
System Specific Notes
|
System Specific Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Linux:
|
Linux:
|
||||||
The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
|
The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
|
||||||
|
|
||||||
Mac:
|
ac:
|
||||||
The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
|
The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
|
||||||
|
|
||||||
iPhone:
|
iPhone:
|
||||||
Works out of box.
|
Works out of box.
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
|
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Events
|
Events
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL_FINGERDOWN:
|
SDL_FINGERDOWN:
|
||||||
Sent when a finger (or stylus) is placed on a touch device.
|
Sent when a finger (or stylus) is placed on a touch device.
|
||||||
Fields:
|
Fields:
|
||||||
event.tfinger.touchId - the Id of the touch device.
|
event.tfinger.touchId - the Id of the touch device.
|
||||||
event.tfinger.fingerId - the Id of the finger which just went down.
|
event.tfinger.fingerId - the Id of the finger which just went down.
|
||||||
event.tfinger.x - the x coordinate of the touch (0..1)
|
event.tfinger.x - the x coordinate of the touch (0..1)
|
||||||
event.tfinger.y - the y coordinate of the touch (0..1)
|
event.tfinger.y - the y coordinate of the touch (0..1)
|
||||||
event.tfinger.pressure - the pressure of the touch (0..1)
|
event.tfinger.pressure - the pressure of the touch (0..1)
|
||||||
|
|
||||||
SDL_FINGERMOTION:
|
SDL_FINGERMOTION:
|
||||||
Sent when a finger (or stylus) is moved on the touch device.
|
Sent when a finger (or stylus) is moved on the touch device.
|
||||||
Fields:
|
Fields:
|
||||||
Same as SDL_FINGERDOWN but with additional:
|
Same as SDL_FINGERDOWN but with additional:
|
||||||
event.tfinger.dx - change in x coordinate during this motion event.
|
event.tfinger.dx - change in x coordinate during this motion event.
|
||||||
event.tfinger.dy - change in y coordinate during this motion event.
|
event.tfinger.dy - change in y coordinate during this motion event.
|
||||||
|
|
||||||
SDL_FINGERUP:
|
SDL_FINGERUP:
|
||||||
Sent when a finger (or stylus) is lifted from the touch device.
|
Sent when a finger (or stylus) is lifted from the touch device.
|
||||||
Fields:
|
Fields:
|
||||||
Same as SDL_FINGERDOWN.
|
Same as SDL_FINGERDOWN.
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Functions
|
Functions
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL provides the ability to access the underlying Finger structures.
|
SDL provides the ability to access the underlying Finger structures.
|
||||||
These structures should _never_ be modified.
|
These structures should _never_ be modified.
|
||||||
|
|
||||||
The following functions are included from SDL_touch.h
|
The following functions are included from SDL_touch.h
|
||||||
|
|
||||||
To get a SDL_TouchID call SDL_GetTouchDevice(index).
|
To get a SDL_TouchID call SDL_GetTouchDevice(index).
|
||||||
This returns a SDL_TouchID.
|
This returns a SDL_TouchID.
|
||||||
IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this!
|
IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this!
|
||||||
|
|
||||||
The number of touch devices can be queried with SDL_GetNumTouchDevices().
|
The number of touch devices can be queried with SDL_GetNumTouchDevices().
|
||||||
|
|
||||||
A SDL_TouchID may be used to get pointers to SDL_Finger.
|
A SDL_TouchID may be used to get pointers to SDL_Finger.
|
||||||
|
|
||||||
SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
|
SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
|
||||||
|
|
||||||
The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
|
The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
|
||||||
|
|
||||||
float x = event.tfinger.x;
|
float x = event.tfinger.x;
|
||||||
float y = event.tfinger.y;
|
float y = event.tfinger.y;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger.
|
To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger.
|
||||||
This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed.
|
This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed.
|
||||||
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
|
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
|
||||||
As a result, be very careful to check for NULL return values.
|
As a result, be very careful to check for NULL return values.
|
||||||
|
|
||||||
A SDL_Finger has the following fields:
|
A SDL_Finger has the following fields:
|
||||||
>x,y,pressure:
|
>x,y,pressure:
|
||||||
The current coordinates of the touch.
|
The current coordinates of the touch.
|
||||||
>pressure:
|
>pressure:
|
||||||
The pressure of the touch.
|
The pressure of the touch.
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Notes
|
Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
For a complete example see test/testgesture.c
|
For a complete example see test/testgesture.c
|
||||||
|
|
||||||
Please direct questions/comments to:
|
Please direct questions/comments to:
|
||||||
jim.tla+sdl_touch@gmail.com
|
jim.tla+sdl_touch@gmail.com
|
||||||
(original author, API was changed since)
|
(original author, API was changed since)
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
Windows CE is no longer supported by SDL.
|
Windows CE is no longer supported by SDL.
|
||||||
|
|
||||||
We have left the CE support in SDL 1.2 for those that must have it, and we
|
We have left the CE support in SDL 1.2 for those that must have it, and we
|
||||||
will accept patches that support more modern Windows Mobile platforms for
|
will accept patches that support more modern Windows Mobile platforms for
|
||||||
SDL 2.0.
|
SDL 2.0.
|
||||||
|
|
||||||
--ryan.
|
--ryan.
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
|
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
|
|
||||||
(SDL)
|
(SDL)
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
---
|
---
|
||||||
http://www.libsdl.org/
|
http://www.libsdl.org/
|
||||||
|
|
||||||
This is the Simple DirectMedia Layer, a general API that provides low
|
This is the Simple DirectMedia Layer, a general API that provides low
|
||||||
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
||||||
and 2D framebuffer across multiple platforms.
|
and 2D framebuffer across multiple platforms.
|
||||||
|
|
||||||
The current version supports Windows, Mac OS X, Linux, FreeBSD,
|
The current version supports Windows, Mac OS X, Linux, FreeBSD,
|
||||||
NetBSD, OpenBSD, BSD/OS, Solaris, iOS, and Android. The code contains
|
NetBSD, OpenBSD, BSD/OS, Solaris, iOS, and Android. The code contains
|
||||||
support for other operating systems but those are not officially supported.
|
support for other operating systems but those are not officially supported.
|
||||||
|
|
||||||
SDL is written in C, but works with C++ natively, and has bindings to
|
SDL is written in C, but works with C++ natively, and has bindings to
|
||||||
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
|
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
|
||||||
Go, Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
Go, Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||||
Pike, Pliant, Python, Ruby, and Smalltalk.
|
Pike, Pliant, Python, Ruby, and Smalltalk.
|
||||||
|
|
||||||
This library is distributed under the zlib license, which can be found
|
This library is distributed under the zlib license, which can be found
|
||||||
in the file "COPYING".
|
in the file "COPYING".
|
||||||
|
|
||||||
The best way to learn how to use SDL is to check out the header files in
|
The best way to learn how to use SDL is to check out the header files in
|
||||||
the "include" subdirectory and the programs in the "test" subdirectory.
|
the "include" subdirectory and the programs in the "test" subdirectory.
|
||||||
The header files and test programs are well commented and always up to date.
|
The header files and test programs are well commented and always up to date.
|
||||||
More documentation and FAQs are available online at:
|
ore documentation and FAQs are available online at:
|
||||||
http://wiki.libsdl.org/
|
http://wiki.libsdl.org/
|
||||||
|
|
||||||
If you need help with the library, or just want to discuss SDL related
|
If you need help with the library, or just want to discuss SDL related
|
||||||
issues, you can join the developers mailing list:
|
issues, you can join the developers mailing list:
|
||||||
http://www.libsdl.org/mailing-list.php
|
http://www.libsdl.org/mailing-list.php
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
Sam Lantinga (slouken@libsdl.org)
|
Sam Lantinga (slouken@libsdl.org)
|
||||||
|
|
|
@ -63,7 +63,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%{__defattr}
|
%{__defattr}
|
||||||
%doc README-SDL.txt COPYING CREDITS BUGS
|
%doc README-SDL.txt COPYING.txt CREDITS.txt BUGS.txt
|
||||||
%{_libdir}/lib*.%{__soext}.*
|
%{_libdir}/lib*.%{__soext}.*
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
2.0 release checklist:
|
Future work roadmap:
|
||||||
* http://wiki.libsdl.org/moin.cgi/Roadmap
|
* http://wiki.libsdl.org/moin.cgi/Roadmap
|
||||||
|
|
||||||
* See why windows are being rearranged. Is the shield window not up?
|
* See why windows are being rearranged. Is the shield window not up?
|
||||||
* Make sure you can create and show a fullscreen window in one step
|
* Add __WINDOWS__ in addition to __WIN32__
|
||||||
* Write automated test case for multi-draw APIs
|
* Write test for fullscreen gamma to check X11 colormap handling
|
||||||
* Implement assertion code on iPhone
|
|
||||||
* Add __WINDOWS__ in addition to __WIN32__
|
* Check 1.2 revisions:
|
||||||
* Write test for fullscreen gamma to check X11 colormap handling
|
3554 - Need to resolve semantics for locking keys on different platforms
|
||||||
|
4874 - Do we want screen rotation? At what level?
|
||||||
* Check 1.2 revisions:
|
4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
|
||||||
3554 - Need to resolve semantics for locking keys on different platforms
|
4484, 4485 - Verify that SDL's Windows keyboard handling works correctly
|
||||||
4874 - Do we want screen rotation? At what level?
|
4865 - See if this is still needed (mouse coordinate clamping)
|
||||||
4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
|
4866 - See if this is still needed (blocking window repositioning)
|
||||||
4484, 4485 - Verify that SDL's Windows keyboard handling works correctly
|
|
||||||
4865 - See if this is still needed (mouse coordinate clamping)
|
|
||||||
4866 - See if this is still needed (blocking window repositioning)
|
|
||||||
|
|
9313
aclocal.m4
vendored
9313
aclocal.m4
vendored
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,6 @@ echo "Generating build information using autoconf"
|
||||||
echo "This may take a while ..."
|
echo "This may take a while ..."
|
||||||
|
|
||||||
# Regenerate configuration files
|
# Regenerate configuration files
|
||||||
cat acinclude/* >aclocal.m4
|
|
||||||
found=false
|
found=false
|
||||||
for autoconf in autoconf autoconf259 autoconf-2.59
|
for autoconf in autoconf autoconf259 autoconf-2.59
|
||||||
do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi
|
do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi
|
||||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -592,7 +592,7 @@ PACKAGE_STRING=
|
||||||
PACKAGE_BUGREPORT=
|
PACKAGE_BUGREPORT=
|
||||||
PACKAGE_URL=
|
PACKAGE_URL=
|
||||||
|
|
||||||
ac_unique_file="README"
|
ac_unique_file="README.txt"
|
||||||
# Factoring default headers for most tests.
|
# Factoring default headers for most tests.
|
||||||
ac_includes_default="\
|
ac_includes_default="\
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(README)
|
AC_INIT(README.txt)
|
||||||
AC_CONFIG_HEADER(include/SDL_config.h)
|
AC_CONFIG_HEADER(include/SDL_config.h)
|
||||||
AC_CONFIG_AUX_DIR(build-scripts)
|
AC_CONFIG_AUX_DIR(build-scripts)
|
||||||
AC_CONFIG_MACRO_DIR([acinclude])
|
AC_CONFIG_MACRO_DIR([acinclude])
|
||||||
|
|
6
debian/docs
vendored
6
debian/docs
vendored
|
@ -1,4 +1,4 @@
|
||||||
BUGS
|
BUGS.txt
|
||||||
CREDITS
|
CREDITS.txt
|
||||||
README
|
README.txt
|
||||||
README-SDL.txt
|
README-SDL.txt
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue