SDL 2 with some patches plus png updates. So far, CG compiles but doen't
link yet
This commit is contained in:
@@ -53,7 +53,7 @@ class AudioThread
|
||||
mParent = parent;
|
||||
mAudio = null;
|
||||
mAudioBuffer = null;
|
||||
nativeAudioInitJavaCallbacks();
|
||||
//nativeAudioInitJavaCallbacks();
|
||||
}
|
||||
|
||||
public int fillBuffer()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
AppSettingVersion=19
|
||||
|
||||
# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2)
|
||||
LibSdlVersion=1.2
|
||||
LibSdlVersion=2.0
|
||||
|
||||
# Specify application name (e.x. My Application)
|
||||
AppName="Commander Genius"
|
||||
@@ -184,7 +184,7 @@ DeleteFilesOnUpgrade="%"
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
CompiledLibraries="tremor ogg sdl_image boost_system"
|
||||
CompiledLibraries="tremor ogg sdl2_image boost_system"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
CustomBuildScript=n
|
||||
|
||||
Submodule project/jni/application/commandergenius/commandergenius updated: 7c11c95336...4a4c0036e0
File diff suppressed because it is too large
Load Diff
0
project/jni/sdl-2.0/.DISABLED-hgeol.orig
Normal file
0
project/jni/sdl-2.0/.DISABLED-hgeol.orig
Normal file
60
project/jni/sdl-2.0/.DISABLED-hgeol.rej
Normal file
60
project/jni/sdl-2.0/.DISABLED-hgeol.rej
Normal file
@@ -0,0 +1,60 @@
|
||||
--- .DISABLED-hgeol 2013-10-08 17:46:42.381361960 +0200
|
||||
+++ .DISABLED-hgeol 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -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
|
||||
0
project/jni/sdl-2.0/.hgignore.orig
Normal file
0
project/jni/sdl-2.0/.hgignore.orig
Normal file
82
project/jni/sdl-2.0/.hgignore.rej
Normal file
82
project/jni/sdl-2.0/.hgignore.rej
Normal file
@@ -0,0 +1,82 @@
|
||||
--- .hgignore 2013-10-08 17:46:42.381361960 +0200
|
||||
+++ .hgignore 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,79 +0,0 @@
|
||||
-syntax:glob
|
||||
-autom4te*
|
||||
-config.cache
|
||||
-config.log
|
||||
-config.status
|
||||
-Makefile
|
||||
-sdl-config
|
||||
-SDL2.spec
|
||||
-build
|
||||
-
|
||||
-# for Xcode
|
||||
-*.orig
|
||||
-*.swp
|
||||
-*.tmp
|
||||
-*.rej
|
||||
-*~
|
||||
-*.o
|
||||
-*.mode1*
|
||||
-*.model*
|
||||
-*.perspective*
|
||||
-*.perspective*
|
||||
-*.pbxuser
|
||||
-(^|/)build($|/)
|
||||
-.DS_Store
|
||||
-
|
||||
-# for Visual C++
|
||||
-Debug
|
||||
-Release
|
||||
-*.user
|
||||
-*.ncb
|
||||
-*.suo
|
||||
-
|
||||
-sdl.pc
|
||||
-test/autom4te*
|
||||
-test/config.cache
|
||||
-test/config.log
|
||||
-test/config.status
|
||||
-test/Makefile
|
||||
-test/SDL2.dll
|
||||
-test/checkkeys
|
||||
-test/loopwave
|
||||
-test/testatomic
|
||||
-test/testaudioinfo
|
||||
-test/testdraw2
|
||||
-test/testerror
|
||||
-test/testfile
|
||||
-test/testgesture
|
||||
-test/testgl2
|
||||
-test/testgles
|
||||
-test/testhaptic
|
||||
-test/testiconv
|
||||
-test/testime
|
||||
-test/testintersections
|
||||
-test/testjoystick
|
||||
-test/testkeys
|
||||
-test/testloadso
|
||||
-test/testlock
|
||||
-test/testmultiaudio
|
||||
-test/testnative
|
||||
-test/testoverlay2
|
||||
-test/testplatform
|
||||
-test/testpower
|
||||
-test/testrendertarget
|
||||
-test/testresample
|
||||
-test/testrumble
|
||||
-test/testscale
|
||||
-test/testsem
|
||||
-test/testshader
|
||||
-test/testshape
|
||||
-test/testsprite2
|
||||
-test/testspriteminimal
|
||||
-test/teststreaming
|
||||
-test/testthread
|
||||
-test/testtimer
|
||||
-test/testver
|
||||
-test/testwm2
|
||||
-test/torturethread
|
||||
-test/*.exe
|
||||
-test/*.dSYM
|
||||
0
project/jni/sdl-2.0/.hgtags.orig
Normal file
0
project/jni/sdl-2.0/.hgtags.orig
Normal file
18
project/jni/sdl-2.0/.hgtags.rej
Normal file
18
project/jni/sdl-2.0/.hgtags.rej
Normal file
@@ -0,0 +1,18 @@
|
||||
--- .hgtags 2013-10-08 17:46:42.381361960 +0200
|
||||
+++ .hgtags 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,15 +0,0 @@
|
||||
-0afe0e38e02cf2048e93582f01c52fbb91d3c7bb release-1.2.7
|
||||
-230b156829ed13b31134d96f689c917981f57b84 release-1.2.5
|
||||
-27cab50ec9c746e886ce0f3fdaa0b0cdc55a594f release-1.2.11
|
||||
-2fe3fbd2bff50165b3cad33bf40d70b3bb3c9fd0 release-1.2.3
|
||||
-3c052d3bcc76c899dfd4846be76243a78e8c7180 release-1.2.4
|
||||
-3c5eed71a3320962551af3b3dfbee0c99fcf0086 release-1.2.10
|
||||
-4867f7f7dd3426d1dbbeef48b3f3b3aa19590cc4 release-1.2.12
|
||||
-6e28dae59e3baf4447c83e833a8d2ac912536f5b release-1.2.1
|
||||
-7c2589fb8d4df54c6faabd3faebd0c0e73f67879 release-1.2.13
|
||||
-86de11faf082881ad9b73a1a1d78733ca07f8db8 release-1.2.6
|
||||
-bb051fa871aa0b53ea57df56a446cec3bb85924c release-1.2.2
|
||||
-cfcb2e1c36ebe9809577adf768b0ec53e8768af9 release-1.2.8
|
||||
-e044e7c70a50a2f54d14ee20d0933e904e5853b6 release-1.2.9
|
||||
-f14cf9d71233934811774f941d0de121d5f96ccf release-1.2.14
|
||||
-39c22a953456f6c9e2c8993c8ff973824104102a pre-touch-removal
|
||||
0
project/jni/sdl-2.0/.indent.pro.orig
vendored
Normal file
0
project/jni/sdl-2.0/.indent.pro.orig
vendored
Normal file
4
project/jni/sdl-2.0/.indent.pro.rej
vendored
Normal file
4
project/jni/sdl-2.0/.indent.pro.rej
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
--- .indent.pro 2013-10-08 17:46:42.381361960 +0200
|
||||
+++ .indent.pro 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1 +0,0 @@
|
||||
--i4 -nut -nsc -br -ce -cdw -npcs
|
||||
49
project/jni/sdl-2.0/Android.mk
Executable file
49
project/jni/sdl-2.0/Android.mk
Executable file
@@ -0,0 +1,49 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL shared library
|
||||
#
|
||||
###########################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := SDL2
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_atomic.c \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
|
||||
$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/render/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/android/*.c))
|
||||
|
||||
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
|
||||
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
49
project/jni/sdl-2.0/Android.mk.orig
Executable file
49
project/jni/sdl-2.0/Android.mk.orig
Executable file
@@ -0,0 +1,49 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
###########################
|
||||
#
|
||||
# SDL shared library
|
||||
#
|
||||
###########################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := SDL2
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_atomic.c \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
|
||||
$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/render/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/android/*.c))
|
||||
|
||||
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
|
||||
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
103
project/jni/sdl-2.0/Android.mk.rej
Normal file
103
project/jni/sdl-2.0/Android.mk.rej
Normal file
@@ -0,0 +1,103 @@
|
||||
--- Android.mk 2013-10-08 17:46:42.381361960 +0200
|
||||
+++ Android.mk 2013-10-08 15:37:33.539950000 +0200
|
||||
@@ -1,46 +1,64 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
-###########################
|
||||
-#
|
||||
-# SDL shared library
|
||||
-#
|
||||
-###########################
|
||||
-
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
-LOCAL_MODULE := SDL2
|
||||
+LOCAL_MODULE := $(lastword $(subst /, ,$(LOCAL_PATH)))
|
||||
+
|
||||
+ifndef SDL_JAVA_PACKAGE_PATH
|
||||
+$(error Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles")
|
||||
+endif
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
+LOCAL_CFLAGS := -O3 -D__ANDROID__ -DANDROID \
|
||||
+ -DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) \
|
||||
+ -DSDL_CURDIR_PATH=\"$(SDL_CURDIR_PATH)\" \
|
||||
+ -DSDL_TRACKBALL_KEYUP_DELAY=$(SDL_TRACKBALL_KEYUP_DELAY) \
|
||||
+ -DSDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT=$(SDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT) \
|
||||
+ -DSDL_VIDEO_RENDER_RESIZE=$(SDL_VIDEO_RENDER_RESIZE) \
|
||||
+ $(SDL_ADDITIONAL_CFLAGS)
|
||||
+
|
||||
+
|
||||
+SDL_SRCS := \
|
||||
+ src/*.c \
|
||||
+ src/audio/*.c \
|
||||
+ src/cdrom/*.c \
|
||||
+ src/cpuinfo/*.c \
|
||||
+ src/events/*.c \
|
||||
+ src/file/*.c \
|
||||
+ src/haptic/*.c \
|
||||
+ src/joystick/*.c \
|
||||
+ src/stdlib/*.c \
|
||||
+ src/thread/*.c \
|
||||
+ src/timer/*.c \
|
||||
+ src/video/*.c \
|
||||
+ src/main/*.c \
|
||||
+ src/power/*.c \
|
||||
+ src/thread/pthread/*.c \
|
||||
+ src/timer/unix/*.c \
|
||||
+ src/audio/android/*.c \
|
||||
+ src/cdrom/dummy/*.c \
|
||||
+ src/video/android/*.c \
|
||||
+ src/haptic/dummy/*.c \
|
||||
+ src/loadso/dlopen/*.c \
|
||||
+ src/atomic/*.c \
|
||||
+ src/render/*.c \
|
||||
+ src/render/opengles/*.c \
|
||||
+ src/render/software/*.c
|
||||
+
|
||||
+
|
||||
+# TODO: use libcutils for atomic operations, but it's not included in NDK
|
||||
+
|
||||
+# src/atomic/linux/*.c \
|
||||
+# src/power/linux/*.c \
|
||||
+# src/joystick/android/*.c \
|
||||
+# src/haptic/android/*.c \
|
||||
+# src/libm/*.c \
|
||||
+
|
||||
+LOCAL_CPP_EXTENSION := .cpp
|
||||
|
||||
-LOCAL_SRC_FILES := \
|
||||
- $(subst $(LOCAL_PATH)/,, \
|
||||
- $(wildcard $(LOCAL_PATH)/src/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/audio/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
|
||||
- $(LOCAL_PATH)/src/atomic/SDL_atomic.c \
|
||||
- $(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
|
||||
- $(wildcard $(LOCAL_PATH)/src/core/android/*.cpp) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/events/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/file/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/power/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/render/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/thread/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/timer/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/video/*.c) \
|
||||
- $(wildcard $(LOCAL_PATH)/src/video/android/*.c))
|
||||
+# Note this "simple" makefile var substitution, you can find even more complex examples in different Android projects
|
||||
+LOCAL_SRC_FILES := $(foreach F, $(SDL_SRCS), $(addprefix $(dir $(F)),$(notdir $(wildcard $(LOCAL_PATH)/$(F)))))
|
||||
|
||||
-LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
|
||||
-LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog
|
||||
+LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
18
project/jni/sdl-2.0/BUGS
Normal file
18
project/jni/sdl-2.0/BUGS
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
Bugs are now managed in the SDL bug tracker, here:
|
||||
|
||||
http://bugzilla.libsdl.org/
|
||||
|
||||
You may report bugs there, and search to see if a given issue has already
|
||||
been reported, discussed, and maybe even fixed.
|
||||
|
||||
|
||||
|
||||
You may also find help at the SDL mailing list. Subscription information:
|
||||
|
||||
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
|
||||
|
||||
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.
|
||||
|
||||
|
||||
16
project/jni/sdl-2.0/BUGS.txt
Normal file
16
project/jni/sdl-2.0/BUGS.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Bugs are now managed in the SDL bug tracker, here:
|
||||
|
||||
http://bugzilla.libsdl.org/
|
||||
|
||||
You may report bugs there, and search to see if a given issue has already
|
||||
been reported, discussed, and maybe even fixed.
|
||||
|
||||
|
||||
You may also find help on the SDL mailing list. Subscription information:
|
||||
|
||||
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
|
||||
|
||||
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.
|
||||
|
||||
19
project/jni/sdl-2.0/COPYING
Normal file
19
project/jni/sdl-2.0/COPYING
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
20
project/jni/sdl-2.0/COPYING.txt
Normal file
20
project/jni/sdl-2.0/COPYING.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
73
project/jni/sdl-2.0/CREDITS
Normal file
73
project/jni/sdl-2.0/CREDITS
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
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
|
||||
|
||||
* Darren Alton for port of SDL to the Nintendo DS 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>
|
||||
|
||||
51
project/jni/sdl-2.0/CREDITS.txt
Normal file
51
project/jni/sdl-2.0/CREDITS.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
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*
|
||||
|
||||
* Ryan Gordon for helping everybody out and keeping the dream alive. :)
|
||||
|
||||
* Gabriel Jacobo for his work on the Android port and generally helping out all around.
|
||||
|
||||
* Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches.
|
||||
|
||||
* Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code.
|
||||
|
||||
* Mike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve.
|
||||
|
||||
* Alfred Reynolds for the game controller API and general (in)sanity
|
||||
|
||||
* Jørgen Tjernø for numerous magical Mac OS X fixes.
|
||||
|
||||
* Pierre-Loup Griffais for his deep knowledge of OpenGL drivers.
|
||||
|
||||
* Sheena Smith for many months of great work on the SDL wiki creating the API documentation and style guides.
|
||||
|
||||
* Paul Hunkin for his port of SDL to Android during the Google Summer of Code 2010.
|
||||
|
||||
* Eli Gottlieb for his work on shaped windows during the Google Summer of Code 2010.
|
||||
|
||||
* Jim Grandpre for his work on multi-touch and gesture recognition during
|
||||
the Google Summer of Code 2010.
|
||||
|
||||
* 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 his port of SDL to the iPhone and iPod Touch during the
|
||||
Google Summer of Code 2008.
|
||||
|
||||
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation.
|
||||
|
||||
* Everybody at Loki Software, Inc. for their great contributions!
|
||||
|
||||
And a big hand to everyone else who has contributed over the years.
|
||||
|
||||
THANKS! :)
|
||||
|
||||
-- Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
27
project/jni/sdl-2.0/INSTALL
Normal file
27
project/jni/sdl-2.0/INSTALL
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
To compile and install SDL:
|
||||
|
||||
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
|
||||
./autogen.sh to build the configure script.
|
||||
|
||||
1. Run './configure; make; make install'
|
||||
|
||||
If you are compiling for Windows using gcc, read the FAQ at:
|
||||
http://www.libsdl.org/faq.php?action=listentries&category=4#42
|
||||
|
||||
If you are compiling using Visual C++ on Win32, you should read
|
||||
the file VisualC.html
|
||||
|
||||
2. Look at the example programs in ./test, and check out the HTML
|
||||
documentation in ./docs to see how to use the SDL library.
|
||||
|
||||
3. Join the SDL developer mailing list by sending E-mail to
|
||||
sdl-request@libsdl.org
|
||||
and put "subscribe" in the subject of the message.
|
||||
|
||||
Or alternatively you can use the web interface:
|
||||
http://www.libsdl.org/mailing-list.php
|
||||
|
||||
That's it!
|
||||
Sam Lantinga <slouken@libsdl.org>
|
||||
40
project/jni/sdl-2.0/INSTALL.txt
Normal file
40
project/jni/sdl-2.0/INSTALL.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
To compile and install SDL:
|
||||
|
||||
1. Windows with Visual Studio:
|
||||
* Read VisualC.html
|
||||
|
||||
Windows with gcc, either native or cross-compiling:
|
||||
* Read the FAQ at http://wiki.libsdl.org/moin.fcg/FAQWindows
|
||||
* Run './configure; make; make install'
|
||||
|
||||
Mac OS X with Xcode:
|
||||
* Read README-macosx.txt
|
||||
|
||||
Mac OS X from the command line:
|
||||
* Run './configure; make; make install'
|
||||
|
||||
Linux and other UNIX systems:
|
||||
* Run './configure; make; make install'
|
||||
|
||||
Android:
|
||||
* Read README-android.txt
|
||||
|
||||
iOS:
|
||||
* Read README-ios.txt
|
||||
|
||||
Using Cmake:
|
||||
* Read README-cmake.txt
|
||||
|
||||
2. Look at the example programs in ./test, and check out the online
|
||||
documentation at http://wiki.libsdl.org/
|
||||
|
||||
3. Join the SDL developer mailing list by sending E-mail to
|
||||
sdl-request@libsdl.org
|
||||
and put "subscribe" in the subject of the message.
|
||||
|
||||
Or alternatively you can use the web interface:
|
||||
http://www.libsdl.org/mailing-list.php
|
||||
|
||||
That's it!
|
||||
Sam Lantinga <slouken@libsdl.org>
|
||||
0
project/jni/sdl-2.0/Makefile.ds.orig
Normal file
0
project/jni/sdl-2.0/Makefile.ds.orig
Normal file
234
project/jni/sdl-2.0/Makefile.ds.rej
Normal file
234
project/jni/sdl-2.0/Makefile.ds.rej
Normal file
@@ -0,0 +1,234 @@
|
||||
--- Makefile.ds 2013-10-08 17:46:42.384695327 +0200
|
||||
+++ Makefile.ds 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,231 +0,0 @@
|
||||
-#---------------------------------------------------------------------------------
|
||||
-.SUFFIXES:
|
||||
-#---------------------------------------------------------------------------------
|
||||
-
|
||||
-ifeq ($(strip $(DEVKITARM)),)
|
||||
-$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
-endif
|
||||
-
|
||||
-include $(DEVKITARM)/ds_rules
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-# TARGET is the name of the output
|
||||
-# BUILD is the directory where object files & intermediate files will be placed
|
||||
-# SOURCES is a list of directories containing source code
|
||||
-# DATA is a list of directories containing data files
|
||||
-# INCLUDES is a list of directories containing header files
|
||||
-#---------------------------------------------------------------------------------
|
||||
-TARGET := $(shell basename $(CURDIR))
|
||||
-BUILD := src
|
||||
-SOURCES := src
|
||||
-DATA := data
|
||||
-INCLUDES := include
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-# options for code generation
|
||||
-#---------------------------------------------------------------------------------
|
||||
-ARCH := -mthumb -mthumb-interwork \
|
||||
- -D__NDS__ -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" \
|
||||
- -DVERSION=\"2.0\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1
|
||||
-
|
||||
-CFLAGS := -g -Wall -Os\
|
||||
- -march=armv5te -mtune=arm946e-s \
|
||||
- -fomit-frame-pointer -ffast-math \
|
||||
- $(ARCH)
|
||||
-
|
||||
-CFLAGS += $(INCLUDE) -DARM9
|
||||
-CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
-
|
||||
-ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
||||
-LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
-
|
||||
-# Set to 0 to use a framer buffer, or 1 to use the GL like hardware
|
||||
-# renderer. Alas, both cannot be used at the same time for lack of
|
||||
-# display/texture memory.
|
||||
-USE_HW_RENDERER := 1
|
||||
-
|
||||
-ifeq ($(USE_HW_RENDERER),1)
|
||||
-CFLAGS += -DUSE_HW_RENDERER
|
||||
-else
|
||||
-endif
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-# list of directories containing libraries, this must be the top level containing
|
||||
-# include and lib
|
||||
-#---------------------------------------------------------------------------------
|
||||
-LIBDIRS := $(LIBNDS) $(PORTLIBS)
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-# no real need to edit anything past this point unless you need to add additional
|
||||
-# rules for different file extensions
|
||||
-#---------------------------------------------------------------------------------
|
||||
-ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
-#---------------------------------------------------------------------------------
|
||||
-
|
||||
-export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
|
||||
-
|
||||
-export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
- $(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
-
|
||||
-export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
-
|
||||
-CFILES := \
|
||||
- SDL.c \
|
||||
- SDL_assert.c \
|
||||
- SDL_error.c \
|
||||
- SDL_fatal.c \
|
||||
- SDL_hints.c \
|
||||
- SDL_log.c \
|
||||
- atomic/SDL_atomic.c \
|
||||
- atomic/SDL_spinlock.arm.c \
|
||||
- audio/SDL_audio.c \
|
||||
- audio/SDL_audiocvt.c \
|
||||
- audio/SDL_audiodev.c \
|
||||
- audio/SDL_audiotypecvt.c \
|
||||
- audio/SDL_mixer.c \
|
||||
- audio/SDL_wave.c \
|
||||
- audio/nds/SDL_ndsaudio.c \
|
||||
- cpuinfo/SDL_cpuinfo.c \
|
||||
- events/SDL_events.c \
|
||||
- events/SDL_keyboard.c \
|
||||
- events/SDL_mouse.c \
|
||||
- events/SDL_quit.c \
|
||||
- events/SDL_touch.c \
|
||||
- events/SDL_windowevents.c \
|
||||
- events/nds/SDL_ndsgesture.c \
|
||||
- file/SDL_rwops.c \
|
||||
- haptic/SDL_haptic.c \
|
||||
- haptic/nds/SDL_syshaptic.c \
|
||||
- joystick/SDL_joystick.c \
|
||||
- joystick/nds/SDL_sysjoystick.c \
|
||||
- power/SDL_power.c \
|
||||
- power/nds/SDL_syspower.c \
|
||||
- render/SDL_render.c \
|
||||
- render/SDL_yuv_sw.c \
|
||||
- render/nds/SDL_ndsrender.c \
|
||||
- render/nds/SDL_libgl2D.c \
|
||||
- render/software/SDL_blendfillrect.c \
|
||||
- render/software/SDL_blendline.c \
|
||||
- render/software/SDL_blendpoint.c \
|
||||
- render/software/SDL_drawline.c \
|
||||
- render/software/SDL_drawpoint.c \
|
||||
- render/software/SDL_render_sw.c \
|
||||
- stdlib/SDL_getenv.c \
|
||||
- stdlib/SDL_iconv.c \
|
||||
- stdlib/SDL_malloc.c \
|
||||
- stdlib/SDL_qsort.c \
|
||||
- stdlib/SDL_stdlib.c \
|
||||
- stdlib/SDL_string.c \
|
||||
- thread/SDL_thread.c \
|
||||
- thread/nds/SDL_syscond.c \
|
||||
- thread/nds/SDL_sysmutex.c \
|
||||
- thread/nds/SDL_syssem.c \
|
||||
- thread/nds/SDL_systhread.c \
|
||||
- timer/SDL_timer.c \
|
||||
- timer/nds/SDL_systimer.c \
|
||||
- video/SDL_RLEaccel.c \
|
||||
- video/SDL_blit.c \
|
||||
- video/SDL_blit_0.c \
|
||||
- video/SDL_blit_1.c \
|
||||
- video/SDL_blit_A.c \
|
||||
- video/SDL_blit_N.c \
|
||||
- video/SDL_blit_auto.c \
|
||||
- video/SDL_blit_copy.c \
|
||||
- video/SDL_blit_slow.c \
|
||||
- video/SDL_bmp.c \
|
||||
- video/SDL_clipboard.c \
|
||||
- video/SDL_fillrect.c \
|
||||
- video/SDL_pixels.c \
|
||||
- video/SDL_rect.c \
|
||||
- video/SDL_stretch.c \
|
||||
- video/SDL_surface.c \
|
||||
- video/SDL_video.c \
|
||||
- video/nds/SDL_ndsevents.c \
|
||||
- video/nds/SDL_ndsvideo.c \
|
||||
- video/nds/SDL_ndswindow.c
|
||||
-
|
||||
-
|
||||
-#CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
-#SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
-#BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-# use CXX for linking C++ projects, CC for standard C
|
||||
-#---------------------------------------------------------------------------------
|
||||
-ifeq ($(strip $(CPPFILES)),)
|
||||
-#---------------------------------------------------------------------------------
|
||||
- export LD := $(CC)
|
||||
-#---------------------------------------------------------------------------------
|
||||
-else
|
||||
-#---------------------------------------------------------------------------------
|
||||
- export LD := $(CXX)
|
||||
-#---------------------------------------------------------------------------------
|
||||
-endif
|
||||
-#---------------------------------------------------------------------------------
|
||||
-
|
||||
-export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
- $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
-
|
||||
-export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
- $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
- -I$(CURDIR)/$(BUILD) \
|
||||
- -I$(PORTLIBS)/include/SDL
|
||||
-
|
||||
-.PHONY: $(BUILD) clean all
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-all: arm_only $(BUILD) install nds_test
|
||||
-
|
||||
-lib:
|
||||
- @[ -d $@ ] || mkdir -p $@
|
||||
-
|
||||
-$(BUILD): lib
|
||||
- @[ -d $@ ] || mkdir -p $@
|
||||
- @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.ds -s
|
||||
-
|
||||
-install: $(BUILD)
|
||||
- @mkdir -p $(PORTLIBS)/include/SDL/
|
||||
- @rsync -a $(OUTPUT) $(PORTLIBS)/lib/
|
||||
- @rsync -a include/*.h $(PORTLIBS)/include/SDL/
|
||||
-
|
||||
-nds_test:
|
||||
- $(MAKE) -C test/nds-test-progs -s
|
||||
-
|
||||
-tags:
|
||||
- cd $(SOURCES); etags $(CFILES)
|
||||
-
|
||||
-# This file must be compiled with the ARM instruction set, not
|
||||
-# thumb. Use devkitpro way of doing things.
|
||||
-arm_only: src/atomic/SDL_spinlock.arm.c
|
||||
-src/atomic/SDL_spinlock.arm.c: src/atomic/SDL_spinlock.c
|
||||
- @cp $< $@
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-clean:
|
||||
- @echo clean ...
|
||||
- @cd src; rm -fr $(OFILES) $(OFILES:.o=.d) lib
|
||||
- @rm -f $(OUTPUT)
|
||||
- @make -C test/nds-test-progs -s clean
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-else
|
||||
-
|
||||
-DEPENDS := $(OFILES:.o=.d)
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-# main targets
|
||||
-#---------------------------------------------------------------------------------
|
||||
-$(OUTPUT) : $(OFILES)
|
||||
-
|
||||
-#---------------------------------------------------------------------------------
|
||||
-%.bin.o : %.bin
|
||||
-#---------------------------------------------------------------------------------
|
||||
- @echo $(notdir $<)
|
||||
- @$(bin2o)
|
||||
-
|
||||
-
|
||||
--include $(DEPENDS)
|
||||
-
|
||||
-#---------------------------------------------------------------------------------------
|
||||
-endif
|
||||
-#---------------------------------------------------------------------------------------
|
||||
0
project/jni/sdl-2.0/Makefile.in.orig
Normal file
0
project/jni/sdl-2.0/Makefile.in.orig
Normal file
228
project/jni/sdl-2.0/Makefile.in.rej
Normal file
228
project/jni/sdl-2.0/Makefile.in.rej
Normal file
@@ -0,0 +1,228 @@
|
||||
--- Makefile.in 2013-10-08 17:46:42.384695327 +0200
|
||||
+++ Makefile.in 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,225 +0,0 @@
|
||||
-# Makefile to build and install the SDL library
|
||||
-
|
||||
-top_builddir = .
|
||||
-srcdir = @srcdir@
|
||||
-objects = build
|
||||
-prefix = @prefix@
|
||||
-exec_prefix = @exec_prefix@
|
||||
-bindir = @bindir@
|
||||
-libdir = @libdir@
|
||||
-includedir = @includedir@
|
||||
-datarootdir = @datarootdir@
|
||||
-datadir = @datadir@
|
||||
-auxdir = @ac_aux_dir@
|
||||
-distpath = $(srcdir)/..
|
||||
-distdir = SDL2-@SDL_VERSION@
|
||||
-distfile = $(distdir).tar.gz
|
||||
-
|
||||
-@SET_MAKE@
|
||||
-SHELL = @SHELL@
|
||||
-CC = @CC@
|
||||
-INCLUDE = @INCLUDE@
|
||||
-CFLAGS = @BUILD_CFLAGS@
|
||||
-EXTRA_CFLAGS = @EXTRA_CFLAGS@
|
||||
-LDFLAGS = @BUILD_LDFLAGS@
|
||||
-EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
|
||||
-LIBTOOL = @LIBTOOL@
|
||||
-INSTALL = @INSTALL@
|
||||
-AR = @AR@
|
||||
-RANLIB = @RANLIB@
|
||||
-WINDRES = @WINDRES@
|
||||
-
|
||||
-TARGET = libSDL2.la
|
||||
-OBJECTS = @OBJECTS@
|
||||
-VERSION_OBJECTS = @VERSION_OBJECTS@
|
||||
-
|
||||
-SDLMAIN_TARGET = libSDL2main.a
|
||||
-SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
|
||||
-
|
||||
-SRC_DIST = acinclude Android.mk autogen.sh BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README* sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test TODO VisualC.html VisualC VisualCE WhatsNew Xcode Xcode-iOS
|
||||
-GEN_DIST = SDL2.spec
|
||||
-
|
||||
-HDRS = \
|
||||
- SDL.h \
|
||||
- SDL_assert.h \
|
||||
- SDL_atomic.h \
|
||||
- SDL_audio.h \
|
||||
- SDL_blendmode.h \
|
||||
- SDL_clipboard.h \
|
||||
- SDL_cpuinfo.h \
|
||||
- SDL_endian.h \
|
||||
- SDL_error.h \
|
||||
- SDL_events.h \
|
||||
- SDL_gesture.h \
|
||||
- SDL_haptic.h \
|
||||
- SDL_hints.h \
|
||||
- SDL_input.h \
|
||||
- SDL_joystick.h \
|
||||
- SDL_keyboard.h \
|
||||
- SDL_keycode.h \
|
||||
- SDL_loadso.h \
|
||||
- SDL_log.h \
|
||||
- SDL_main.h \
|
||||
- SDL_mouse.h \
|
||||
- SDL_mutex.h \
|
||||
- SDL_name.h \
|
||||
- SDL_opengl.h \
|
||||
- SDL_opengles.h \
|
||||
- SDL_opengles2.h \
|
||||
- SDL_pixels.h \
|
||||
- SDL_platform.h \
|
||||
- SDL_power.h \
|
||||
- SDL_quit.h \
|
||||
- SDL_rect.h \
|
||||
- SDL_render.h \
|
||||
- SDL_rwops.h \
|
||||
- SDL_scancode.h \
|
||||
- SDL_shape.h \
|
||||
- SDL_stdinc.h \
|
||||
- SDL_surface.h \
|
||||
- SDL_syswm.h \
|
||||
- SDL_thread.h \
|
||||
- SDL_timer.h \
|
||||
- SDL_touch.h \
|
||||
- SDL_types.h \
|
||||
- SDL_version.h \
|
||||
- SDL_video.h \
|
||||
- begin_code.h \
|
||||
- close_code.h
|
||||
-
|
||||
-LT_AGE = @LT_AGE@
|
||||
-LT_CURRENT = @LT_CURRENT@
|
||||
-LT_RELEASE = @LT_RELEASE@
|
||||
-LT_REVISION = @LT_REVISION@
|
||||
-LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
-
|
||||
-all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
|
||||
-
|
||||
-$(srcdir)/configure: $(srcdir)/configure.in
|
||||
- @echo "Warning, configure.in is out of date"
|
||||
- #(cd $(srcdir) && sh autogen.sh && sh configure)
|
||||
- @sleep 3
|
||||
-
|
||||
-Makefile: $(srcdir)/Makefile.in
|
||||
- $(SHELL) config.status $@
|
||||
-
|
||||
-Makefile.in:;
|
||||
-
|
||||
-$(objects):
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $@
|
||||
-
|
||||
-update-revision:
|
||||
- $(SHELL) $(auxdir)/updaterev.sh
|
||||
-
|
||||
-.PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d)
|
||||
-
|
||||
-$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS)
|
||||
- $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
|
||||
-
|
||||
-$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
|
||||
- $(AR) cru $@ $(SDLMAIN_OBJECTS)
|
||||
- $(RANLIB) $@
|
||||
-
|
||||
-install: all install-bin install-hdrs install-lib install-data
|
||||
-install-bin:
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
|
||||
- $(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config
|
||||
-install-hdrs: update-revision
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2
|
||||
- for file in $(HDRS); do \
|
||||
- $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \
|
||||
- done
|
||||
- $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h
|
||||
- if test -f include/SDL_revision.h; then \
|
||||
- $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
|
||||
- else \
|
||||
- $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \
|
||||
- fi
|
||||
-
|
||||
-install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
|
||||
- $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
|
||||
- $(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
|
||||
- $(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
|
||||
-install-data:
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
|
||||
- $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
|
||||
- $(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig
|
||||
-
|
||||
-uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
|
||||
-uninstall-bin:
|
||||
- rm -f $(DESTDIR)$(bindir)/sdl2-config
|
||||
-uninstall-hdrs:
|
||||
- for file in $(HDRS); do \
|
||||
- rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \
|
||||
- done
|
||||
- rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h
|
||||
- rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h
|
||||
- -rmdir $(DESTDIR)$(includedir)/SDL2
|
||||
-uninstall-lib:
|
||||
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
|
||||
- rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
|
||||
-uninstall-data:
|
||||
- rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
|
||||
- rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
|
||||
-
|
||||
-clean:
|
||||
- rm -rf $(objects)
|
||||
- if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
|
||||
-
|
||||
-distclean: clean
|
||||
- rm -f Makefile Makefile.rules sdl2-config
|
||||
- rm -f config.status config.cache config.log libtool
|
||||
- rm -rf $(srcdir)/autom4te*
|
||||
- find $(srcdir) \( \
|
||||
- -name '*~' -o \
|
||||
- -name '*.bak' -o \
|
||||
- -name '*.old' -o \
|
||||
- -name '*.rej' -o \
|
||||
- -name '*.orig' -o \
|
||||
- -name '.#*' \) \
|
||||
- -exec rm -f {} \;
|
||||
- if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
|
||||
-
|
||||
-dist $(distfile):
|
||||
- $(SHELL) $(auxdir)/mkinstalldirs $(distdir)
|
||||
- (cd $(srcdir); tar cf - $(SRC_DIST)) | (cd $(distdir); tar xf -)
|
||||
- tar cf - $(GEN_DIST) | (cd $(distdir); tar xf -)
|
||||
- find $(distdir) \( \
|
||||
- -name '*~' -o \
|
||||
- -name '*.bak' -o \
|
||||
- -name '*.old' -o \
|
||||
- -name '*.rej' -o \
|
||||
- -name '*.orig' -o \
|
||||
- -name '.#*' \) \
|
||||
- -exec rm -f {} \;
|
||||
- if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
|
||||
- tar cvf - $(distdir) | gzip --best >$(distfile)
|
||||
- rm -rf $(distdir)
|
||||
-
|
||||
-rpm: $(distfile)
|
||||
- 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
|
||||
91
project/jni/sdl-2.0/Makefile.psp
Normal file
91
project/jni/sdl-2.0/Makefile.psp
Normal file
@@ -0,0 +1,91 @@
|
||||
TARGET_LIB = libSDL2.a
|
||||
OBJS= src/SDL.o \
|
||||
src/SDL_assert.o \
|
||||
src/SDL_error.o \
|
||||
src/SDL_hints.o \
|
||||
src/SDL_log.o \
|
||||
src/atomic/SDL_atomic.o \
|
||||
src/atomic/SDL_spinlock.o \
|
||||
src/audio/SDL_audio.o \
|
||||
src/audio/SDL_audiocvt.o \
|
||||
src/audio/SDL_audiodev.o \
|
||||
src/audio/SDL_audiotypecvt.o \
|
||||
src/audio/SDL_mixer.o \
|
||||
src/audio/SDL_wave.o \
|
||||
src/audio/psp/SDL_pspaudio.o \
|
||||
src/cpuinfo/SDL_cpuinfo.o \
|
||||
src/events/SDL_clipboardevents.o \
|
||||
src/events/SDL_dropevents.o \
|
||||
src/events/SDL_events.o \
|
||||
src/events/SDL_gesture.o \
|
||||
src/events/SDL_keyboard.o \
|
||||
src/events/SDL_mouse.o \
|
||||
src/events/SDL_quit.o \
|
||||
src/events/SDL_touch.o \
|
||||
src/events/SDL_windowevents.o \
|
||||
src/file/SDL_rwops.o \
|
||||
src/haptic/SDL_haptic.o \
|
||||
src/haptic/dummy/SDL_syshaptic.o \
|
||||
src/joystick/SDL_joystick.o \
|
||||
src/joystick/SDL_gamecontroller.o \
|
||||
src/joystick/psp/SDL_sysjoystick.o \
|
||||
src/power/SDL_power.o \
|
||||
src/power/psp/SDL_syspower.o \
|
||||
src/render/SDL_render.o \
|
||||
src/render/SDL_yuv_sw.o \
|
||||
src/render/psp/SDL_render_psp.o \
|
||||
src/render/software/SDL_blendfillrect.o \
|
||||
src/render/software/SDL_blendline.o \
|
||||
src/render/software/SDL_blendpoint.o \
|
||||
src/render/software/SDL_drawline.o \
|
||||
src/render/software/SDL_drawpoint.o \
|
||||
src/render/software/SDL_render_sw.o \
|
||||
src/render/software/SDL_rotate.o \
|
||||
src/stdlib/SDL_getenv.o \
|
||||
src/stdlib/SDL_iconv.o \
|
||||
src/stdlib/SDL_malloc.o \
|
||||
src/stdlib/SDL_qsort.o \
|
||||
src/stdlib/SDL_stdlib.o \
|
||||
src/stdlib/SDL_string.o \
|
||||
src/thread/SDL_thread.o \
|
||||
src/thread/psp/SDL_syssem.o \
|
||||
src/thread/psp/SDL_systhread.o \
|
||||
src/thread/psp/SDL_sysmutex.o \
|
||||
src/thread/psp/SDL_syscond.o \
|
||||
src/timer/SDL_timer.o \
|
||||
src/timer/psp/SDL_systimer.o \
|
||||
src/video/SDL_RLEaccel.o \
|
||||
src/video/SDL_blit.o \
|
||||
src/video/SDL_blit_0.o \
|
||||
src/video/SDL_blit_1.o \
|
||||
src/video/SDL_blit_A.o \
|
||||
src/video/SDL_blit_N.o \
|
||||
src/video/SDL_blit_auto.o \
|
||||
src/video/SDL_blit_copy.o \
|
||||
src/video/SDL_blit_slow.o \
|
||||
src/video/SDL_bmp.o \
|
||||
src/video/SDL_clipboard.o \
|
||||
src/video/SDL_fillrect.o \
|
||||
src/video/SDL_pixels.o \
|
||||
src/video/SDL_rect.o \
|
||||
src/video/SDL_stretch.o \
|
||||
src/video/SDL_surface.o \
|
||||
src/video/SDL_video.o \
|
||||
src/video/psp/SDL_pspevents.o \
|
||||
src/video/psp/SDL_pspvideo.o \
|
||||
src/video/psp/SDL_pspgl.o \
|
||||
src/video/psp/SDL_pspmouse.o \
|
||||
|
||||
INCDIR = ./include
|
||||
CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL
|
||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
LIBDIR =
|
||||
LIBS = -lGL -lGLU -lglut -lz \
|
||||
-lpspvfpu -lpsphprm -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgum -lpspgu -lpspaudiolib -lpspaudio -lpsphttp -lpspssl -lpspwlan \
|
||||
-lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -lpspvram
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
||||
45
project/jni/sdl-2.0/README
Normal file
45
project/jni/sdl-2.0/README
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
Simple DirectMedia Layer
|
||||
|
||||
(SDL)
|
||||
|
||||
Version 2.0
|
||||
|
||||
---
|
||||
http://www.libsdl.org/
|
||||
|
||||
This is the Simple DirectMedia Layer, a general API that provides low
|
||||
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
||||
and 2D framebuffer across multiple platforms.
|
||||
|
||||
The current version supports Windows, Windows CE, Mac OS X, Linux, FreeBSD,
|
||||
NetBSD, OpenBSD, BSD/OS, Solaris, iOS, and Android. The code contains
|
||||
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
|
||||
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
|
||||
Go, Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||
Pike, Pliant, Python, Ruby, and Smalltalk.
|
||||
|
||||
This library is distributed under the zlib license, which can be found
|
||||
in the file "COPYING".
|
||||
|
||||
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 header files and test programs are well commented and always up to date.
|
||||
More documentation is available in HTML format in "docs/index.html", and
|
||||
a documentation wiki is available online at:
|
||||
http://www.libsdl.org/cgi/docwiki.cgi
|
||||
|
||||
The test programs in the "test" subdirectory are in the public domain.
|
||||
|
||||
Frequently asked questions are answered online:
|
||||
http://www.libsdl.org/faq.php
|
||||
|
||||
If you need help with the library, or just want to discuss SDL related
|
||||
issues, you can join the developers mailing list:
|
||||
http://www.libsdl.org/mailing-list.php
|
||||
|
||||
Enjoy!
|
||||
Sam Lantinga (slouken@libsdl.org)
|
||||
|
||||
13
project/jni/sdl-2.0/README-SDL.txt
Normal file
13
project/jni/sdl-2.0/README-SDL.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
Please distribute this file with the SDL runtime environment:
|
||||
|
||||
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
|
||||
emulators.
|
||||
|
||||
The Simple DirectMedia Layer library source code is available from:
|
||||
http://www.libsdl.org/
|
||||
|
||||
This library is distributed under the terms of the zlib license:
|
||||
http://www.zlib.net/zlib_license.html
|
||||
|
||||
384
project/jni/sdl-2.0/README-android.txt
Normal file
384
project/jni/sdl-2.0/README-android.txt
Normal file
@@ -0,0 +1,384 @@
|
||||
================================================================================
|
||||
Simple DirectMedia Layer for Android
|
||||
================================================================================
|
||||
|
||||
Requirements:
|
||||
|
||||
Android SDK (version 10 or later)
|
||||
http://developer.android.com/sdk/index.html
|
||||
|
||||
Android NDK r7 or later
|
||||
http://developer.android.com/sdk/ndk/index.html
|
||||
|
||||
Minimum API level supported by SDL: 10 (Android 2.3.3)
|
||||
|
||||
================================================================================
|
||||
How the port works
|
||||
================================================================================
|
||||
|
||||
- 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
|
||||
the SDL library
|
||||
- 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
|
||||
- This eventually produces a standard Android .apk package
|
||||
|
||||
The Android Java code implements an "Activity" and can be found in:
|
||||
android-project/src/org/libsdl/app/SDLActivity.java
|
||||
|
||||
The Java code loads your game code, the SDL shared library, and
|
||||
dispatches to native functions implemented in the SDL library:
|
||||
src/SDL_android.c
|
||||
|
||||
Your project must include some glue code that starts your main() routine:
|
||||
src/main/android/SDL_android_main.c
|
||||
|
||||
|
||||
================================================================================
|
||||
Building an app
|
||||
================================================================================
|
||||
|
||||
Instructions:
|
||||
1. Copy the android-project directory wherever you want to keep your projects
|
||||
and rename it to the name of your project.
|
||||
2. Move or symlink this SDL directory into the <project>/jni directory
|
||||
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
|
||||
|
||||
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:
|
||||
sdk.dir=PATH_TO_ANDROID_SDK
|
||||
6. Run 'ant debug' in android/project. This compiles the .java and eventually
|
||||
creates a .apk with the native code embedded
|
||||
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:
|
||||
|
||||
android-project/
|
||||
AndroidManifest.xml - package manifest. Among others, it contains the class name
|
||||
of the main Activity and the package name of the application.
|
||||
build.properties - empty
|
||||
build.xml - build description file, used by ant. The actual application name
|
||||
is specified here.
|
||||
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
|
||||
local.properties - holds the SDK path, you should change this to the path to your SDK
|
||||
jni/ - directory holding native code
|
||||
jni/Android.mk - Android makefile that can call recursively the Android.mk files
|
||||
in all subdirectories
|
||||
jni/SDL/ - (symlink to) directory holding the SDL library files
|
||||
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
||||
jni/src/ - directory holding your C/C++ source
|
||||
jni/src/Android.mk - Android makefile that you should customize to include your
|
||||
source code and any library references
|
||||
res/ - directory holding resources for your application
|
||||
res/drawable-* - directories holding icons for different phone hardware. Could be
|
||||
one dir called "drawable".
|
||||
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.
|
||||
res/values/strings.xml - strings used in your application, including the application name
|
||||
shown on the phone.
|
||||
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
|
||||
on this implementation.
|
||||
|
||||
|
||||
================================================================================
|
||||
Customizing your application name
|
||||
================================================================================
|
||||
|
||||
To customize your application name, edit AndroidManifest.xml and replace
|
||||
"org.libsdl.app" with an identifier for your product package.
|
||||
|
||||
Then create a Java class extending SDLActivity and place it in a directory
|
||||
under src matching your package, e.g.
|
||||
src/com/gamemaker/game/MyGame.java
|
||||
|
||||
Here's an example of a minimal class file:
|
||||
--- MyGame.java --------------------------
|
||||
package com.gamemaker.game;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
/*
|
||||
* A sample wrapper class that just calls SDLActivity
|
||||
*/
|
||||
|
||||
public class MyGame extends SDLActivity { }
|
||||
|
||||
------------------------------------------
|
||||
|
||||
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
|
||||
class, .e.g. "MyGame"
|
||||
|
||||
================================================================================
|
||||
Customizing your application icon
|
||||
================================================================================
|
||||
|
||||
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
|
||||
different screen sizes. These can be replaced with one dir called "drawable",
|
||||
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
|
||||
this icon filename.
|
||||
|
||||
================================================================================
|
||||
Loading assets
|
||||
================================================================================
|
||||
|
||||
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
|
||||
standard functions in SDL_rwops.h.
|
||||
|
||||
There are also a few Android specific functions that allow you to get other
|
||||
useful paths for saving and loading data:
|
||||
SDL_AndroidGetInternalStoragePath()
|
||||
SDL_AndroidGetExternalStorageState()
|
||||
SDL_AndroidGetExternalStoragePath()
|
||||
|
||||
See SDL_system.h for more details on these functions.
|
||||
|
||||
The asset packaging system will, by default, compress certain file extensions.
|
||||
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
|
||||
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
|
||||
may want to keep this fact in mind when building your APK, specially when large
|
||||
files are involved.
|
||||
For more information on which extensions get compressed by default and how to
|
||||
disable this behaviour, see for example:
|
||||
|
||||
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
|
||||
|
||||
================================================================================
|
||||
Pause / Resume behaviour
|
||||
================================================================================
|
||||
|
||||
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
|
||||
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
|
||||
(versus polling for a resume message).
|
||||
|
||||
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
|
||||
app can continue to operate as it was.
|
||||
|
||||
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
|
||||
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
|
||||
under iOS, if the OS can not restore your GL context it will just kill your app)
|
||||
|
||||
================================================================================
|
||||
Threads and the Java VM
|
||||
================================================================================
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
detach it.
|
||||
|
||||
================================================================================
|
||||
Using STL
|
||||
================================================================================
|
||||
|
||||
You can use STL in your project by creating an Application.mk file in the jni
|
||||
folder and adding the following line:
|
||||
APP_STL := stlport_static
|
||||
|
||||
For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
|
||||
|
||||
================================================================================
|
||||
Additional documentation
|
||||
================================================================================
|
||||
|
||||
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.
|
||||
|
||||
The best place to start is with docs/OVERVIEW.TXT
|
||||
|
||||
|
||||
================================================================================
|
||||
Using Eclipse
|
||||
================================================================================
|
||||
|
||||
First make sure that you've installed Eclipse and the Android extensions as described here:
|
||||
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:
|
||||
* File -> New -> Other
|
||||
* Select the Android -> Android Project wizard and click Next
|
||||
* Enter the name you'd like your project to have
|
||||
* Select "Create project from existing source" and browse for your project directory
|
||||
* Make sure the Build Target is set to Android 2.0
|
||||
* Click Finish
|
||||
|
||||
|
||||
================================================================================
|
||||
Using the emulator
|
||||
================================================================================
|
||||
|
||||
There are some good tips and tricks for getting the most out of the
|
||||
emulator here: http://developer.android.com/tools/devices/emulator.html
|
||||
|
||||
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.
|
||||
Using a real device works better.
|
||||
|
||||
================================================================================
|
||||
Troubleshooting
|
||||
================================================================================
|
||||
|
||||
You can create and run an emulator from the Eclipse IDE:
|
||||
* Window -> Android SDK and AVD Manager
|
||||
|
||||
You can see if adb can see any devices with the following command:
|
||||
adb devices
|
||||
|
||||
You can see the output of log messages on the default device with:
|
||||
adb logcat
|
||||
|
||||
You can push files to the device with:
|
||||
adb push local_file remote_path_and_file
|
||||
|
||||
You can push files to the SD Card at /sdcard, for example:
|
||||
adb push moose.dat /sdcard/moose.dat
|
||||
|
||||
You can see the files on the SD card with a shell command:
|
||||
adb shell ls /sdcard/
|
||||
|
||||
You can start a command shell on the default device with:
|
||||
adb shell
|
||||
|
||||
You can remove the library files of your project (and not the SDL lib files) with:
|
||||
ndk-build clean
|
||||
|
||||
You can do a build with the following command:
|
||||
ndk-build
|
||||
|
||||
You can see the complete command line that ndk-build is using by passing V=1 on the command line:
|
||||
ndk-build V=1
|
||||
|
||||
If your application crashes in native code, you can use addr2line to convert the
|
||||
addresses in the stack trace to lines in your code.
|
||||
|
||||
For example, if your crash looks like this:
|
||||
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): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
|
||||
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): #00 pc 0001c902 /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): #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.
|
||||
I run addr2line with the debug version of my code:
|
||||
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:
|
||||
000014bc
|
||||
|
||||
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:
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
__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
|
||||
"Application.mk" in the jni directory, with the following line in it:
|
||||
APP_OPTIM := debug
|
||||
|
||||
|
||||
================================================================================
|
||||
Memory debugging
|
||||
================================================================================
|
||||
|
||||
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:
|
||||
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
|
||||
... 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,
|
||||
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
|
||||
|
||||
Once valgrind is built, you can create a wrapper script to launch your
|
||||
application with it, changing org.libsdl.app to your package identifier:
|
||||
--- start_valgrind_app -------------------
|
||||
#!/system/bin/sh
|
||||
export TMPDIR=/data/data/org.libsdl.app
|
||||
exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
|
||||
------------------------------------------
|
||||
|
||||
Then push it to the device:
|
||||
adb push start_valgrind_app /data/local
|
||||
|
||||
and make it executable:
|
||||
adb shell chmod 755 /data/local/start_valgrind_app
|
||||
|
||||
and tell Android to use the script to launch your application:
|
||||
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
|
||||
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
|
||||
|
||||
You can then launch your application normally and waaaaaaaiiittt for it.
|
||||
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
|
||||
output file:
|
||||
adb pull /sdcard/valgrind.log
|
||||
|
||||
When you're done instrumenting with valgrind, you can disable the wrapper:
|
||||
adb shell setprop wrap.org.libsdl.app ""
|
||||
|
||||
================================================================================
|
||||
Why is API level 10 the minimum required?
|
||||
================================================================================
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
has since then been obsoleted, with the recommendation to developers to bump the
|
||||
required API level to 10.
|
||||
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
|
||||
higher (March 2013).
|
||||
|
||||
================================================================================
|
||||
A note regarding the use 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
|
||||
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
|
||||
contexts, in particular the use of the eglSwapBuffers function. As stated in the
|
||||
documentation for the function "The contents of ancillary buffers are always
|
||||
undefined after calling eglSwapBuffers".
|
||||
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
|
||||
17+, so the only workaround available on this platform is to redraw the entire
|
||||
screen each frame.
|
||||
|
||||
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
|
||||
|
||||
================================================================================
|
||||
Known issues
|
||||
================================================================================
|
||||
|
||||
- TODO. I'm sure there's a bunch more stuff I haven't thought of
|
||||
31
project/jni/sdl-2.0/README-cmake.txt
Normal file
31
project/jni/sdl-2.0/README-cmake.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
================================================================================
|
||||
CMake build system for SDL (www.cmake.org)
|
||||
================================================================================
|
||||
|
||||
SDL's build system was traditionally based on autotools. Over time, this
|
||||
approach has suffered from several issues across the different supported
|
||||
platforms.
|
||||
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
|
||||
without complication.
|
||||
While still experimental, the build system should be usable on the following
|
||||
platforms:
|
||||
|
||||
* FreeBSD
|
||||
* Linux
|
||||
* VS.NET 2010
|
||||
* MinGW and Msys
|
||||
* OS X with support for XCode
|
||||
|
||||
================================================================================
|
||||
Usage
|
||||
================================================================================
|
||||
|
||||
Assuming the source for SDL is located at ~/sdl
|
||||
|
||||
cd ~
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../sdl
|
||||
|
||||
This will build the static and dynamic versions of SDL in the ~/build directory.
|
||||
106
project/jni/sdl-2.0/README-directfb.txt
Normal file
106
project/jni/sdl-2.0/README-directfb.txt
Normal file
@@ -0,0 +1,106 @@
|
||||
SDL on DirectFB
|
||||
|
||||
Supports:
|
||||
|
||||
- Hardware YUV overlays
|
||||
- OpenGL - software only
|
||||
- 2D/3D accelerations (depends on directfb driver)
|
||||
- multiple displays
|
||||
- windows
|
||||
|
||||
What you need:
|
||||
|
||||
DirectFB 1.0.1, 1.2.x, 1.3.0
|
||||
Kernel-Framebuffer support: required: vesafb, radeonfb ....
|
||||
Mesa 7.0.x - optional for OpenGL
|
||||
|
||||
/etc/directfbrc
|
||||
|
||||
This file should contain the following lines to make
|
||||
your joystick work and avoid crashes:
|
||||
------------------------
|
||||
disable-module=joystick
|
||||
disable-module=cle266
|
||||
disable-module=cyber5k
|
||||
no-linux-input-grab
|
||||
------------------------
|
||||
|
||||
To disable to use x11 backend when DISPLAY variable is found use
|
||||
|
||||
export SDL_DIRECTFB_X11_CHECK=0
|
||||
|
||||
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
|
||||
use
|
||||
|
||||
export SDL_DIRECTFB_LINUX_INPUT=0
|
||||
|
||||
To use hardware accelerated YUV-overlays for YUV-textures, use:
|
||||
|
||||
export SDL_DIRECTFB_YUV_DIRECT=1
|
||||
|
||||
This is disabled by default. It will only support one
|
||||
YUV texture, namely the first. Every other YUV texture will be
|
||||
rendered in software.
|
||||
|
||||
In addition, you may use (directfb-1.2.x)
|
||||
|
||||
export SDL_DIRECTFB_YUV_UNDERLAY=1
|
||||
|
||||
to make the YUV texture an underlay. This will make the cursor to
|
||||
be shown.
|
||||
|
||||
Simple Window Manager
|
||||
=====================
|
||||
|
||||
The driver has support for a very, very basic window manager you may
|
||||
want to use when running with "wm=default". Use
|
||||
|
||||
export SDL_DIRECTFB_WM=1
|
||||
|
||||
to enable basic window borders. In order to have the window title rendered,
|
||||
you need to have the following font installed:
|
||||
|
||||
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
||||
|
||||
OpenGL Support
|
||||
==============
|
||||
|
||||
The following instructions will give you *software* OpenGL. However this
|
||||
works at least on all directfb supported platforms.
|
||||
|
||||
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
|
||||
cd mesa
|
||||
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
|
||||
------------------------
|
||||
|
||||
Edit configs/linux-directfb so that the Directories-section looks like
|
||||
------------------------
|
||||
# Directories
|
||||
SRC_DIRS = mesa glu
|
||||
GLU_DIRS = sgi
|
||||
DRIVER_DIRS = directfb
|
||||
PROGRAM_DIRS =
|
||||
------------------------
|
||||
|
||||
make linux-directfb
|
||||
make
|
||||
|
||||
echo Installing - please enter sudo pw.
|
||||
|
||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||
cd src/mesa/drivers/directfb
|
||||
make
|
||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||
------------------------
|
||||
|
||||
To run the SDL - testprograms:
|
||||
|
||||
export SDL_VIDEODRIVER=directfb
|
||||
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
|
||||
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
|
||||
|
||||
./testgl
|
||||
|
||||
72
project/jni/sdl-2.0/README-gesture.txt
Normal file
72
project/jni/sdl-2.0/README-gesture.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
===========================================================================
|
||||
Dollar 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.
|
||||
|
||||
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:
|
||||
----------
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
event.dgesture.touchId - the Id of the touch used to record the gesture.
|
||||
event.dgesture.gestureId - the unique id of the recorded gesture.
|
||||
|
||||
|
||||
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:
|
||||
|
||||
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.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.
|
||||
|
||||
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).
|
||||
|
||||
|
||||
|
||||
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 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.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
SDL_LoadDollarTemplates returns the number of templates successfully loaded.
|
||||
|
||||
|
||||
|
||||
===========================================================================
|
||||
Multi 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:
|
||||
|
||||
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.y - the normalized y coordinate of the gesture. (0..1)
|
||||
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.numFingers - the number of fingers used in the gesture.
|
||||
|
||||
|
||||
===========================================================================
|
||||
Notes
|
||||
===========================================================================
|
||||
For a complete example see test/testgesture.c
|
||||
|
||||
Please direct questions/comments to:
|
||||
jim.tla+sdl_touch@gmail.com
|
||||
23
project/jni/sdl-2.0/README-hg.txt
Normal file
23
project/jni/sdl-2.0/README-hg.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
The latest development version of SDL is available via Mercurial.
|
||||
Mercurial 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
|
||||
source tree instead of waiting for an official release. Please look
|
||||
at the Mercurial website ( http://mercurial.selenic.com/ ) for more
|
||||
information on using hg, where you can also download software for
|
||||
Mac OS X, Windows, and Unix systems.
|
||||
|
||||
hg clone http://hg.libsdl.org/SDL
|
||||
|
||||
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.
|
||||
|
||||
If you are building SDL via configure, you will need to run autogen.sh
|
||||
before running configure.
|
||||
|
||||
There is a web interface to the subversion repository at:
|
||||
|
||||
http://hg.libsdl.org/SDL/
|
||||
|
||||
There is an RSS feed available at that URL, for those that want to
|
||||
track commits in real time.
|
||||
|
||||
222
project/jni/sdl-2.0/README-ios.txt
Normal file
222
project/jni/sdl-2.0/README-ios.txt
Normal file
@@ -0,0 +1,222 @@
|
||||
==============================================================================
|
||||
Building the Simple DirectMedia Layer for iPhone OS 2.0
|
||||
==============================================================================
|
||||
|
||||
Requirements: Mac OS X v10.5 or later and the iPhone SDK.
|
||||
|
||||
Instructions:
|
||||
1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in XCode.
|
||||
2. Select your desired target, and hit build.
|
||||
|
||||
There are three build targets:
|
||||
- libSDL.a:
|
||||
Build SDL as a statically linked library
|
||||
- testsdl
|
||||
Build a test program (there are known test failures which are fine)
|
||||
- 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.
|
||||
|
||||
==============================================================================
|
||||
Build SDL for iOS from the command line
|
||||
==============================================================================
|
||||
|
||||
1. cd (PATH WHERE THE SDL CODE IS)/build-scripts
|
||||
2. ./iosbuild.sh
|
||||
|
||||
If everything goes fine, you should see a build/ios directory, inside there's
|
||||
two directories "lib" and "include".
|
||||
"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.
|
||||
"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,
|
||||
armv6 for legacy devices, armv7, and i386 (for the simulator).
|
||||
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
|
||||
by setting the MIN_OS_VERSION variable, ie:
|
||||
|
||||
MIN_OS_VERSION=4.2 ./iosbuild.sh
|
||||
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer for iOS
|
||||
==============================================================================
|
||||
|
||||
FIXME: This needs to be updated for the latest methods
|
||||
|
||||
Here is the easiest method:
|
||||
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.
|
||||
2. Start a new project using the template. The project should be immediately ready for use with SDL.
|
||||
|
||||
Here is a more manual method:
|
||||
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.
|
||||
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.
|
||||
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
|
||||
==============================================================================
|
||||
|
||||
On iOS the application goes through a fixed life cycle and you will get
|
||||
notifications of state changes via application events. When these events
|
||||
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.
|
||||
|
||||
e.g.
|
||||
|
||||
int HandleAppEvents(void *userdata, SDL_Event *event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case SDL_APP_TERMINATING:
|
||||
/* Terminate the app.
|
||||
Shut everything down before returning from this function.
|
||||
*/
|
||||
return 0;
|
||||
case SDL_APP_LOWMEMORY:
|
||||
/* You will get this when your app is paused and iOS wants more memory.
|
||||
Release as much memory as possible.
|
||||
*/
|
||||
return 0;
|
||||
case SDL_APP_WILLENTERBACKGROUND:
|
||||
/* 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.
|
||||
*/
|
||||
return 0;
|
||||
case SDL_APP_DIDENTERBACKGROUND:
|
||||
/* 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.
|
||||
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.
|
||||
*/
|
||||
return 0;
|
||||
case SDL_APP_WILLENTERFOREGROUND:
|
||||
/* This call happens when your app is coming back to the foreground.
|
||||
Restore all your state here.
|
||||
*/
|
||||
return 0;
|
||||
case SDL_APP_DIDENTERFOREGROUND:
|
||||
/* Restart your loops here.
|
||||
Your app is interactive and getting CPU again.
|
||||
*/
|
||||
return 0;
|
||||
default:
|
||||
/* No special processing, add it to the event queue */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_SetEventFilter(HandleAppEvents, NULL);
|
||||
|
||||
... run your main loop
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
==============================================================================
|
||||
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.
|
||||
|
||||
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
|
||||
==============================================================================
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
==============================================================================
|
||||
Notes -- Keyboard
|
||||
==============================================================================
|
||||
|
||||
The SDL keyboard API has been extended to support on-screen keyboards:
|
||||
|
||||
void SDL_StartTextInput()
|
||||
-- enables text events and reveals the onscreen keyboard.
|
||||
void SDL_StopTextInput()
|
||||
-- disables text events and hides the onscreen keyboard.
|
||||
SDL_bool SDL_IsTextInputActive()
|
||||
-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
|
||||
|
||||
==============================================================================
|
||||
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.
|
||||
|
||||
Once your application is installed its directory tree looks like:
|
||||
|
||||
MySDLApp Home/
|
||||
MySDLApp.app
|
||||
Documents/
|
||||
Library/
|
||||
Preferences/
|
||||
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".
|
||||
|
||||
More information on this subject is available here:
|
||||
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
|
||||
|
||||
==============================================================================
|
||||
Notes -- iPhone SDL limitations
|
||||
==============================================================================
|
||||
|
||||
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).
|
||||
|
||||
Textures:
|
||||
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:
|
||||
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 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);
|
||||
|
||||
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.
|
||||
|
||||
extern "C"
|
||||
void ShowFrame(void*)
|
||||
{
|
||||
... do event handling, frame logic and rendering
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
... initialize game ...
|
||||
|
||||
#if __IPHONEOS__
|
||||
// Initialize the Game Center for scoring and matchmaking
|
||||
InitGameCenter();
|
||||
|
||||
// Set up the game to run in the window animation callback on iOS
|
||||
// so that Game Center and so forth works correctly.
|
||||
SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
|
||||
#else
|
||||
while ( running ) {
|
||||
ShowFrame(0);
|
||||
DelayFrame();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
186
project/jni/sdl-2.0/README-macosx.txt
Normal file
186
project/jni/sdl-2.0/README-macosx.txt
Normal file
@@ -0,0 +1,186 @@
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer with Mac OS X
|
||||
==============================================================================
|
||||
|
||||
These instructions are for people using Apple's Mac OS X (pronounced
|
||||
"ten").
|
||||
|
||||
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
|
||||
command line tools or Apple's IDE Xcode.
|
||||
|
||||
To build SDL using the command line, use the standard configure and make
|
||||
process:
|
||||
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
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
|
||||
the fatbuild.sh script in build-scripts:
|
||||
sh build-scripts/fatbuild.sh
|
||||
sudo build-scripts/fatbuild.sh install
|
||||
This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
|
||||
ABI compatibility on Intel architectures. For best compatibility you
|
||||
should compile your application the same way. A script which wraps
|
||||
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:
|
||||
use the traditional autoconf/automake/make method, or use Xcode.
|
||||
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer with a traditional Makefile
|
||||
==============================================================================
|
||||
|
||||
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
|
||||
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
|
||||
"MyCoolGame.app".
|
||||
|
||||
To get this build automatically, add something like the following rule to
|
||||
your Makefile.am:
|
||||
|
||||
bundle_contents = APP_NAME.app/Contents
|
||||
APP_NAME_bundle: EXE_NAME
|
||||
mkdir -p $(bundle_contents)/MacOS
|
||||
mkdir -p $(bundle_contents)/Resources
|
||||
echo "APPL????" > $(bundle_contents)/PkgInfo
|
||||
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
|
||||
|
||||
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
|
||||
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
|
||||
name as specified in your configure.in file.
|
||||
|
||||
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.
|
||||
|
||||
If you want the created bundles to be installed, you may want to add this
|
||||
rule to your Makefile.am:
|
||||
|
||||
install-exec-hook: APP_NAME_bundle
|
||||
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
|
||||
mkdir -p $(DESTDIR)$(prefix)/Applications/
|
||||
cp -r $< /$(DESTDIR)$(prefix)Applications/
|
||||
|
||||
This rule takes the Bundle created by the rule from step 3 and installs them
|
||||
into $(DESTDIR)$(prefix)/Applications/.
|
||||
|
||||
Again, if you want to install multiple applications, you will have to augment
|
||||
the make rule accordingly.
|
||||
|
||||
|
||||
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
|
||||
there are some more things you should do before shipping your product...
|
||||
|
||||
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*,
|
||||
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
|
||||
achieve that by linking against the libraries listed by
|
||||
sdl-config --static-libs
|
||||
instead of those listed by
|
||||
sdl-config --libs
|
||||
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
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
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
|
||||
the net, so feel free to take a peek at them for inspiration!
|
||||
|
||||
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer with Xcode
|
||||
==============================================================================
|
||||
|
||||
These instructions are for using Apple's Xcode IDE to build SDL applications.
|
||||
|
||||
- First steps
|
||||
|
||||
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).
|
||||
Because Stuffit Expander will unpack the archive into a subdirectory,
|
||||
you should unpack the archive manually from the command line:
|
||||
cd [path_to_SDL_source]
|
||||
tar zxf Xcode.tar.gz
|
||||
This will create a new folder called Xcode, which you can browse
|
||||
normally from the Finder.
|
||||
|
||||
- Building the Framework
|
||||
|
||||
The SDL Library is packaged as a framework bundle, an organized
|
||||
relocatable folder hierarchy of executable code, interface headers,
|
||||
and additional resources. For practical purposes, you can think of a
|
||||
framework as a more user and system-friendly shared library, whose library
|
||||
file behaves more or less like a standard UNIX shared library.
|
||||
|
||||
To build the framework, simply open the framework project and build it.
|
||||
By default, the framework bundle "SDL.framework" is installed in
|
||||
/Library/Frameworks. Therefore, the testers and project stationary expect
|
||||
it to be located there. However, it will function the same in any of the
|
||||
following locations:
|
||||
|
||||
~/Library/Frameworks
|
||||
/Local/Library/Frameworks
|
||||
/System/Library/Frameworks
|
||||
|
||||
- Build Options
|
||||
There are two "Build Styles" (See the "Targets" tab) for SDL.
|
||||
"Deployment" should be used if you aren't tweaking the SDL library.
|
||||
"Development" should be used to debug SDL apps or the library itself.
|
||||
|
||||
- Building the Testers
|
||||
Open the SDLTest project and build away!
|
||||
|
||||
- Using the Project Stationary
|
||||
Copy the stationary to the indicated folders to access it from
|
||||
the "New Project" and "Add target" menus. What could be easier?
|
||||
|
||||
- Setting up a new project by hand
|
||||
Some of you won't want to use the Stationary so I'll give some tips:
|
||||
* Create a new "Cocoa Application"
|
||||
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
|
||||
* Remove "main.c" from your project
|
||||
* Remove "MainMenu.nib" from your project
|
||||
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
|
||||
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
|
||||
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
|
||||
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
|
||||
* Add your files
|
||||
* Clean and build
|
||||
|
||||
- Building from command line
|
||||
Use pbxbuild in the same directory as your .pbproj file
|
||||
|
||||
- Running your app
|
||||
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
|
||||
"Executables" panel of the target settings.
|
||||
|
||||
- Implementation Notes
|
||||
Some things that may be of interest about how it all works...
|
||||
* Working directory
|
||||
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
|
||||
suit your needs.
|
||||
* You have a Cocoa App!
|
||||
Your SDL app is essentially a Cocoa application. When your app
|
||||
starts up and the libraries finish loading, a Cocoa procedure is called,
|
||||
which sets up the working directory and calls your main() method.
|
||||
You are free to modify your Cocoa app with generally no consequence
|
||||
to SDL. You cannot, however, easily change the SDL window itself.
|
||||
Functionality may be added in the future to help this.
|
||||
|
||||
|
||||
Known bugs are listed in the file "BUGS"
|
||||
16
project/jni/sdl-2.0/README-pandora.txt
Normal file
16
project/jni/sdl-2.0/README-pandora.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
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
|
||||
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.
|
||||
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 :
|
||||
"export SDL_VIDEODRIVER=pandora"
|
||||
|
||||
- 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..
|
||||
|
||||
|
||||
David Carré (Cpasjuste)
|
||||
cpasjuste@gmail.com
|
||||
30
project/jni/sdl-2.0/README-platforms.txt
Normal file
30
project/jni/sdl-2.0/README-platforms.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
This is a list of the platforms SDL supports, and who maintains them.
|
||||
|
||||
Officially supported platforms
|
||||
==============================
|
||||
(code compiles, and thoroughly tested for release)
|
||||
==============================
|
||||
Windows XP/Vista/7/8
|
||||
Mac OS X 10.5+
|
||||
Linux 2.6+
|
||||
iOS 5.1.1+
|
||||
Android 2.3.3+
|
||||
|
||||
Unofficially supported platforms
|
||||
================================
|
||||
(code compiles, but not thoroughly tested)
|
||||
================================
|
||||
FreeBSD
|
||||
NetBSD
|
||||
OpenBSD
|
||||
Solaris
|
||||
|
||||
Platforms supported by volunteers
|
||||
=================================
|
||||
Haiku - maintained by Axel Dörfler <axeld@pinc-software.de>
|
||||
PSP - maintained by 527721088@qq.com
|
||||
Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
|
||||
|
||||
Platforms that need maintainers
|
||||
===============================
|
||||
61
project/jni/sdl-2.0/README-porting.txt
Normal file
61
project/jni/sdl-2.0/README-porting.txt
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
* Porting To A New Platform
|
||||
|
||||
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.
|
||||
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
|
||||
on based on C preprocessor symbols.
|
||||
|
||||
There are two basic ways of building SDL at the moment:
|
||||
|
||||
1. The "UNIX" way: ./configure; make; make install
|
||||
|
||||
If you have a GNUish system, then you might try this. Edit configure.in,
|
||||
take a look at the large section labelled:
|
||||
"Set up the configuration based on the target platform!"
|
||||
Add a section for your platform, and then re-run autogen.sh and build!
|
||||
|
||||
2. Using an IDE:
|
||||
|
||||
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,
|
||||
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
|
||||
|
||||
Add the top level include directory to the header search path, and then add
|
||||
the following sources to the project:
|
||||
src/*.c
|
||||
src/atomic/*.c
|
||||
src/audio/*.c
|
||||
src/cpuinfo/*.c
|
||||
src/events/*.c
|
||||
src/file/*.c
|
||||
src/haptic/*.c
|
||||
src/joystick/*.c
|
||||
src/power/*.c
|
||||
src/render/*.c
|
||||
src/stdlib/*.c
|
||||
src/thread/*.c
|
||||
src/timer/*.c
|
||||
src/video/*.c
|
||||
src/audio/disk/*.c
|
||||
src/audio/dummy/*.c
|
||||
src/video/dummy/*.c
|
||||
src/haptic/dummy/*.c
|
||||
src/joystick/dummy/*.c
|
||||
src/main/dummy/*.c
|
||||
src/thread/generic/*.c
|
||||
src/timer/dummy/*.c
|
||||
src/loadso/dummy/*.c
|
||||
|
||||
|
||||
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.
|
||||
|
||||
If you have any questions, don't hesitate to ask on the SDL mailing list:
|
||||
http://www.libsdl.org/mailing-list.php
|
||||
|
||||
Enjoy!
|
||||
Sam Lantinga (slouken@libsdl.org)
|
||||
|
||||
17
project/jni/sdl-2.0/README-psp.txt
Normal file
17
project/jni/sdl-2.0/README-psp.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
SDL port for the Sony PSP contributed by
|
||||
Captian Lex
|
||||
|
||||
Credit to
|
||||
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
|
||||
Geecko for his PSP GU lib "Glib2d"
|
||||
|
||||
Building
|
||||
--------
|
||||
To build for the PSP, make sure psp-config is in the path and run:
|
||||
make -f Makefile.psp
|
||||
|
||||
|
||||
|
||||
To Do
|
||||
------
|
||||
PSP Screen Keyboard
|
||||
84
project/jni/sdl-2.0/README-touch.txt
Normal file
84
project/jni/sdl-2.0/README-touch.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
===========================================================================
|
||||
System Specific Notes
|
||||
===========================================================================
|
||||
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.
|
||||
|
||||
Mac:
|
||||
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:
|
||||
Works out of box.
|
||||
|
||||
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
|
||||
|
||||
===========================================================================
|
||||
Events
|
||||
===========================================================================
|
||||
SDL_FINGERDOWN:
|
||||
Sent when a finger (or stylus) is placed on a touch device.
|
||||
Fields:
|
||||
event.tfinger.touchId - the Id of the touch device.
|
||||
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.y - the y coordinate of the touch (0..1)
|
||||
event.tfinger.pressure - the pressure of the touch (0..1)
|
||||
|
||||
SDL_FINGERMOTION:
|
||||
Sent when a finger (or stylus) is moved on the touch device.
|
||||
Fields:
|
||||
Same as SDL_FINGERDOWN but with additional:
|
||||
event.tfinger.dx - change in x coordinate during this motion event.
|
||||
event.tfinger.dy - change in y coordinate during this motion event.
|
||||
|
||||
SDL_FINGERUP:
|
||||
Sent when a finger (or stylus) is lifted from the touch device.
|
||||
Fields:
|
||||
Same as SDL_FINGERDOWN.
|
||||
|
||||
|
||||
===========================================================================
|
||||
Functions
|
||||
===========================================================================
|
||||
SDL provides the ability to access the underlying Finger structures.
|
||||
These structures should _never_ be modified.
|
||||
|
||||
The following functions are included from SDL_touch.h
|
||||
|
||||
To get a SDL_TouchID call SDL_GetTouchDevice(index).
|
||||
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!
|
||||
|
||||
The number of touch devices can be queried with SDL_GetNumTouchDevices().
|
||||
|
||||
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.
|
||||
|
||||
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 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.
|
||||
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.
|
||||
As a result, be very careful to check for NULL return values.
|
||||
|
||||
A SDL_Finger has the following fields:
|
||||
>x,y,pressure:
|
||||
The current coordinates of the touch.
|
||||
>pressure:
|
||||
The pressure of the touch.
|
||||
|
||||
===========================================================================
|
||||
Notes
|
||||
===========================================================================
|
||||
For a complete example see test/testgesture.c
|
||||
|
||||
Please direct questions/comments to:
|
||||
jim.tla+sdl_touch@gmail.com
|
||||
(original author, API was changed since)
|
||||
9
project/jni/sdl-2.0/README-wince.txt
Normal file
9
project/jni/sdl-2.0/README-wince.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
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
|
||||
will accept patches that support more modern Windows Mobile platforms for
|
||||
SDL 2.0.
|
||||
|
||||
--ryan.
|
||||
|
||||
106
project/jni/sdl-2.0/README.DirectFB
Normal file
106
project/jni/sdl-2.0/README.DirectFB
Normal file
@@ -0,0 +1,106 @@
|
||||
SDL on DirectFB
|
||||
|
||||
Supports:
|
||||
|
||||
- Hardware YUV overlays
|
||||
- OpenGL - software only
|
||||
- 2D/3D accelerations (depends on directfb driver)
|
||||
- multiple displays
|
||||
- windows
|
||||
|
||||
What you need:
|
||||
|
||||
DirectFB 1.0.1, 1.2.x, 1.3.0
|
||||
Kernel-Framebuffer support: required: vesafb, radeonfb ....
|
||||
Mesa 7.0.x - optional for OpenGL
|
||||
|
||||
/etc/directfbrc
|
||||
|
||||
This file should contain the following lines to make
|
||||
your joystick work and avoid crashes:
|
||||
------------------------
|
||||
disable-module=joystick
|
||||
disable-module=cle266
|
||||
disable-module=cyber5k
|
||||
no-linux-input-grab
|
||||
------------------------
|
||||
|
||||
To disable to use x11 backend when DISPLAY variable is found use
|
||||
|
||||
export SDL_DIRECTFB_X11_CHECK=0
|
||||
|
||||
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
|
||||
use
|
||||
|
||||
export SDL_DIRECTFB_LINUX_INPUT=0
|
||||
|
||||
To use hardware accelerated YUV-overlays for YUV-textures, use:
|
||||
|
||||
export SDL_DIRECTFB_YUV_DIRECT=1
|
||||
|
||||
This is disabled by default. It will only support one
|
||||
YUV texture, namely the first. Every other YUV texture will be
|
||||
rendered in software.
|
||||
|
||||
In addition, you may use (directfb-1.2.x)
|
||||
|
||||
export SDL_DIRECTFB_YUV_UNDERLAY=1
|
||||
|
||||
to make the YUV texture an underlay. This will make the cursor to
|
||||
be shown.
|
||||
|
||||
Simple Window Manager
|
||||
=====================
|
||||
|
||||
The driver has support for a very, very basic window manager you may
|
||||
want to use when runnning with "wm=default". Use
|
||||
|
||||
export SDL_DIRECTFB_WM=1
|
||||
|
||||
to enable basic window borders. In order to have the window title rendered,
|
||||
you need to have the following font installed:
|
||||
|
||||
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
||||
|
||||
OPENGL Support
|
||||
==============
|
||||
|
||||
The following instructions will give you *software* opengl. However this
|
||||
works at least on all directfb supported platforms.
|
||||
|
||||
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
|
||||
cd mesa
|
||||
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
|
||||
------------------------
|
||||
|
||||
Edit configs/linux-directfb so that the Directories-section looks like
|
||||
------------------------
|
||||
# Directories
|
||||
SRC_DIRS = mesa glu
|
||||
GLU_DIRS = sgi
|
||||
DRIVER_DIRS = directfb
|
||||
PROGRAM_DIRS =
|
||||
------------------------
|
||||
|
||||
make linux-directfb
|
||||
make
|
||||
|
||||
echo Installing - please enter sudo pw.
|
||||
|
||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||
cd src/mesa/drivers/directfb
|
||||
make
|
||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||
------------------------
|
||||
|
||||
To run the SDL - testprograms:
|
||||
|
||||
export SDL_VIDEODRIVER=directfb
|
||||
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
|
||||
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
|
||||
|
||||
./testgl
|
||||
|
||||
23
project/jni/sdl-2.0/README.HG
Normal file
23
project/jni/sdl-2.0/README.HG
Normal file
@@ -0,0 +1,23 @@
|
||||
The latest development version of SDL is available via Mercurial.
|
||||
Mercurial 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
|
||||
source tree instead of waiting for an official release. Please look
|
||||
at the Mercurial website ( http://mercurial.selenic.com/ ) for more
|
||||
information on using hg, where you can also download software for
|
||||
Mac OS X, Windows, and Unix systems.
|
||||
|
||||
hg clone http://hg.libsdl.org/SDL
|
||||
|
||||
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.
|
||||
|
||||
If you are building SDL via configure, you will need to run autogen.sh
|
||||
before running configure.
|
||||
|
||||
There is a web interface to the subversion repository at:
|
||||
|
||||
http://hg.libsdl.org/SDL/
|
||||
|
||||
There is an RSS feed available at that URL, for those that want to
|
||||
track commits in real time.
|
||||
|
||||
186
project/jni/sdl-2.0/README.MacOSX
Normal file
186
project/jni/sdl-2.0/README.MacOSX
Normal file
@@ -0,0 +1,186 @@
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer with Mac OS X
|
||||
==============================================================================
|
||||
|
||||
These instructions are for people using Apple's Mac OS X (pronounced
|
||||
"ten").
|
||||
|
||||
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
|
||||
command line tools or Apple's IDE Xcode.
|
||||
|
||||
To build SDL using the command line, use the standard configure and make
|
||||
process:
|
||||
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
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
|
||||
the fatbuild.sh script in build-scripts:
|
||||
sh build-scripts/fatbuild.sh
|
||||
sudo build-scripts/fatbuild.sh install
|
||||
This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
|
||||
ABI compatibility on Intel architectures. For best compatibility you
|
||||
should compile your application the same way. A script which wraps
|
||||
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:
|
||||
use the traditional autoconf/automake/make method, or use Xcode.
|
||||
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer with a traditional Makefile
|
||||
==============================================================================
|
||||
|
||||
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
|
||||
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
|
||||
"MyCoolGame.app".
|
||||
|
||||
To get this build automatically, add something like the following rule to
|
||||
your Makefile.am:
|
||||
|
||||
bundle_contents = APP_NAME.app/Contents
|
||||
APP_NAME_bundle: EXE_NAME
|
||||
mkdir -p $(bundle_contents)/MacOS
|
||||
mkdir -p $(bundle_contents)/Resources
|
||||
echo "APPL????" > $(bundle_contents)/PkgInfo
|
||||
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
|
||||
|
||||
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
|
||||
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
|
||||
name as specified in your configure.in file.
|
||||
|
||||
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 seperate rule.
|
||||
|
||||
If you want the created bundles to be installed, you may want to add this
|
||||
rule to your Makefile.am:
|
||||
|
||||
install-exec-hook: APP_NAME_bundle
|
||||
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
|
||||
mkdir -p $(DESTDIR)$(prefix)/Applications/
|
||||
cp -r $< /$(DESTDIR)$(prefix)Applications/
|
||||
|
||||
This rule takes the Bundle created by the rule from step 3 and installs them
|
||||
into $(DESTDIR)$(prefix)/Applications/.
|
||||
|
||||
Again, if you want to install multiple applications, you will have to augment
|
||||
the make rule accordingly.
|
||||
|
||||
|
||||
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
|
||||
there are some more things you should do before shipping yor product...
|
||||
|
||||
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*,
|
||||
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
|
||||
achieve that by linkinag against the libraries listed by
|
||||
sdl-config --static-libs
|
||||
instead of those listed by
|
||||
sdl-config --libs
|
||||
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
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
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
|
||||
the net, so feel free to take a peek at them for inspiration!
|
||||
|
||||
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer with Xcode
|
||||
==============================================================================
|
||||
|
||||
These instructions are for using Apple's Xcode IDE to build SDL applications.
|
||||
|
||||
- First steps
|
||||
|
||||
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).
|
||||
Because Stuffit Expander will unpack the archive into a subdirectory,
|
||||
you should unpack the archive manually from the command line:
|
||||
cd [path_to_SDL_source]
|
||||
tar zxf Xcode.tar.gz
|
||||
This will create a new folder called Xcode, which you can browse
|
||||
normally from the Finder.
|
||||
|
||||
- Building the Framework
|
||||
|
||||
The SDL Library is packaged as a framework bundle, an organized
|
||||
relocatable folder heirarchy of executible code, interface headers,
|
||||
and additional resources. For practical purposes, you can think of a
|
||||
framework as a more user and system-friendly shared library, whose library
|
||||
file behaves more or less like a standard UNIX shared library.
|
||||
|
||||
To build the framework, simply open the framework project and build it.
|
||||
By default, the framework bundle "SDL.framework" is installed in
|
||||
/Library/Frameworks. Therefore, the testers and project stationary expect
|
||||
it to be located there. However, it will function the same in any of the
|
||||
following locations:
|
||||
|
||||
~/Library/Frameworks
|
||||
/Local/Library/Frameworks
|
||||
/System/Library/Frameworks
|
||||
|
||||
- Build Options
|
||||
There are two "Build Styles" (See the "Targets" tab) for SDL.
|
||||
"Deployment" should be used if you aren't tweaking the SDL library.
|
||||
"Development" should be used to debug SDL apps or the library itself.
|
||||
|
||||
- Building the Testers
|
||||
Open the SDLTest project and build away!
|
||||
|
||||
- Using the Project Stationary
|
||||
Copy the stationary to the indicated folders to access it from
|
||||
the "New Project" and "Add target" menus. What could be easier?
|
||||
|
||||
- Setting up a new project by hand
|
||||
Some of you won't want to use the Stationary so I'll give some tips:
|
||||
* Create a new "Cocoa Application"
|
||||
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
|
||||
* Remove "main.c" from your project
|
||||
* Remove "MainMenu.nib" from your project
|
||||
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
|
||||
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
|
||||
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
|
||||
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
|
||||
* Add your files
|
||||
* Clean and build
|
||||
|
||||
- Building from command line
|
||||
Use pbxbuild in the same directory as your .pbproj file
|
||||
|
||||
- Running your app
|
||||
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
|
||||
"Executibles" panel of the target settings.
|
||||
|
||||
- Implementation Notes
|
||||
Some things that may be of interest about how it all works...
|
||||
* Working directory
|
||||
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
|
||||
suit your needs.
|
||||
* You have a Cocoa App!
|
||||
Your SDL app is essentially a Cocoa application. When your app
|
||||
starts up and the libraries finish loading, a Cocoa procedure is called,
|
||||
which sets up the working directory and calls your main() method.
|
||||
You are free to modify your Cocoa app with generally no consequence
|
||||
to SDL. You cannot, however, easily change the SDL window itself.
|
||||
Functionality may be added in the future to help this.
|
||||
|
||||
|
||||
Known bugs are listed in the file "BUGS"
|
||||
33
project/jni/sdl-2.0/README.Platforms
Normal file
33
project/jni/sdl-2.0/README.Platforms
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
This is a list of the platforms SDL supports, and who maintains them.
|
||||
|
||||
Officially supported platforms
|
||||
==============================
|
||||
(code compiles, and thoroughly tested for release)
|
||||
==============================
|
||||
Windows XP
|
||||
Windows Vista
|
||||
Windows 7
|
||||
Mac OS X 10.4+
|
||||
Linux 2.6+
|
||||
iOS 3.1.3+
|
||||
Android 1.6+
|
||||
|
||||
Unofficially supported platforms
|
||||
================================
|
||||
(code compiles, but not thoroughly tested)
|
||||
================================
|
||||
Windows CE
|
||||
FreeBSD
|
||||
NetBSD
|
||||
OpenBSD
|
||||
Solaris
|
||||
|
||||
Platforms supported by volunteers
|
||||
=================================
|
||||
Pandora - maintained by Scott Smith <pickle136@sbcglobal.net>
|
||||
|
||||
Platforms that need maintainers
|
||||
===============================
|
||||
Nintendo DS
|
||||
Haiku
|
||||
57
project/jni/sdl-2.0/README.Porting
Normal file
57
project/jni/sdl-2.0/README.Porting
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
* Porting To A New Platform
|
||||
|
||||
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.
|
||||
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
|
||||
on based on C preprocessor symbols.
|
||||
|
||||
There are two basic ways of building SDL at the moment:
|
||||
|
||||
1. The "UNIX" way: ./configure; make; make install
|
||||
|
||||
If you have a GNUish system, then you might try this. Edit configure.in,
|
||||
take a look at the large section labelled:
|
||||
"Set up the configuration based on the target platform!"
|
||||
Add a section for your platform, and then re-run autogen.sh and build!
|
||||
|
||||
2. Using an IDE:
|
||||
|
||||
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,
|
||||
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
|
||||
|
||||
Add the top level include directory to the header search path, and then add
|
||||
the following sources to the project:
|
||||
src/*.c
|
||||
src/audio/*.c
|
||||
src/cdrom/*.c
|
||||
src/cpuinfo/*.c
|
||||
src/events/*.c
|
||||
src/file/*.c
|
||||
src/joystick/*.c
|
||||
src/stdlib/*.c
|
||||
src/thread/*.c
|
||||
src/timer/*.c
|
||||
src/video/*.c
|
||||
src/audio/disk/*.c
|
||||
src/audio/dummy/*.c
|
||||
src/video/dummy/*.c
|
||||
src/joystick/dummy/*.c
|
||||
src/cdrom/dummy/*.c
|
||||
src/thread/generic/*.c
|
||||
src/timer/dummy/*.c
|
||||
src/loadso/dummy/*.c
|
||||
|
||||
|
||||
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.
|
||||
|
||||
If you have any questions, don't hesitate to ask on the SDL mailing list:
|
||||
http://www.libsdl.org/mailing-list.php
|
||||
|
||||
Enjoy!
|
||||
Sam Lantinga (slouken@libsdl.org)
|
||||
|
||||
55
project/jni/sdl-2.0/README.WinCE
Normal file
55
project/jni/sdl-2.0/README.WinCE
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
Project files for embedded Visual C++ 3.0, 4.0 and
|
||||
Visual Studio 2005 can be found in VisualCE.zip
|
||||
|
||||
SDL supports GAPI and WinDib output for Windows CE.
|
||||
|
||||
GAPI driver supports:
|
||||
|
||||
- all possible WinCE devices (Pocket PC, Smartphones, HPC)
|
||||
with different orientations of video memory and resolutions.
|
||||
- 4, 8 and 16 bpp devices
|
||||
- special handling of 8bpp on 8bpp devices
|
||||
- VGA mode, you can even switch between VGA and GAPI in runtime
|
||||
(between 240x320 and 480x640 for example). On VGA devices you can
|
||||
use either GAPI or VGA.
|
||||
- Landscape mode and automatic rotation of buttons and stylus coordinates.
|
||||
To enable landscape mode make width of video screen bigger than height.
|
||||
For example:
|
||||
SDL_SetVideoMode(320,240,16,SDL_FULLSCREEN)
|
||||
- WM2005
|
||||
- SDL_ListModes
|
||||
|
||||
NOTE:
|
||||
There are several SDL features not available in the WinCE port of SDL.
|
||||
|
||||
- DirectX is not yet available
|
||||
- Semaphores are not available
|
||||
- Joystick support is not available
|
||||
- CD-ROM control is not available
|
||||
|
||||
In addition, there are several features that run in "degraded" mode:
|
||||
|
||||
Preprocessor Symbol Effect
|
||||
=================== =================================
|
||||
|
||||
SDL_systimer.c:
|
||||
USE_GETTICKCOUNT Less accurate values for SDL time functions
|
||||
USE_SETTIMER Use only a single marginally accurate timer
|
||||
|
||||
SDL_syswm.c:
|
||||
DISABLE_ICON_SUPPORT Can't set the runtime window icon
|
||||
|
||||
SDL_sysmouse.c:
|
||||
USE_STATIC_CURSOR Only the arrow cursor is available
|
||||
|
||||
SDL_sysevents.c:
|
||||
NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus
|
||||
|
||||
SDL_dibevents.c:
|
||||
NO_GETKEYBOARDSTATE Very limited keycode translation
|
||||
|
||||
SDL_dibvideo.c:
|
||||
NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp
|
||||
NO_CHANGEDISPLAYSETTINGS No fullscreen support
|
||||
NO_GAMMA_SUPPORT Gamma correction not available
|
||||
175
project/jni/sdl-2.0/README.android
Normal file
175
project/jni/sdl-2.0/README.android
Normal file
@@ -0,0 +1,175 @@
|
||||
================================================================================
|
||||
Simple DirectMedia Layer for Android
|
||||
================================================================================
|
||||
|
||||
Requirements:
|
||||
|
||||
Android SDK
|
||||
http://developer.android.com/sdk/index.html
|
||||
|
||||
Android NDK r4 or later
|
||||
http://developer.android.com/sdk/ndk/index.html
|
||||
|
||||
|
||||
================================================================================
|
||||
How the port works
|
||||
================================================================================
|
||||
|
||||
- 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
|
||||
the SDL library
|
||||
- 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
|
||||
- This eventually produces a standard Android .apk package
|
||||
|
||||
The Android Java code implements an "activity" and can be found in:
|
||||
android-project/src/org/libsdl/app/SDLActivity.java
|
||||
|
||||
The Java code loads your game code, the SDL shared library, and
|
||||
dispatches to native functions implemented in the SDL library:
|
||||
src/SDL_android.cpp
|
||||
|
||||
Your project must include some glue code that starts your main() routine:
|
||||
src/main/android/SDL_android_main.cpp
|
||||
|
||||
|
||||
================================================================================
|
||||
Building an app
|
||||
================================================================================
|
||||
|
||||
Instructions:
|
||||
1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project.
|
||||
2. Move this SDL directory into the <project>/jni directory and then copy
|
||||
SDL_config_android.h to SDL_config.h inside the include folder
|
||||
3. Place your application source files in the <project>/jni/src directory
|
||||
4. Edit <project>/jni/src/Android.mk to include your source files
|
||||
5. 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.
|
||||
|
||||
6. Edit <project>/local.properties to point to the Android SDK directory
|
||||
7. Run 'ant debug' in android/project. This compiles the .java and eventually
|
||||
creates a .apk with the native code embedded
|
||||
8. 'ant 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:
|
||||
|
||||
android-project/
|
||||
AndroidManifest.xml - package manifest, do not modify
|
||||
build.properties - empty
|
||||
build.xml - build description file, used by ant
|
||||
default.properties - holds the ABI for the application, currently android-4 which corresponds to the Android 1.6 system image
|
||||
local.properties - holds the SDK path, you should change this to the path to your SDK
|
||||
jni/ - directory holding native code
|
||||
jni/Android.mk - Android makefile that includes all subdirectories
|
||||
jni/SDL/ - directory holding the SDL library files
|
||||
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
||||
jni/src/ - directory holding your C/C++ source
|
||||
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
|
||||
res/ - directory holding resources for your application
|
||||
res/drawable-* - directories holding icons for different phone hardware
|
||||
res/layout/main.xml - place holder for the main screen layout, overridden by the SDL video output
|
||||
res/values/strings.xml - strings used in your application, including the application name shown on the phone.
|
||||
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 on this implementation.
|
||||
|
||||
|
||||
================================================================================
|
||||
Additional documentation
|
||||
================================================================================
|
||||
|
||||
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.
|
||||
|
||||
The best place to start is with docs/OVERVIEW.TXT
|
||||
|
||||
|
||||
================================================================================
|
||||
Using Eclipse
|
||||
================================================================================
|
||||
|
||||
First make sure that you've installed Eclipse and the Android extensions as described here:
|
||||
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:
|
||||
* File -> New -> Other
|
||||
* Select the Android -> Android Project wizard and click Next
|
||||
* Enter the name you'd like your project to have
|
||||
* Select "Create project from existing source" and browse for your project directory
|
||||
* Make sure the Build Target is set to Android 1.6
|
||||
* Click Finish
|
||||
|
||||
|
||||
================================================================================
|
||||
Loading files and resources
|
||||
================================================================================
|
||||
|
||||
NEED CONTENT
|
||||
|
||||
|
||||
================================================================================
|
||||
Troubleshooting
|
||||
================================================================================
|
||||
|
||||
You can create and run an emulator from the Eclipse IDE:
|
||||
* Window -> Android SDK and AVD Manager
|
||||
|
||||
You can see if adb can see any devices with the following command:
|
||||
adb devices
|
||||
|
||||
You can see the output of log messages on the default device with:
|
||||
adb logcat
|
||||
|
||||
You can push files to the device with:
|
||||
adb push local_file remote_path_and_file
|
||||
|
||||
You can push files to the SD Card at /sdcard, for example:
|
||||
adb push moose.dat /sdcard/moose.dat
|
||||
|
||||
You can see the files on the SD card with a shell command:
|
||||
adb shell ls /sdcard/
|
||||
|
||||
You can start a command shell on the default device with:
|
||||
adb shell
|
||||
|
||||
You can do a clean build with the following commands:
|
||||
ndk-build clean
|
||||
ndk-build
|
||||
|
||||
You can see the complete command line that ndk-build is using by passing V=1 on the command line:
|
||||
ndk-build V=1
|
||||
|
||||
If your application crashes in native code, you can use addr2line to convert the addresses in the stack trace to lines in your code.
|
||||
|
||||
For example, if your crash looks like this:
|
||||
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): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
|
||||
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): #00 pc 0001c902 /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): #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. I run addr2line with the debug version of my code:
|
||||
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:
|
||||
000014bc
|
||||
|
||||
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:
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
__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 "Application.mk" in the jni directory, with the following line in it:
|
||||
APP_OPTIM := debug
|
||||
|
||||
|
||||
================================================================================
|
||||
Known issues
|
||||
================================================================================
|
||||
|
||||
- SDL audio (although it's mostly written, just not working properly yet)
|
||||
- TODO. I'm sure there's a bunch more stuff I haven't thought of
|
||||
64
project/jni/sdl-2.0/README.ds
Normal file
64
project/jni/sdl-2.0/README.ds
Normal file
@@ -0,0 +1,64 @@
|
||||
================================================================================
|
||||
Simple DirectMedia Layer for Nintendo DS
|
||||
================================================================================
|
||||
|
||||
-Requirements-
|
||||
* The devkitpro SDK available at http://devkitpro.org.
|
||||
Read the information at http://devkitpro.org/wiki/Getting_Started/devkitARM
|
||||
The necessary packages are devkitARM, libnds, libfat and default arm7.
|
||||
* Optionally, use a DS emulator, such as desmume (http://desmume.org/)
|
||||
to program and debug.
|
||||
|
||||
-Building SDL-
|
||||
|
||||
After setting the devkitpro environment, cd into your SDL directory and type:
|
||||
make -f Makefile.ds
|
||||
|
||||
This will compile and install the library and headers into the
|
||||
devkitpro's portlibs directory (../portlibs/arm/lib/ and
|
||||
../portlibs/arm/include/). Additionally it will compile several tests
|
||||
that you can run either on the DS or with desmume. For instance:
|
||||
desmume --cflash-path=test/ test/nds-test-progs/testsprite2/testsprite2.nds
|
||||
desmume --cflash-path=test/ test/nds-test-progs/testspriteminimal/testspriteminimal.nds
|
||||
desmume --cflash-path=test/ test/nds-test-progs/testscale/testscale.nds
|
||||
desmume test/nds-test-progs/general/general.nds
|
||||
|
||||
-Notes-
|
||||
* The renderer code is based on the gl like engine. It's not using the sprite engine.
|
||||
* The hardware renderer is using the parts of the libgl2d abstraction library that can be found at:
|
||||
http://rel.phatcode.net/junk.php?id=117
|
||||
Used with the author's permission.
|
||||
* The port is very basic and incomplete:
|
||||
- SDL currently has to be compiled for either framebuffer mode or renderer mode.
|
||||
See USE_HW_RENDERER in Makefile.ds.
|
||||
- some optional renderer functions are not implemented.
|
||||
- no sound
|
||||
|
||||
-Limitations-
|
||||
* in hardware renderer mode, don't load too many textures. The internal format is
|
||||
2 bytes per pixel. And there is only 256KB reserved for the textures. For instance,
|
||||
testscale won't display sample.bmp, unless it's resized to a smaller picture.
|
||||
* the screen size is 256 x 384. Anything else won't work.
|
||||
* there is no 8 bits/pixel mode because SDL 2.0 doesn't support palettes.
|
||||
|
||||
-Joystick mapping-
|
||||
The Joystick presented to SDL has 2 axes and 8 buttons
|
||||
|
||||
KEY | Code
|
||||
A | 0
|
||||
B | 1
|
||||
X | 2
|
||||
Y | 3
|
||||
L | 4
|
||||
R | 5
|
||||
select | 6
|
||||
start | 7
|
||||
|
||||
Left-right is axe 0.
|
||||
Up-down is axe 1.
|
||||
|
||||
-Mouse mapping-
|
||||
todo
|
||||
|
||||
-Examples-
|
||||
Due to memory limitations, to be able to successfully run the testscale example, sample.bmp must be resized to 256x105.
|
||||
72
project/jni/sdl-2.0/README.gesture
Normal file
72
project/jni/sdl-2.0/README.gesture
Normal file
@@ -0,0 +1,72 @@
|
||||
===========================================================================
|
||||
Dollar 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.
|
||||
|
||||
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:
|
||||
----------
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
event.dgesture.touchId - the Id of the touch used to record the gesture.
|
||||
event.dgesture.gestureId - the unique id of the recoreded gesture.
|
||||
|
||||
|
||||
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:
|
||||
|
||||
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.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.
|
||||
|
||||
Most programs will want to define an appropriate error threshold and check to be sure taht the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
||||
|
||||
|
||||
|
||||
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 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 sucessfully saved.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
SDL_LoadDollarTemplates returns the number of templates sucessfully loaded.
|
||||
|
||||
|
||||
|
||||
===========================================================================
|
||||
Multi 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:
|
||||
|
||||
event.mgesture.touchId - the Id of the touch on which the gesture was performed.
|
||||
event.mgesture.x - the normalized x cooridinate of the gesture. (0..1)
|
||||
event.mgesture.y - the normalized y cooridinate of the gesture. (0..1)
|
||||
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.numFingers - the number of fingers used in the gesture.
|
||||
|
||||
|
||||
===========================================================================
|
||||
Notes
|
||||
===========================================================================
|
||||
For a complete example see test/testgesture.c
|
||||
|
||||
Please direct questions/comments to:
|
||||
jim.tla+sdl_touch@gmail.com
|
||||
110
project/jni/sdl-2.0/README.iOS
Normal file
110
project/jni/sdl-2.0/README.iOS
Normal file
@@ -0,0 +1,110 @@
|
||||
==============================================================================
|
||||
Building the Simple DirectMedia Layer for iPhone OS 2.0
|
||||
==============================================================================
|
||||
|
||||
Requirements: Mac OS X v10.5 or later and the iPhone SDK.
|
||||
|
||||
Instructions:
|
||||
1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in XCode.
|
||||
2. Select your desired target, and hit build.
|
||||
|
||||
There are three build targets:
|
||||
- libSDL.a:
|
||||
Build SDL as a statically linked library
|
||||
- testsdl
|
||||
Build a test program (there are known test failures which are fine)
|
||||
- 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.
|
||||
|
||||
==============================================================================
|
||||
Using the Simple DirectMedia Layer for iOS
|
||||
==============================================================================
|
||||
|
||||
FIXME: This needs to be updated for the latest methods
|
||||
|
||||
Here is the easiest method:
|
||||
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.
|
||||
2. Start a new project using the template. The project should be immediately ready for use with SDL.
|
||||
|
||||
Here is a more manual method:
|
||||
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.
|
||||
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.
|
||||
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 -- 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.
|
||||
|
||||
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
|
||||
==============================================================================
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
==============================================================================
|
||||
Notes -- Keyboard
|
||||
==============================================================================
|
||||
|
||||
SDL for iPhone contains several additional functions related to keyboard visibility. These functions are not part of the SDL standard API, but are necessary for revealing and hiding the iPhone's virtual onscreen keyboard. You can use them in your own applications by including a copy of the SDL_uikitkeyboard.h header (located in src/video/uikit) in your project.
|
||||
|
||||
int SDL_iPhoneKeyboardShow(SDL_Window * window)
|
||||
-- reveals the onscreen keyboard. Returns 0 on success and -1 on error.
|
||||
int SDL_iPhoneKeyboardHide(SDL_Window * window)
|
||||
-- hides the onscreen keyboard. Returns 0 on success and -1 on error.
|
||||
SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
|
||||
-- returns whether or not the onscreen keyboard is currently visible.
|
||||
int SDL_iPhoneKeyboardToggle(SDL_Window * window)
|
||||
-- toggles the visibility of the onscreen keyboard. Returns 0 on success and -1 on error.
|
||||
|
||||
==============================================================================
|
||||
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.
|
||||
|
||||
Once your application is installed its directory tree looks like:
|
||||
|
||||
MySDLApp Home/
|
||||
MySDLApp.app
|
||||
Documents/
|
||||
Library/
|
||||
Preferences/
|
||||
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".
|
||||
|
||||
More information on this subject is available here:
|
||||
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
|
||||
|
||||
==============================================================================
|
||||
Notes -- iPhone SDL limitations
|
||||
==============================================================================
|
||||
|
||||
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). Presently, landscape mode is not supported.
|
||||
|
||||
Video:
|
||||
For real time frame-rates, you are advised to use strictly SDL 2.0 video calls. Using compatibility video calls uploads an OpenGL texture for each frame drawn, and this operation is excruciatingly slow.
|
||||
|
||||
Textures:
|
||||
SDL for iPhone Textures supports only SDL_PIXELFORMAT_ABGR8888 and SDL_PIXELFORMAT_RGB24 pixel formats. This is because texture support in SDL for iPhone is done through OpenGL ES, which supports fewer pixel formats than OpenGL, will not re-order pixel data for you, and has no support for color-paletted formats (without extensions).
|
||||
|
||||
Audio:
|
||||
SDL for iPhone does not yet support audio input.
|
||||
|
||||
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.
|
||||
|
||||
16
project/jni/sdl-2.0/README.pandora
Normal file
16
project/jni/sdl-2.0/README.pandora
Normal file
@@ -0,0 +1,16 @@
|
||||
SDL 2.0 with open pandora console support ( http://openpandora.org/ )
|
||||
=====================================================================
|
||||
|
||||
- A pandora specific video driver was writed to allow SDL 2.0 with OpenGL ES
|
||||
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.
|
||||
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 :
|
||||
"export SDL_VIDEODRIVER=pandora"
|
||||
|
||||
- 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..
|
||||
|
||||
|
||||
David Carré (Cpasjuste)
|
||||
cpasjuste@gmail.com
|
||||
101
project/jni/sdl-2.0/README.touch
Normal file
101
project/jni/sdl-2.0/README.touch
Normal file
@@ -0,0 +1,101 @@
|
||||
===========================================================================
|
||||
System Specific Notes
|
||||
===========================================================================
|
||||
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.
|
||||
|
||||
Mac:
|
||||
The Mac and Iphone API's 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:
|
||||
Works out of box.
|
||||
|
||||
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
|
||||
|
||||
===========================================================================
|
||||
Events
|
||||
===========================================================================
|
||||
SDL_FINGERDOWN:
|
||||
Sent when a finger (or stylus) is placed on a touch device.
|
||||
Fields:
|
||||
event.tfinger.touchId - the Id of the touch device.
|
||||
event.tfinger.fingerId - the Id of the finger which just went down.
|
||||
event.tfinger.x - the x coordinate of the touch (0..touch.xres)
|
||||
event.tfinger.y - the y coordinate of the touch (0..touch.yres)
|
||||
event.tfinger.pressure - the pressure of the touch (0..touch.pressureres)
|
||||
|
||||
SDL_FINGERMOTION:
|
||||
Sent when a finger (or stylus) is moved on the touch device.
|
||||
Fields:
|
||||
Same as FINGERDOWN but with additional:
|
||||
event.tfginer.dx - change in x coordinate during this motion event.
|
||||
event.tfginer.dy - change in y coordinate during this motion event.
|
||||
|
||||
SDL_FINGERMOTION:
|
||||
Sent when a finger (or stylus) is lifted from the touch device.
|
||||
Fields:
|
||||
Same as FINGERDOWN.
|
||||
|
||||
|
||||
===========================================================================
|
||||
Functions
|
||||
===========================================================================
|
||||
SDL provides the ability to access the underlying Touch and Finger structures.
|
||||
These structures should _never_ be modified.
|
||||
|
||||
The following functions are included from SDL_Touch.h
|
||||
|
||||
To get a SDL_Touch device call SDL_GetTouch(touchId).
|
||||
This returns an SDL_Touch*.
|
||||
IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouch will return null. Be sure to check for this!
|
||||
|
||||
An SDL_Touch has the following fields:
|
||||
>xres,yres,pressures:
|
||||
The resolution at which x,y, and pressure values are reported. Currently these will always be equal to 2^15, but this may not always be the case.
|
||||
|
||||
>pressure_max, pressure_min, x_max, x_min, y_max, y_min
|
||||
Which give, respectively, the maximum and minumum values that the touch digitizer can return for pressure, x coordiniate, and y coordinate AS REPORTED BY THE OPERATING SYSTEM.
|
||||
On Mac/iPhone systems _max will always be 0, and _min will always be 1.
|
||||
|
||||
>native_xres,native_yres,native_pressureres:
|
||||
The native resolution of the touch device AS REPORTED BY THE OPERATING SYSTEM.
|
||||
On Mac/iPhone systems these will always be 1.
|
||||
|
||||
>num_fingers:
|
||||
The number of fingers currently down on the device.
|
||||
|
||||
>fingers:
|
||||
An array of pointers to the fingers which are on the device.
|
||||
|
||||
|
||||
The most common reason to access a touch device is to normalize inputs. This would be accomplished by code like the following:
|
||||
|
||||
SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId);
|
||||
if(inTouch == NULL) continue; //The touch has been removed
|
||||
|
||||
float x = ((float)event.tfinger.x)/inTouch->xres;
|
||||
float y = ((float)event.tfinger.y)/inTouch->yres;
|
||||
|
||||
|
||||
|
||||
To get an SDL_Finger, call SDL_GetFinger(touch,fingerId), where touch is a pointer to an SDL_Touch device, and fingerId is the id of the requested finger.
|
||||
This returns an SDL_Finger*, or null if the finger does not exist, or has been removed.
|
||||
An 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 FINGERUP event is polled.
|
||||
As a result, be very careful to check for null return values.
|
||||
|
||||
An SDL_Finger has the following fields:
|
||||
>x,y,pressure:
|
||||
The current coordinates of the touch.
|
||||
>xdelta,ydelta:
|
||||
The change in position resulting from the last finger motion.
|
||||
>last_x, last_y, last_pressure:
|
||||
The previous coordinates of the touch.
|
||||
|
||||
===========================================================================
|
||||
Notes
|
||||
===========================================================================
|
||||
For a complete example see test/testgesture.c
|
||||
|
||||
Please direct questions/comments to:
|
||||
jim.tla+sdl_touch@gmail.com
|
||||
38
project/jni/sdl-2.0/README.txt
Normal file
38
project/jni/sdl-2.0/README.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
Simple DirectMedia Layer
|
||||
|
||||
(SDL)
|
||||
|
||||
Version 2.0
|
||||
|
||||
---
|
||||
http://www.libsdl.org/
|
||||
|
||||
Simple DirectMedia Layer is a cross-platform development library designed
|
||||
to provide low level access to audio, keyboard, mouse, joystick, and graphics
|
||||
hardware via OpenGL and Direct3D. It is used by video playback software,
|
||||
emulators, and popular games including Valve's award winning catalog
|
||||
and many Humble Bundle games.
|
||||
|
||||
SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
|
||||
Support for other platforms may be found in the source code.
|
||||
|
||||
SDL is written in C, works natively with C++, and there are bindings
|
||||
available for several other languages, including C# and Python.
|
||||
|
||||
This library is distributed under the zlib license, which can be found
|
||||
in the file "COPYING.txt".
|
||||
|
||||
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 header files and test programs are well commented and always up to date.
|
||||
More documentation and FAQs are available online at:
|
||||
http://wiki.libsdl.org/
|
||||
|
||||
If you need help with the library, or just want to discuss SDL related
|
||||
issues, you can join the developers mailing list:
|
||||
http://www.libsdl.org/mailing-list.php
|
||||
|
||||
Enjoy!
|
||||
Sam Lantinga (slouken@libsdl.org)
|
||||
|
||||
112
project/jni/sdl-2.0/SDL2.spec
Normal file
112
project/jni/sdl-2.0/SDL2.spec
Normal file
@@ -0,0 +1,112 @@
|
||||
Summary: Simple DirectMedia Layer
|
||||
Name: SDL2
|
||||
Version: 2.0.0
|
||||
Release: 1
|
||||
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
|
||||
URL: http://www.libsdl.org/
|
||||
License: zlib
|
||||
Group: System Environment/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
Prefix: %{_prefix}
|
||||
%ifos linux
|
||||
Provides: libSDL2-2.0.so.0
|
||||
%endif
|
||||
|
||||
%define __defattr %defattr(-,root,root)
|
||||
%define __soext so
|
||||
|
||||
%description
|
||||
This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
level access to audio, keyboard, mouse, and display framebuffer across
|
||||
multiple platforms.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries, includes and more to develop SDL applications.
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description devel
|
||||
This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
level access to audio, keyboard, mouse, and display framebuffer across
|
||||
multiple platforms.
|
||||
|
||||
This is the libraries, include files and other resources you can use
|
||||
to develop SDL applications.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%ifos linux
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
|
||||
%else
|
||||
%configure
|
||||
%endif
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
make install prefix=$RPM_BUILD_ROOT%{prefix} \
|
||||
bindir=$RPM_BUILD_ROOT%{_bindir} \
|
||||
libdir=$RPM_BUILD_ROOT%{_libdir} \
|
||||
includedir=$RPM_BUILD_ROOT%{_includedir} \
|
||||
datadir=$RPM_BUILD_ROOT%{_datadir} \
|
||||
mandir=$RPM_BUILD_ROOT%{_mandir}
|
||||
%else
|
||||
%makeinstall
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%{__defattr}
|
||||
%doc README-SDL.txt COPYING.txt CREDITS.txt BUGS.txt
|
||||
%{_libdir}/lib*.%{__soext}.*
|
||||
|
||||
%files devel
|
||||
%{__defattr}
|
||||
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew
|
||||
%{_bindir}/*-config
|
||||
%{_libdir}/lib*.a
|
||||
%{_libdir}/lib*.la
|
||||
%{_libdir}/lib*.%{__soext}
|
||||
%{_includedir}/*/*.h
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_datadir}/aclocal/*
|
||||
|
||||
%changelog
|
||||
* Sun Jan 22 2012 Sam Lantinga <slouken@libsdl.org>
|
||||
- Updated for SDL 2.0
|
||||
|
||||
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
|
||||
- Removed support for Darwin, due to build problems on ps2linux
|
||||
|
||||
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
|
||||
- Added support for Darwin, updated spec file
|
||||
|
||||
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
|
||||
- Re-integrated spec file into SDL distribution
|
||||
- 'name' and 'version' come from configure
|
||||
- Some of the documentation is devel specific
|
||||
- Removed SMP support from %build - it doesn't work with libtool anyway
|
||||
|
||||
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
|
||||
- Hacked Mandrake sdl spec to build 1.1
|
||||
|
||||
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
- Build Release
|
||||
|
||||
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
|
||||
- Added docs
|
||||
|
||||
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
|
||||
- v 1.0.0
|
||||
|
||||
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
|
||||
- First spec file for Mandrake distribution.
|
||||
|
||||
# end of file
|
||||
112
project/jni/sdl-2.0/SDL2.spec.in
Normal file
112
project/jni/sdl-2.0/SDL2.spec.in
Normal file
@@ -0,0 +1,112 @@
|
||||
Summary: Simple DirectMedia Layer
|
||||
Name: SDL2
|
||||
Version: @SDL_VERSION@
|
||||
Release: 1
|
||||
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
|
||||
URL: http://www.libsdl.org/
|
||||
License: zlib
|
||||
Group: System Environment/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
Prefix: %{_prefix}
|
||||
%ifos linux
|
||||
Provides: libSDL2-2.0.so.0
|
||||
%endif
|
||||
|
||||
%define __defattr %defattr(-,root,root)
|
||||
%define __soext so
|
||||
|
||||
%description
|
||||
This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
level access to audio, keyboard, mouse, and display framebuffer across
|
||||
multiple platforms.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries, includes and more to develop SDL applications.
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description devel
|
||||
This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
level access to audio, keyboard, mouse, and display framebuffer across
|
||||
multiple platforms.
|
||||
|
||||
This is the libraries, include files and other resources you can use
|
||||
to develop SDL applications.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%ifos linux
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
|
||||
%else
|
||||
%configure
|
||||
%endif
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
make install prefix=$RPM_BUILD_ROOT%{prefix} \
|
||||
bindir=$RPM_BUILD_ROOT%{_bindir} \
|
||||
libdir=$RPM_BUILD_ROOT%{_libdir} \
|
||||
includedir=$RPM_BUILD_ROOT%{_includedir} \
|
||||
datadir=$RPM_BUILD_ROOT%{_datadir} \
|
||||
mandir=$RPM_BUILD_ROOT%{_mandir}
|
||||
%else
|
||||
%makeinstall
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%{__defattr}
|
||||
%doc README-SDL.txt COPYING.txt CREDITS.txt BUGS.txt
|
||||
%{_libdir}/lib*.%{__soext}.*
|
||||
|
||||
%files devel
|
||||
%{__defattr}
|
||||
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew
|
||||
%{_bindir}/*-config
|
||||
%{_libdir}/lib*.a
|
||||
%{_libdir}/lib*.la
|
||||
%{_libdir}/lib*.%{__soext}
|
||||
%{_includedir}/*/*.h
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_datadir}/aclocal/*
|
||||
|
||||
%changelog
|
||||
* Sun Jan 22 2012 Sam Lantinga <slouken@libsdl.org>
|
||||
- Updated for SDL 2.0
|
||||
|
||||
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
|
||||
- Removed support for Darwin, due to build problems on ps2linux
|
||||
|
||||
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
|
||||
- Added support for Darwin, updated spec file
|
||||
|
||||
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
|
||||
- Re-integrated spec file into SDL distribution
|
||||
- 'name' and 'version' come from configure
|
||||
- Some of the documentation is devel specific
|
||||
- Removed SMP support from %build - it doesn't work with libtool anyway
|
||||
|
||||
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
|
||||
- Hacked Mandrake sdl spec to build 1.1
|
||||
|
||||
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
- Build Release
|
||||
|
||||
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
|
||||
- Added docs
|
||||
|
||||
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
|
||||
- v 1.0.0
|
||||
|
||||
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
|
||||
- First spec file for Mandrake distribution.
|
||||
|
||||
# end of file
|
||||
112
project/jni/sdl-2.0/SDL2.spec.in.orig
Normal file
112
project/jni/sdl-2.0/SDL2.spec.in.orig
Normal file
@@ -0,0 +1,112 @@
|
||||
Summary: Simple DirectMedia Layer
|
||||
Name: SDL2
|
||||
Version: @SDL_VERSION@
|
||||
Release: 1
|
||||
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
|
||||
URL: http://www.libsdl.org/
|
||||
License: zlib
|
||||
Group: System Environment/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
Prefix: %{_prefix}
|
||||
%ifos linux
|
||||
Provides: libSDL2-2.0.so.0
|
||||
%endif
|
||||
|
||||
%define __defattr %defattr(-,root,root)
|
||||
%define __soext so
|
||||
|
||||
%description
|
||||
This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
level access to audio, keyboard, mouse, and display framebuffer across
|
||||
multiple platforms.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries, includes and more to develop SDL applications.
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description devel
|
||||
This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
level access to audio, keyboard, mouse, and display framebuffer across
|
||||
multiple platforms.
|
||||
|
||||
This is the libraries, include files and other resources you can use
|
||||
to develop SDL applications.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%ifos linux
|
||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
|
||||
%else
|
||||
%configure
|
||||
%endif
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
make install prefix=$RPM_BUILD_ROOT%{prefix} \
|
||||
bindir=$RPM_BUILD_ROOT%{_bindir} \
|
||||
libdir=$RPM_BUILD_ROOT%{_libdir} \
|
||||
includedir=$RPM_BUILD_ROOT%{_includedir} \
|
||||
datadir=$RPM_BUILD_ROOT%{_datadir} \
|
||||
mandir=$RPM_BUILD_ROOT%{_mandir}
|
||||
%else
|
||||
%makeinstall
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%{__defattr}
|
||||
%doc README-SDL.txt COPYING.txt CREDITS.txt BUGS.txt
|
||||
%{_libdir}/lib*.%{__soext}.*
|
||||
|
||||
%files devel
|
||||
%{__defattr}
|
||||
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew
|
||||
%{_bindir}/*-config
|
||||
%{_libdir}/lib*.a
|
||||
%{_libdir}/lib*.la
|
||||
%{_libdir}/lib*.%{__soext}
|
||||
%{_includedir}/*/*.h
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_datadir}/aclocal/*
|
||||
|
||||
%changelog
|
||||
* Sun Jan 22 2012 Sam Lantinga <slouken@libsdl.org>
|
||||
- Updated for SDL 2.0
|
||||
|
||||
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
|
||||
- Removed support for Darwin, due to build problems on ps2linux
|
||||
|
||||
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
|
||||
- Added support for Darwin, updated spec file
|
||||
|
||||
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
|
||||
- Re-integrated spec file into SDL distribution
|
||||
- 'name' and 'version' come from configure
|
||||
- Some of the documentation is devel specific
|
||||
- Removed SMP support from %build - it doesn't work with libtool anyway
|
||||
|
||||
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
|
||||
- Hacked Mandrake sdl spec to build 1.1
|
||||
|
||||
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
- Build Release
|
||||
|
||||
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
|
||||
- Added docs
|
||||
|
||||
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
|
||||
- v 1.0.0
|
||||
|
||||
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
|
||||
- First spec file for Mandrake distribution.
|
||||
|
||||
# end of file
|
||||
115
project/jni/sdl-2.0/SDL2.spec.in.rej
Normal file
115
project/jni/sdl-2.0/SDL2.spec.in.rej
Normal file
@@ -0,0 +1,115 @@
|
||||
--- SDL2.spec.in 2013-10-08 17:46:42.388028693 +0200
|
||||
+++ SDL2.spec.in 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,112 +0,0 @@
|
||||
-Summary: Simple DirectMedia Layer
|
||||
-Name: SDL2
|
||||
-Version: @SDL_VERSION@
|
||||
-Release: 1
|
||||
-Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
|
||||
-URL: http://www.libsdl.org/
|
||||
-License: zlib
|
||||
-Group: System Environment/Libraries
|
||||
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
-Prefix: %{_prefix}
|
||||
-%ifos linux
|
||||
-Provides: libSDL2-2.0.so.0
|
||||
-%endif
|
||||
-
|
||||
-%define __defattr %defattr(-,root,root)
|
||||
-%define __soext so
|
||||
-
|
||||
-%description
|
||||
-This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
-level access to audio, keyboard, mouse, and display framebuffer across
|
||||
-multiple platforms.
|
||||
-
|
||||
-%package devel
|
||||
-Summary: Libraries, includes and more to develop SDL applications.
|
||||
-Group: Development/Libraries
|
||||
-Requires: %{name} = %{version}
|
||||
-
|
||||
-%description devel
|
||||
-This is the Simple DirectMedia Layer, a generic API that provides low
|
||||
-level access to audio, keyboard, mouse, and display framebuffer across
|
||||
-multiple platforms.
|
||||
-
|
||||
-This is the libraries, include files and other resources you can use
|
||||
-to develop SDL applications.
|
||||
-
|
||||
-
|
||||
-%prep
|
||||
-%setup -q
|
||||
-
|
||||
-%build
|
||||
-%ifos linux
|
||||
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
|
||||
-%else
|
||||
-%configure
|
||||
-%endif
|
||||
-make
|
||||
-
|
||||
-%install
|
||||
-rm -rf $RPM_BUILD_ROOT
|
||||
-%ifos linux
|
||||
-make install prefix=$RPM_BUILD_ROOT%{prefix} \
|
||||
- bindir=$RPM_BUILD_ROOT%{_bindir} \
|
||||
- libdir=$RPM_BUILD_ROOT%{_libdir} \
|
||||
- includedir=$RPM_BUILD_ROOT%{_includedir} \
|
||||
- datadir=$RPM_BUILD_ROOT%{_datadir} \
|
||||
- mandir=$RPM_BUILD_ROOT%{_mandir}
|
||||
-%else
|
||||
-%makeinstall
|
||||
-%endif
|
||||
-
|
||||
-%clean
|
||||
-rm -rf $RPM_BUILD_ROOT
|
||||
-
|
||||
-%files
|
||||
-%{__defattr}
|
||||
-%doc README-SDL.txt COPYING CREDITS BUGS
|
||||
-%{_libdir}/lib*.%{__soext}.*
|
||||
-
|
||||
-%files devel
|
||||
-%{__defattr}
|
||||
-%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew
|
||||
-%{_bindir}/*-config
|
||||
-%{_libdir}/lib*.a
|
||||
-%{_libdir}/lib*.la
|
||||
-%{_libdir}/lib*.%{__soext}
|
||||
-%{_includedir}/*/*.h
|
||||
-%{_libdir}/pkgconfig/*
|
||||
-%{_datadir}/aclocal/*
|
||||
-
|
||||
-%changelog
|
||||
-* Sun Jan 22 2012 Sam Lantinga <slouken@libsdl.org>
|
||||
-- Updated for SDL 2.0
|
||||
-
|
||||
-* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
|
||||
-- Removed support for Darwin, due to build problems on ps2linux
|
||||
-
|
||||
-* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
|
||||
-- Added support for Darwin, updated spec file
|
||||
-
|
||||
-* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
|
||||
-- Re-integrated spec file into SDL distribution
|
||||
-- 'name' and 'version' come from configure
|
||||
-- Some of the documentation is devel specific
|
||||
-- Removed SMP support from %build - it doesn't work with libtool anyway
|
||||
-
|
||||
-* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
|
||||
-- Hacked Mandrake sdl spec to build 1.1
|
||||
-
|
||||
-* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
-- Build Release
|
||||
-
|
||||
-* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
|
||||
-- Add symlink for libSDL-1.0.so.0 required by sdlbomber
|
||||
-- Added docs
|
||||
-
|
||||
-* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
|
||||
-- v 1.0.0
|
||||
-
|
||||
-* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
|
||||
-- First spec file for Mandrake distribution.
|
||||
-
|
||||
-# end of file
|
||||
16
project/jni/sdl-2.0/TODO
Normal file
16
project/jni/sdl-2.0/TODO
Normal file
@@ -0,0 +1,16 @@
|
||||
2.0 release checklist:
|
||||
* http://wiki.libsdl.org/moin.cgi/Roadmap
|
||||
|
||||
* 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
|
||||
* Write automated test case for multi-draw APIs
|
||||
* Implement assertion code on iPhone
|
||||
* Add __WINDOWS__ in addition to __WIN32__
|
||||
|
||||
* Check 1.2 revisions:
|
||||
3554 - Need to resolve semantics for locking keys on different platforms
|
||||
4874 - Do we want screen rotation? At what level?
|
||||
4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
|
||||
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)
|
||||
15
project/jni/sdl-2.0/TODO.txt
Normal file
15
project/jni/sdl-2.0/TODO.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
Future work roadmap:
|
||||
* http://wiki.libsdl.org/moin.cgi/Roadmap
|
||||
|
||||
* See why windows are being rearranged. Is the shield window not up?
|
||||
* Add __WINDOWS__ in addition to __WIN32__
|
||||
* Write test for fullscreen gamma to check X11 colormap handling
|
||||
|
||||
* Check 1.2 revisions:
|
||||
3554 - Need to resolve semantics for locking keys on different platforms
|
||||
4874 - Do we want screen rotation? At what level?
|
||||
4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
|
||||
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)
|
||||
|
||||
1
project/jni/sdl-2.0/UNDER_CONSTRUCTION.txt
Normal file
1
project/jni/sdl-2.0/UNDER_CONSTRUCTION.txt
Normal file
@@ -0,0 +1 @@
|
||||
WARNING: This code is under construction, may not build, and is unstable!
|
||||
148
project/jni/sdl-2.0/VisualC.html
Normal file
148
project/jni/sdl-2.0/VisualC.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Using SDL with Microsoft Visual C++</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>
|
||||
Using SDL with Microsoft Visual C++
|
||||
</H1>
|
||||
<H3>
|
||||
by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
|
||||
James Turk</A>
|
||||
</H3>
|
||||
<p>
|
||||
You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php"> the SDL Download web site </A>, or you can build SDL yourself.
|
||||
</p>
|
||||
<H3>
|
||||
Building SDL
|
||||
</H3>
|
||||
<P>
|
||||
Go into the VisualC directory and double-click on the Visual Studio solution for your version of Visual Studio, e.g. <CODE>SDL_VS2008.sln</CODE> This should open up the IDE.
|
||||
</P>
|
||||
<P>
|
||||
There are different solution files for the various
|
||||
versions of the IDE. Please use the appropiate version
|
||||
2008, 2010 or 2012; the 2010EE and 2012EE files
|
||||
should be used with the "Express Edition" releases.
|
||||
</P>
|
||||
<P>
|
||||
Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
|
||||
</P>
|
||||
<P>
|
||||
This is done by right clicking on each project in turn (Projects are listed in
|
||||
the Workspace panel in the FileView tab), and selecting "Build".
|
||||
</P>
|
||||
<P>
|
||||
You may get a few warnings, but you should not get any errors. You do have to
|
||||
have at least the DirectX 9 SDK installed, however. The latest
|
||||
version of DirectX can be downloaded from <A HREF="http://www.microsoft.com">Microsoft</A>.
|
||||
</P>
|
||||
<P>
|
||||
Later, we will refer to the following .lib and .dll files that have just been
|
||||
generated:
|
||||
</P>
|
||||
<ul>
|
||||
<li> SDL2.dll</li>
|
||||
<li> SDL2.lib</li>
|
||||
<li> SDL2main.lib</li>
|
||||
</ul>
|
||||
<P>
|
||||
Search for these using the Windows Find (Windows-F) utility inside the VisualC directory.
|
||||
</P>
|
||||
<H3>
|
||||
Creating a Project with SDL
|
||||
</H3>
|
||||
<P>
|
||||
Create a project as a Win32 Application.
|
||||
</P>
|
||||
<P>
|
||||
Create a C++ file for your project.
|
||||
</P>
|
||||
<P>
|
||||
Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
|
||||
tab|Code Generation|Runtime Library </CODE>.
|
||||
</P>
|
||||
<P>
|
||||
Add the SDL <CODE>include</CODE> directory to your list of includes in the
|
||||
menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
|
||||
.
|
||||
<br>
|
||||
<STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
|
||||
add the include and library directories to the list that VC7 keeps. Do this by
|
||||
selecting Tools|Options|Projects|VC++ Directories and under the "Show
|
||||
Directories For:" dropbox select "Include Files", and click the "New Directory
|
||||
Icon" and add the [SDLROOT]\include directory (e.g. If you installed to
|
||||
c:\SDL\ add c:\SDL\include). Proceed to change the
|
||||
dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
|
||||
</P>
|
||||
<P>
|
||||
The "include directory" I am referring to is the <CODE>include</CODE> folder
|
||||
within the main SDL directory (the one that this HTML file located within).
|
||||
</P>
|
||||
<P>
|
||||
Now we're going to use the files that we had created earlier in the Build SDL
|
||||
step.
|
||||
</P>
|
||||
<P>
|
||||
Copy the following files into your Project directory:
|
||||
</P>
|
||||
<ul>
|
||||
<li> SDL2.dll</li>
|
||||
</ul>
|
||||
<P>
|
||||
Add the following files to your project (It is not necessary to copy them to
|
||||
your project directory):
|
||||
</P>
|
||||
<ul>
|
||||
<li> SDL2.lib </li>
|
||||
<li> SDL2main.lib</li>
|
||||
</ul>
|
||||
<P>
|
||||
(To add them to your project, right click on your project, and select "Add
|
||||
files to project")
|
||||
</P>
|
||||
<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
|
||||
desireable to add them to the linker options: Project|Properties|Linker|Command
|
||||
Line and type the names of the libraries to link with in the "Additional
|
||||
Options:" box. Note: This must be done for each build
|
||||
configuration (e.g. Release,Debug).</FONT></STRONG></P>
|
||||
<H3>
|
||||
SDL 101, First Day of Class
|
||||
</H3>
|
||||
<P>
|
||||
Now create the basic body of your project. The body of your program should take
|
||||
the following form: <CODE>
|
||||
<PRE>
|
||||
#include "SDL.h"
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
// Body of the program goes here.
|
||||
return 0;
|
||||
}
|
||||
</PRE>
|
||||
</CODE>
|
||||
<P></P>
|
||||
<H3>
|
||||
That's it!
|
||||
</H3>
|
||||
<P>
|
||||
I hope that this document has helped you get through the most difficult part of
|
||||
using the SDL: installing it. Suggestions for improvements to this document
|
||||
should be sent to the writers of this document.
|
||||
</P>
|
||||
<P>
|
||||
Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
|
||||
</P>
|
||||
<P>
|
||||
This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
|
||||
Sam Lantinga</A>.
|
||||
</P>
|
||||
<P>
|
||||
Later, it was converted to HTML and expanded into the document that you see
|
||||
today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
|
||||
</P>
|
||||
<P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
|
||||
</P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
project/jni/sdl-2.0/VisualC.html.orig
Normal file
148
project/jni/sdl-2.0/VisualC.html.orig
Normal file
@@ -0,0 +1,148 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Using SDL with Microsoft Visual C++</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>
|
||||
Using SDL with Microsoft Visual C++
|
||||
</H1>
|
||||
<H3>
|
||||
by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
|
||||
James Turk</A>
|
||||
</H3>
|
||||
<p>
|
||||
You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php"> the SDL Download web site </A>, or you can build SDL yourself.
|
||||
</p>
|
||||
<H3>
|
||||
Building SDL
|
||||
</H3>
|
||||
<P>
|
||||
Go into the VisualC directory and double-click on the Visual Studio solution for your version of Visual Studio, e.g. <CODE>SDL_VS2008.sln</CODE> This should open up the IDE.
|
||||
</P>
|
||||
<P>
|
||||
There are different solution files for the various
|
||||
versions of the IDE. Please use the appropiate version
|
||||
2008, 2010 or 2012; the 2010EE and 2012EE files
|
||||
should be used with the "Express Edition" releases.
|
||||
</P>
|
||||
<P>
|
||||
Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
|
||||
</P>
|
||||
<P>
|
||||
This is done by right clicking on each project in turn (Projects are listed in
|
||||
the Workspace panel in the FileView tab), and selecting "Build".
|
||||
</P>
|
||||
<P>
|
||||
You may get a few warnings, but you should not get any errors. You do have to
|
||||
have at least the DirectX 9 SDK installed, however. The latest
|
||||
version of DirectX can be downloaded from <A HREF="http://www.microsoft.com">Microsoft</A>.
|
||||
</P>
|
||||
<P>
|
||||
Later, we will refer to the following .lib and .dll files that have just been
|
||||
generated:
|
||||
</P>
|
||||
<ul>
|
||||
<li> SDL2.dll</li>
|
||||
<li> SDL2.lib</li>
|
||||
<li> SDL2main.lib</li>
|
||||
</ul>
|
||||
<P>
|
||||
Search for these using the Windows Find (Windows-F) utility inside the VisualC directory.
|
||||
</P>
|
||||
<H3>
|
||||
Creating a Project with SDL
|
||||
</H3>
|
||||
<P>
|
||||
Create a project as a Win32 Application.
|
||||
</P>
|
||||
<P>
|
||||
Create a C++ file for your project.
|
||||
</P>
|
||||
<P>
|
||||
Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
|
||||
tab|Code Generation|Runtime Library </CODE>.
|
||||
</P>
|
||||
<P>
|
||||
Add the SDL <CODE>include</CODE> directory to your list of includes in the
|
||||
menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
|
||||
.
|
||||
<br>
|
||||
<STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
|
||||
add the include and library directories to the list that VC7 keeps. Do this by
|
||||
selecting Tools|Options|Projects|VC++ Directories and under the "Show
|
||||
Directories For:" dropbox select "Include Files", and click the "New Directory
|
||||
Icon" and add the [SDLROOT]\include directory (e.g. If you installed to
|
||||
c:\SDL\ add c:\SDL\include). Proceed to change the
|
||||
dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
|
||||
</P>
|
||||
<P>
|
||||
The "include directory" I am referring to is the <CODE>include</CODE> folder
|
||||
within the main SDL directory (the one that this HTML file located within).
|
||||
</P>
|
||||
<P>
|
||||
Now we're going to use the files that we had created earlier in the Build SDL
|
||||
step.
|
||||
</P>
|
||||
<P>
|
||||
Copy the following files into your Project directory:
|
||||
</P>
|
||||
<ul>
|
||||
<li> SDL2.dll</li>
|
||||
</ul>
|
||||
<P>
|
||||
Add the following files to your project (It is not necessary to copy them to
|
||||
your project directory):
|
||||
</P>
|
||||
<ul>
|
||||
<li> SDL2.lib </li>
|
||||
<li> SDL2main.lib</li>
|
||||
</ul>
|
||||
<P>
|
||||
(To add them to your project, right click on your project, and select "Add
|
||||
files to project")
|
||||
</P>
|
||||
<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
|
||||
desireable to add them to the linker options: Project|Properties|Linker|Command
|
||||
Line and type the names of the libraries to link with in the "Additional
|
||||
Options:" box. Note: This must be done for each build
|
||||
configuration (e.g. Release,Debug).</FONT></STRONG></P>
|
||||
<H3>
|
||||
SDL 101, First Day of Class
|
||||
</H3>
|
||||
<P>
|
||||
Now create the basic body of your project. The body of your program should take
|
||||
the following form: <CODE>
|
||||
<PRE>
|
||||
#include "SDL.h"
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
// Body of the program goes here.
|
||||
return 0;
|
||||
}
|
||||
</PRE>
|
||||
</CODE>
|
||||
<P></P>
|
||||
<H3>
|
||||
That's it!
|
||||
</H3>
|
||||
<P>
|
||||
I hope that this document has helped you get through the most difficult part of
|
||||
using the SDL: installing it. Suggestions for improvements to this document
|
||||
should be sent to the writers of this document.
|
||||
</P>
|
||||
<P>
|
||||
Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
|
||||
</P>
|
||||
<P>
|
||||
This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
|
||||
Sam Lantinga</A>.
|
||||
</P>
|
||||
<P>
|
||||
Later, it was converted to HTML and expanded into the document that you see
|
||||
today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
|
||||
</P>
|
||||
<P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
|
||||
</P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
160
project/jni/sdl-2.0/VisualC.html.rej
Normal file
160
project/jni/sdl-2.0/VisualC.html.rej
Normal file
@@ -0,0 +1,160 @@
|
||||
--- VisualC.html 2013-10-08 17:46:42.388028693 +0200
|
||||
+++ VisualC.html 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,157 +0,0 @@
|
||||
-<HTML>
|
||||
- <HEAD>
|
||||
- <TITLE>Using SDL with Microsoft Visual C++</TITLE>
|
||||
- </HEAD>
|
||||
- <BODY>
|
||||
- <H1>
|
||||
- Using SDL with Microsoft Visual C++ 5,6 and 7
|
||||
- </H1>
|
||||
- <H3>
|
||||
- by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
|
||||
- James Turk</A>
|
||||
- </H3>
|
||||
- <p>
|
||||
- You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php">
|
||||
- the SDL Download web site </A>, or you can build SDL yourself.
|
||||
- </p>
|
||||
- <H3>
|
||||
- Building SDL
|
||||
- </H3>
|
||||
- <P>
|
||||
- Go into the VisualC directory and double-click on the VC++ file "<CODE>SDL.dsw</CODE>" <STRONG><FONT color="#009900">("<CODE>SDL.sln</CODE>")</FONT></STRONG>. This should open up the IDE.
|
||||
- </P>
|
||||
- <P>
|
||||
- You may be prompted at this point to upgrade the workspace, should you be using
|
||||
- a more recent version of Visual C++. If so, allow the workspace to be upgraded.
|
||||
- </P>
|
||||
- <P>
|
||||
- Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
|
||||
- </P>
|
||||
- <P>
|
||||
- This is done by right clicking on each project in turn (Projects are listed in
|
||||
- the Workspace panel in the FileView tab), and selecting "Build".
|
||||
- </P>
|
||||
- <P>
|
||||
- If you get an error about SDL_config.h being missing, you should
|
||||
- copy include/SDL_config.h.default to include/SDL_config.h and try again.
|
||||
- </P>
|
||||
- <P>
|
||||
- You may get a few warnings, but you should not get any errors. You do have to
|
||||
- have at least the DirectX 5 SDK installed, however. The latest
|
||||
- version of DirectX can be downloaded or purchased on a cheap CD (my
|
||||
- recommendation) from <A HREF="http://www.microsoft.com">Microsoft </A>.
|
||||
- </P>
|
||||
- <P>
|
||||
- Later, we will refer to the following .lib and .dll files that have just been
|
||||
- generated:
|
||||
- </P>
|
||||
- <ul>
|
||||
- <li> SDL.dll</li>
|
||||
- <li> SDL.lib</li>
|
||||
- <li> SDLmain.lib</li>
|
||||
- </ul>
|
||||
- <P>
|
||||
- Search for these using the Windows Find (Windows-F) utility, if you don't
|
||||
- already know where they should be. For those of you with a clue, look inside
|
||||
- the Debug or Release directories of the subdirectories of the Project folder.
|
||||
- (It might be easier to just use Windows Find if this sounds confusing. And
|
||||
- don't worry about needing a clue; we all need visits from the clue fairy
|
||||
- frequently.)
|
||||
- </P>
|
||||
- <H3>
|
||||
- Creating a Project with SDL
|
||||
- </H3>
|
||||
- <P>
|
||||
- Create a project as a Win32 Application.
|
||||
- </P>
|
||||
- <P>
|
||||
- Create a C++ file for your project.
|
||||
- </P>
|
||||
- <P>
|
||||
- Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
|
||||
- tab|Code Generation|Runtime Library </CODE>.
|
||||
- </P>
|
||||
- <P>
|
||||
- Add the SDL <CODE>include</CODE> directory to your list of includes in the
|
||||
- menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
|
||||
- .
|
||||
- <br>
|
||||
- <STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
|
||||
- add the include and library directories to the list that VC7 keeps. Do this by
|
||||
- selecting Tools|Options|Projects|VC++ Directories and under the "Show
|
||||
- Directories For:" dropbox select "Include Files", and click the "New Directory
|
||||
- Icon" and add the [SDLROOT]\include directory (ex. If you installed to
|
||||
- c:\SDL-1.2.5\ add c:\SDL-1.2.5\include). Proceed to change the
|
||||
- dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
|
||||
- </P>
|
||||
- <P>
|
||||
- The "include directory" I am referring to is the <CODE>include</CODE> folder
|
||||
- within the main SDL directory (the one that this HTML file located within).
|
||||
- </P>
|
||||
- <P>
|
||||
- Now we're going to use the files that we had created earlier in the Build SDL
|
||||
- step.
|
||||
- </P>
|
||||
- <P>
|
||||
- Copy the following files into your Project directory:
|
||||
- </P>
|
||||
- <ul>
|
||||
- <li> SDL.dll</li>
|
||||
- </ul>
|
||||
- <P>
|
||||
- Add the following files to your project (It is not necessary to copy them to
|
||||
- your project directory):
|
||||
- </P>
|
||||
- <ul>
|
||||
- <li> SDL.lib </li>
|
||||
- <li> SDLmain.lib</li>
|
||||
- </ul>
|
||||
- <P>
|
||||
- (To add them to your project, right click on your project, and select "Add
|
||||
- files to project")
|
||||
- </P>
|
||||
- <P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
|
||||
- desireable to add them to the linker options: Project|Properties|Linker|Command
|
||||
- Line and type the names of the libraries to link with in the "Additional
|
||||
- Options:" box. Note: This must be done for each build
|
||||
- configuration (eg. Release,Debug).</FONT></STRONG></P>
|
||||
- <H3>
|
||||
- SDL 101, First Day of Class
|
||||
- </H3>
|
||||
- <P>
|
||||
- Now create the basic body of your project. The body of your program should take
|
||||
- the following form: <CODE>
|
||||
- <PRE>
|
||||
-#include "SDL.h"
|
||||
-
|
||||
-int main( int argc, char* argv[] )
|
||||
-{
|
||||
- // Body of the program goes here.
|
||||
- return 0;
|
||||
-}
|
||||
-</PRE>
|
||||
- </CODE>
|
||||
- <P></P>
|
||||
- <H3>
|
||||
- That's it!
|
||||
- </H3>
|
||||
- <P>
|
||||
- I hope that this document has helped you get through the most difficult part of
|
||||
- using the SDL: installing it. Suggestions for improvements to this document
|
||||
- should be sent to the writers of this document.
|
||||
- </P>
|
||||
- <P>
|
||||
- Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
|
||||
- </P>
|
||||
- <P>
|
||||
- This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
|
||||
- Sam Lantinga</A>.
|
||||
- </P>
|
||||
- <P>
|
||||
- Later, it was converted to HTML and expanded into the document that you see
|
||||
- today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
|
||||
- </P>
|
||||
- <P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
|
||||
- </P>
|
||||
- </BODY>
|
||||
-</HTML>
|
||||
3
project/jni/sdl-2.0/WhatsNew
Normal file
3
project/jni/sdl-2.0/WhatsNew
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
This is a list of API changes in SDL's version history.
|
||||
|
||||
3
project/jni/sdl-2.0/WhatsNew.txt
Normal file
3
project/jni/sdl-2.0/WhatsNew.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
This is a list of API changes in SDL's version history.
|
||||
|
||||
0
project/jni/sdl-2.0/aclocal.m4.orig
vendored
Normal file
0
project/jni/sdl-2.0/aclocal.m4.orig
vendored
Normal file
9489
project/jni/sdl-2.0/aclocal.m4.rej
vendored
Normal file
9489
project/jni/sdl-2.0/aclocal.m4.rej
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
project/jni/sdl-2.0/android-project/AndroidManifest.xml
Normal file
41
project/jni/sdl-2.0/android-project/AndroidManifest.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
|
||||
com.gamemaker.game
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.libsdl.app"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
android:installLocation="auto">
|
||||
|
||||
<!-- Create a Java class extending SDLActivity and place it in a
|
||||
directory under src matching the package, e.g.
|
||||
src/com/gamemaker/game/MyGame.java
|
||||
|
||||
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
||||
in the XML below.
|
||||
|
||||
An example Java class can be found in README-android.txt
|
||||
-->
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:allowBackup="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity android:name="SDLActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<!-- Android 2.3.3 -->
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />
|
||||
|
||||
<!-- OpenGL ES 2.0 -->
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
</manifest>
|
||||
17
project/jni/sdl-2.0/android-project/ant.properties
Normal file
17
project/jni/sdl-2.0/android-project/ant.properties
Normal file
@@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
17
project/jni/sdl-2.0/android-project/build.properties
Normal file
17
project/jni/sdl-2.0/android-project/build.properties
Normal file
@@ -0,0 +1,17 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
93
project/jni/sdl-2.0/android-project/build.xml
Normal file
93
project/jni/sdl-2.0/android-project/build.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This should be changed to the name of your project -->
|
||||
<project name="SDLActivity" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
||||
11
project/jni/sdl-2.0/android-project/default.properties
Normal file
11
project/jni/sdl-2.0/android-project/default.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-7
|
||||
1
project/jni/sdl-2.0/android-project/jni/Android.mk
Normal file
1
project/jni/sdl-2.0/android-project/jni/Android.mk
Normal file
@@ -0,0 +1 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
4
project/jni/sdl-2.0/android-project/jni/Application.mk
Normal file
4
project/jni/sdl-2.0/android-project/jni/Application.mk
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
# Uncomment this if you're using STL in your project
|
||||
# See CPLUSPLUS-SUPPORT.html in the NDK documentation for more information
|
||||
# APP_STL := stlport_static
|
||||
19
project/jni/sdl-2.0/android-project/jni/src/Android.mk
Normal file
19
project/jni/sdl-2.0/android-project/jni/src/Android.mk
Normal file
@@ -0,0 +1,19 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := main
|
||||
|
||||
SDL_PATH := ../SDL
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include
|
||||
|
||||
# Add your application source files here...
|
||||
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \
|
||||
YourSourceHere.c
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := SDL2
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv1_CM -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
20
project/jni/sdl-2.0/android-project/proguard-project.txt
Normal file
20
project/jni/sdl-2.0/android-project/proguard-project.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
14
project/jni/sdl-2.0/android-project/project.properties
Normal file
14
project/jni/sdl-2.0/android-project/project.properties
Normal file
@@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
13
project/jni/sdl-2.0/android-project/res/layout/main.xml
Normal file
13
project/jni/sdl-2.0/android-project/res/layout/main.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, SDLActivity"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">SDL App</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,906 @@
|
||||
package org.libsdl.app;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
import android.app.*;
|
||||
import android.content.*;
|
||||
import android.view.*;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AbsoluteLayout;
|
||||
import android.os.*;
|
||||
import android.util.Log;
|
||||
import android.graphics.*;
|
||||
import android.media.*;
|
||||
import android.hardware.*;
|
||||
|
||||
|
||||
/**
|
||||
SDL Activity
|
||||
*/
|
||||
public class SDLActivity extends Activity {
|
||||
private static final String TAG = "SDL";
|
||||
|
||||
// Keep track of the paused state
|
||||
public static boolean mIsPaused = false, mIsSurfaceReady = false, mHasFocus = true;
|
||||
|
||||
// Main components
|
||||
protected static SDLActivity mSingleton;
|
||||
protected static SDLSurface mSurface;
|
||||
protected static View mTextEdit;
|
||||
protected static ViewGroup mLayout;
|
||||
|
||||
// This is what SDL runs in. It invokes SDL_main(), eventually
|
||||
protected static Thread mSDLThread;
|
||||
|
||||
// Audio
|
||||
protected static Thread mAudioThread;
|
||||
protected static AudioTrack mAudioTrack;
|
||||
|
||||
// EGL objects
|
||||
protected static EGLContext mEGLContext;
|
||||
protected static EGLSurface mEGLSurface;
|
||||
protected static EGLDisplay mEGLDisplay;
|
||||
protected static EGLConfig mEGLConfig;
|
||||
protected static int mGLMajor, mGLMinor;
|
||||
|
||||
// Load the .so
|
||||
static {
|
||||
System.loadLibrary("SDL2");
|
||||
//System.loadLibrary("SDL2_image");
|
||||
//System.loadLibrary("SDL2_mixer");
|
||||
//System.loadLibrary("SDL2_net");
|
||||
//System.loadLibrary("SDL2_ttf");
|
||||
System.loadLibrary("main");
|
||||
}
|
||||
|
||||
// Setup
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
//Log.v("SDL", "onCreate()");
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// So we can call stuff from static callbacks
|
||||
mSingleton = this;
|
||||
|
||||
// Set up the surface
|
||||
mEGLSurface = EGL10.EGL_NO_SURFACE;
|
||||
mSurface = new SDLSurface(getApplication());
|
||||
mEGLContext = EGL10.EGL_NO_CONTEXT;
|
||||
|
||||
mLayout = new AbsoluteLayout(this);
|
||||
mLayout.addView(mSurface);
|
||||
|
||||
setContentView(mLayout);
|
||||
}
|
||||
|
||||
// Events
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Log.v("SDL", "onPause()");
|
||||
super.onPause();
|
||||
SDLActivity.handlePause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
Log.v("SDL", "onResume()");
|
||||
super.onResume();
|
||||
SDLActivity.handleResume();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
Log.v("SDL", "onWindowFocusChanged(): " + hasFocus);
|
||||
|
||||
SDLActivity.mHasFocus = hasFocus;
|
||||
if (hasFocus) {
|
||||
SDLActivity.handleResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
Log.v("SDL", "onLowMemory()");
|
||||
super.onLowMemory();
|
||||
SDLActivity.nativeLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.v("SDL", "onDestroy()");
|
||||
// Send a quit message to the application
|
||||
SDLActivity.nativeQuit();
|
||||
|
||||
// Now wait for the SDL thread to quit
|
||||
if (mSDLThread != null) {
|
||||
try {
|
||||
mSDLThread.join();
|
||||
} catch(Exception e) {
|
||||
Log.v("SDL", "Problem stopping thread: " + e);
|
||||
}
|
||||
mSDLThread = null;
|
||||
|
||||
//Log.v("SDL", "Finished waiting for SDL thread");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
int keyCode = event.getKeyCode();
|
||||
// Ignore volume keys so they're handled by Android
|
||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
|
||||
return false;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
/** Called by onPause or surfaceDestroyed. Even if surfaceDestroyed
|
||||
* is the first to be called, mIsSurfaceReady should still be set
|
||||
* to 'true' during the call to onPause (in a usual scenario).
|
||||
*/
|
||||
public static void handlePause() {
|
||||
if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) {
|
||||
SDLActivity.mIsPaused = true;
|
||||
SDLActivity.nativePause();
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, false);
|
||||
}
|
||||
}
|
||||
|
||||
/** Called by onResume or surfaceCreated. An actual resume should be done only when the surface is ready.
|
||||
* Note: Some Android variants may send multiple surfaceChanged events, so we don't need to resume
|
||||
* every time we get one of those events, only if it comes after surfaceDestroyed
|
||||
*/
|
||||
public static void handleResume() {
|
||||
if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) {
|
||||
SDLActivity.mIsPaused = false;
|
||||
SDLActivity.nativeResume();
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Messages from the SDLMain thread
|
||||
static final int COMMAND_CHANGE_TITLE = 1;
|
||||
static final int COMMAND_UNUSED = 2;
|
||||
static final int COMMAND_TEXTEDIT_HIDE = 3;
|
||||
|
||||
protected static final int COMMAND_USER = 0x8000;
|
||||
|
||||
/**
|
||||
* This method is called by SDL if SDL did not handle a message itself.
|
||||
* This happens if a received message contains an unsupported command.
|
||||
* Method can be overwritten to handle Messages in a different class.
|
||||
* @param command the command of the message.
|
||||
* @param param the parameter of the message. May be null.
|
||||
* @return if the message was handled in overridden method.
|
||||
*/
|
||||
protected boolean onUnhandledMessage(int command, Object param) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Handler class for Messages from native SDL applications.
|
||||
* It uses current Activities as target (e.g. for the title).
|
||||
* static to prevent implicit references to enclosing object.
|
||||
*/
|
||||
protected static class SDLCommandHandler extends Handler {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
Log.e(TAG, "error handling message, getContext() returned null");
|
||||
return;
|
||||
}
|
||||
switch (msg.arg1) {
|
||||
case COMMAND_CHANGE_TITLE:
|
||||
if (context instanceof Activity) {
|
||||
((Activity) context).setTitle((String)msg.obj);
|
||||
} else {
|
||||
Log.e(TAG, "error handling message, getContext() returned no Activity");
|
||||
}
|
||||
break;
|
||||
case COMMAND_TEXTEDIT_HIDE:
|
||||
if (mTextEdit != null) {
|
||||
mTextEdit.setVisibility(View.GONE);
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) {
|
||||
Log.e(TAG, "error handling message, command is " + msg.arg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handler for the messages
|
||||
Handler commandHandler = new SDLCommandHandler();
|
||||
|
||||
// Send a message from the SDLMain thread
|
||||
boolean sendCommand(int command, Object data) {
|
||||
Message msg = commandHandler.obtainMessage();
|
||||
msg.arg1 = command;
|
||||
msg.obj = data;
|
||||
return commandHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
// C functions we call
|
||||
public static native void nativeInit();
|
||||
public static native void nativeLowMemory();
|
||||
public static native void nativeQuit();
|
||||
public static native void nativePause();
|
||||
public static native void nativeResume();
|
||||
public static native void onNativeResize(int x, int y, int format);
|
||||
public static native void onNativeKeyDown(int keycode);
|
||||
public static native void onNativeKeyUp(int keycode);
|
||||
public static native void onNativeKeyboardFocusLost();
|
||||
public static native void onNativeTouch(int touchDevId, int pointerFingerId,
|
||||
int action, float x,
|
||||
float y, float p);
|
||||
public static native void onNativeAccel(float x, float y, float z);
|
||||
|
||||
// Java functions called from C
|
||||
|
||||
public static boolean createGLContext(int majorVersion, int minorVersion, int[] attribs) {
|
||||
return initEGL(majorVersion, minorVersion, attribs);
|
||||
}
|
||||
|
||||
public static void deleteGLContext() {
|
||||
if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLContext != EGL10.EGL_NO_CONTEXT) {
|
||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||
egl.eglMakeCurrent(SDLActivity.mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
|
||||
egl.eglDestroyContext(SDLActivity.mEGLDisplay, SDLActivity.mEGLContext);
|
||||
SDLActivity.mEGLContext = EGL10.EGL_NO_CONTEXT;
|
||||
|
||||
if (SDLActivity.mEGLSurface != EGL10.EGL_NO_SURFACE) {
|
||||
egl.eglDestroySurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface);
|
||||
SDLActivity.mEGLSurface = EGL10.EGL_NO_SURFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void flipBuffers() {
|
||||
flipEGL();
|
||||
}
|
||||
|
||||
public static boolean setActivityTitle(String title) {
|
||||
// Called from SDLMain() thread and can't directly affect the view
|
||||
return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title);
|
||||
}
|
||||
|
||||
public static boolean sendMessage(int command, int param) {
|
||||
return mSingleton.sendCommand(command, Integer.valueOf(param));
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return mSingleton;
|
||||
}
|
||||
|
||||
static class ShowTextInputTask implements Runnable {
|
||||
/*
|
||||
* This is used to regulate the pan&scan method to have some offset from
|
||||
* the bottom edge of the input region and the top edge of an input
|
||||
* method (soft keyboard)
|
||||
*/
|
||||
static final int HEIGHT_PADDING = 15;
|
||||
|
||||
public int x, y, w, h;
|
||||
|
||||
public ShowTextInputTask(int x, int y, int w, int h) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(
|
||||
w, h + HEIGHT_PADDING, x, y);
|
||||
|
||||
if (mTextEdit == null) {
|
||||
mTextEdit = new DummyEdit(getContext());
|
||||
|
||||
mLayout.addView(mTextEdit, params);
|
||||
} else {
|
||||
mTextEdit.setLayoutParams(params);
|
||||
}
|
||||
|
||||
mTextEdit.setVisibility(View.VISIBLE);
|
||||
mTextEdit.requestFocus();
|
||||
|
||||
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showSoftInput(mTextEdit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean showTextInput(int x, int y, int w, int h) {
|
||||
// Transfer the task to the main thread as a Runnable
|
||||
return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h));
|
||||
}
|
||||
|
||||
|
||||
// EGL functions
|
||||
public static boolean initEGL(int majorVersion, int minorVersion, int[] attribs) {
|
||||
try {
|
||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||
|
||||
if (SDLActivity.mEGLDisplay == null) {
|
||||
SDLActivity.mEGLDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
|
||||
int[] version = new int[2];
|
||||
egl.eglInitialize(SDLActivity.mEGLDisplay, version);
|
||||
}
|
||||
|
||||
if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLContext == EGL10.EGL_NO_CONTEXT) {
|
||||
// No current GL context exists, we will create a new one.
|
||||
Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion);
|
||||
EGLConfig[] configs = new EGLConfig[128];
|
||||
int[] num_config = new int[1];
|
||||
if (!egl.eglChooseConfig(SDLActivity.mEGLDisplay, attribs, configs, 1, num_config) || num_config[0] == 0) {
|
||||
Log.e("SDL", "No EGL config available");
|
||||
return false;
|
||||
}
|
||||
EGLConfig config = null;
|
||||
int bestdiff = -1, bitdiff;
|
||||
int[] value = new int[1];
|
||||
|
||||
// eglChooseConfig returns a number of configurations that match or exceed the requested attribs.
|
||||
// From those, we select the one that matches our requirements more closely
|
||||
Log.v("SDL", "Got " + num_config[0] + " valid modes from egl");
|
||||
for(int i = 0; i < num_config[0]; i++) {
|
||||
bitdiff = 0;
|
||||
// Go through some of the attributes and compute the bit difference between what we want and what we get.
|
||||
for (int j = 0; ; j += 2) {
|
||||
if (attribs[j] == EGL10.EGL_NONE)
|
||||
break;
|
||||
|
||||
if (attribs[j+1] != EGL10.EGL_DONT_CARE && (attribs[j] == EGL10.EGL_RED_SIZE ||
|
||||
attribs[j] == EGL10.EGL_GREEN_SIZE ||
|
||||
attribs[j] == EGL10.EGL_BLUE_SIZE ||
|
||||
attribs[j] == EGL10.EGL_ALPHA_SIZE ||
|
||||
attribs[j] == EGL10.EGL_DEPTH_SIZE ||
|
||||
attribs[j] == EGL10.EGL_STENCIL_SIZE)) {
|
||||
egl.eglGetConfigAttrib(SDLActivity.mEGLDisplay, configs[i], attribs[j], value);
|
||||
bitdiff += value[0] - attribs[j + 1]; // value is always >= attrib
|
||||
}
|
||||
}
|
||||
|
||||
if (bitdiff < bestdiff || bestdiff == -1) {
|
||||
config = configs[i];
|
||||
bestdiff = bitdiff;
|
||||
}
|
||||
|
||||
if (bitdiff == 0) break; // we found an exact match!
|
||||
}
|
||||
|
||||
Log.d("SDL", "Selected mode with a total bit difference of " + bestdiff);
|
||||
|
||||
SDLActivity.mEGLConfig = config;
|
||||
SDLActivity.mGLMajor = majorVersion;
|
||||
SDLActivity.mGLMinor = minorVersion;
|
||||
}
|
||||
|
||||
return SDLActivity.createEGLSurface();
|
||||
|
||||
} catch(Exception e) {
|
||||
Log.v("SDL", e + "");
|
||||
for (StackTraceElement s : e.getStackTrace()) {
|
||||
Log.v("SDL", s.toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean createEGLContext() {
|
||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||
int EGL_CONTEXT_CLIENT_VERSION=0x3098;
|
||||
int contextAttrs[] = new int[] { EGL_CONTEXT_CLIENT_VERSION, SDLActivity.mGLMajor, EGL10.EGL_NONE };
|
||||
SDLActivity.mEGLContext = egl.eglCreateContext(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, EGL10.EGL_NO_CONTEXT, contextAttrs);
|
||||
if (SDLActivity.mEGLContext == EGL10.EGL_NO_CONTEXT) {
|
||||
Log.e("SDL", "Couldn't create context");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean createEGLSurface() {
|
||||
if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLConfig != null) {
|
||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||
if (SDLActivity.mEGLContext == EGL10.EGL_NO_CONTEXT) createEGLContext();
|
||||
|
||||
if (SDLActivity.mEGLSurface == EGL10.EGL_NO_SURFACE) {
|
||||
Log.v("SDL", "Creating new EGL Surface");
|
||||
SDLActivity.mEGLSurface = egl.eglCreateWindowSurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, SDLActivity.mSurface, null);
|
||||
if (SDLActivity.mEGLSurface == EGL10.EGL_NO_SURFACE) {
|
||||
Log.e("SDL", "Couldn't create surface");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else Log.v("SDL", "EGL Surface remains valid");
|
||||
|
||||
if (egl.eglGetCurrentContext() != SDLActivity.mEGLContext) {
|
||||
if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface, SDLActivity.mEGLSurface, SDLActivity.mEGLContext)) {
|
||||
Log.e("SDL", "Old EGL Context doesnt work, trying with a new one");
|
||||
// TODO: Notify the user via a message that the old context could not be restored, and that textures need to be manually restored.
|
||||
createEGLContext();
|
||||
if (!egl.eglMakeCurrent(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface, SDLActivity.mEGLSurface, SDLActivity.mEGLContext)) {
|
||||
Log.e("SDL", "Failed making EGL Context current");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else Log.v("SDL", "EGL Context made current");
|
||||
}
|
||||
else Log.v("SDL", "EGL Context remains current");
|
||||
|
||||
return true;
|
||||
} else {
|
||||
Log.e("SDL", "Surface creation failed, display = " + SDLActivity.mEGLDisplay + ", config = " + SDLActivity.mEGLConfig);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// EGL buffer flip
|
||||
public static void flipEGL() {
|
||||
try {
|
||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||
|
||||
egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
|
||||
|
||||
// drawing here
|
||||
|
||||
egl.eglWaitGL();
|
||||
|
||||
egl.eglSwapBuffers(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface);
|
||||
|
||||
|
||||
} catch(Exception e) {
|
||||
Log.v("SDL", "flipEGL(): " + e);
|
||||
for (StackTraceElement s : e.getStackTrace()) {
|
||||
Log.v("SDL", s.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Audio
|
||||
public static int audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) {
|
||||
int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO;
|
||||
int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT;
|
||||
int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1);
|
||||
|
||||
Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
|
||||
|
||||
// Let the user pick a larger buffer if they really want -- but ye
|
||||
// gods they probably shouldn't, the minimums are horrifyingly high
|
||||
// latency already
|
||||
desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize);
|
||||
|
||||
if (mAudioTrack == null) {
|
||||
mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate,
|
||||
channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM);
|
||||
|
||||
// Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid
|
||||
// Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java
|
||||
// Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState()
|
||||
|
||||
if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) {
|
||||
Log.e("SDL", "Failed during initialization of Audio Track");
|
||||
mAudioTrack = null;
|
||||
return -1;
|
||||
}
|
||||
|
||||
mAudioTrack.play();
|
||||
}
|
||||
|
||||
Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void audioWriteShortBuffer(short[] buffer) {
|
||||
for (int i = 0; i < buffer.length; ) {
|
||||
int result = mAudioTrack.write(buffer, i, buffer.length - i);
|
||||
if (result > 0) {
|
||||
i += result;
|
||||
} else if (result == 0) {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch(InterruptedException e) {
|
||||
// Nom nom
|
||||
}
|
||||
} else {
|
||||
Log.w("SDL", "SDL audio: error return from write(short)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void audioWriteByteBuffer(byte[] buffer) {
|
||||
for (int i = 0; i < buffer.length; ) {
|
||||
int result = mAudioTrack.write(buffer, i, buffer.length - i);
|
||||
if (result > 0) {
|
||||
i += result;
|
||||
} else if (result == 0) {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch(InterruptedException e) {
|
||||
// Nom nom
|
||||
}
|
||||
} else {
|
||||
Log.w("SDL", "SDL audio: error return from write(byte)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void audioQuit() {
|
||||
if (mAudioTrack != null) {
|
||||
mAudioTrack.stop();
|
||||
mAudioTrack = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Simple nativeInit() runnable
|
||||
*/
|
||||
class SDLMain implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
// Runs SDL_main()
|
||||
SDLActivity.nativeInit();
|
||||
|
||||
//Log.v("SDL", "SDL thread terminated");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SDLSurface. This is what we draw on, so we need to know when it's created
|
||||
in order to do anything useful.
|
||||
|
||||
Because of this, that's where we set up the SDL thread
|
||||
*/
|
||||
class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||
View.OnKeyListener, View.OnTouchListener, SensorEventListener {
|
||||
|
||||
// Sensors
|
||||
protected static SensorManager mSensorManager;
|
||||
|
||||
// Keep track of the surface size to normalize touch events
|
||||
protected static float mWidth, mHeight;
|
||||
|
||||
// Startup
|
||||
public SDLSurface(Context context) {
|
||||
super(context);
|
||||
getHolder().addCallback(this);
|
||||
|
||||
setFocusable(true);
|
||||
setFocusableInTouchMode(true);
|
||||
requestFocus();
|
||||
setOnKeyListener(this);
|
||||
setOnTouchListener(this);
|
||||
|
||||
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
|
||||
|
||||
// Some arbitrary defaults to avoid a potential division by zero
|
||||
mWidth = 1.0f;
|
||||
mHeight = 1.0f;
|
||||
}
|
||||
|
||||
// Called when we have a valid drawing surface
|
||||
@Override
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
Log.v("SDL", "surfaceCreated()");
|
||||
holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
|
||||
// Set mIsSurfaceReady to 'true' *before* any call to handleResume
|
||||
SDLActivity.mIsSurfaceReady = true;
|
||||
}
|
||||
|
||||
// Called when we lose the surface
|
||||
@Override
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
Log.v("SDL", "surfaceDestroyed()");
|
||||
// Call this *before* setting mIsSurfaceReady to 'false'
|
||||
SDLActivity.handlePause();
|
||||
SDLActivity.mIsSurfaceReady = false;
|
||||
|
||||
/* We have to clear the current context and destroy the egl surface here
|
||||
* Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume
|
||||
* Ref: http://stackoverflow.com/questions/8762589/eglcreatewindowsurface-on-ics-and-switching-from-2d-to-3d
|
||||
*/
|
||||
|
||||
EGL10 egl = (EGL10)EGLContext.getEGL();
|
||||
egl.eglMakeCurrent(SDLActivity.mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
|
||||
egl.eglDestroySurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface);
|
||||
SDLActivity.mEGLSurface = EGL10.EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
// Called when the surface is resized
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder,
|
||||
int format, int width, int height) {
|
||||
Log.v("SDL", "surfaceChanged()");
|
||||
|
||||
int sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565 by default
|
||||
switch (format) {
|
||||
case PixelFormat.A_8:
|
||||
Log.v("SDL", "pixel format A_8");
|
||||
break;
|
||||
case PixelFormat.LA_88:
|
||||
Log.v("SDL", "pixel format LA_88");
|
||||
break;
|
||||
case PixelFormat.L_8:
|
||||
Log.v("SDL", "pixel format L_8");
|
||||
break;
|
||||
case PixelFormat.RGBA_4444:
|
||||
Log.v("SDL", "pixel format RGBA_4444");
|
||||
sdlFormat = 0x15421002; // SDL_PIXELFORMAT_RGBA4444
|
||||
break;
|
||||
case PixelFormat.RGBA_5551:
|
||||
Log.v("SDL", "pixel format RGBA_5551");
|
||||
sdlFormat = 0x15441002; // SDL_PIXELFORMAT_RGBA5551
|
||||
break;
|
||||
case PixelFormat.RGBA_8888:
|
||||
Log.v("SDL", "pixel format RGBA_8888");
|
||||
sdlFormat = 0x16462004; // SDL_PIXELFORMAT_RGBA8888
|
||||
break;
|
||||
case PixelFormat.RGBX_8888:
|
||||
Log.v("SDL", "pixel format RGBX_8888");
|
||||
sdlFormat = 0x16261804; // SDL_PIXELFORMAT_RGBX8888
|
||||
break;
|
||||
case PixelFormat.RGB_332:
|
||||
Log.v("SDL", "pixel format RGB_332");
|
||||
sdlFormat = 0x14110801; // SDL_PIXELFORMAT_RGB332
|
||||
break;
|
||||
case PixelFormat.RGB_565:
|
||||
Log.v("SDL", "pixel format RGB_565");
|
||||
sdlFormat = 0x15151002; // SDL_PIXELFORMAT_RGB565
|
||||
break;
|
||||
case PixelFormat.RGB_888:
|
||||
Log.v("SDL", "pixel format RGB_888");
|
||||
// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
|
||||
sdlFormat = 0x16161804; // SDL_PIXELFORMAT_RGB888
|
||||
break;
|
||||
default:
|
||||
Log.v("SDL", "pixel format unknown " + format);
|
||||
break;
|
||||
}
|
||||
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
SDLActivity.onNativeResize(width, height, sdlFormat);
|
||||
Log.v("SDL", "Window size:" + width + "x"+height);
|
||||
|
||||
// Set mIsSurfaceReady to 'true' *before* making a call to handleResume
|
||||
SDLActivity.mIsSurfaceReady = true;
|
||||
|
||||
if (SDLActivity.mSDLThread == null) {
|
||||
// This is the entry point to the C app.
|
||||
// Start up the C app thread and enable sensor input for the first time
|
||||
|
||||
SDLActivity.mSDLThread = new Thread(new SDLMain(), "SDLThread");
|
||||
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
SDLActivity.mSDLThread.start();
|
||||
} else {
|
||||
// The app already exists, we resume via handleResume
|
||||
// Multiple sequential calls to surfaceChanged are handled internally by handleResume
|
||||
|
||||
SDLActivity.handleResume();
|
||||
}
|
||||
}
|
||||
|
||||
// unused
|
||||
@Override
|
||||
public void onDraw(Canvas canvas) {}
|
||||
|
||||
|
||||
// Key events
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
//Log.v("SDL", "key down: " + keyCode);
|
||||
SDLActivity.onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
}
|
||||
else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
//Log.v("SDL", "key up: " + keyCode);
|
||||
SDLActivity.onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Touch events
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
final int touchDevId = event.getDeviceId();
|
||||
final int pointerCount = event.getPointerCount();
|
||||
// touchId, pointerId, action, x, y, pressure
|
||||
int actionPointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; /* API 8: event.getActionIndex(); */
|
||||
int pointerFingerId = event.getPointerId(actionPointerIndex);
|
||||
int action = (event.getAction() & MotionEvent.ACTION_MASK); /* API 8: event.getActionMasked(); */
|
||||
|
||||
float x = event.getX(actionPointerIndex) / mWidth;
|
||||
float y = event.getY(actionPointerIndex) / mHeight;
|
||||
float p = event.getPressure(actionPointerIndex);
|
||||
|
||||
if (action == MotionEvent.ACTION_MOVE && pointerCount > 1) {
|
||||
// TODO send motion to every pointer if its position has
|
||||
// changed since prev event.
|
||||
for (int i = 0; i < pointerCount; i++) {
|
||||
pointerFingerId = event.getPointerId(i);
|
||||
x = event.getX(i) / mWidth;
|
||||
y = event.getY(i) / mHeight;
|
||||
p = event.getPressure(i);
|
||||
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
|
||||
}
|
||||
} else {
|
||||
SDLActivity.onNativeTouch(touchDevId, pointerFingerId, action, x, y, p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Sensor events
|
||||
public void enableSensor(int sensortype, boolean enabled) {
|
||||
// TODO: This uses getDefaultSensor - what if we have >1 accels?
|
||||
if (enabled) {
|
||||
mSensorManager.registerListener(this,
|
||||
mSensorManager.getDefaultSensor(sensortype),
|
||||
SensorManager.SENSOR_DELAY_GAME, null);
|
||||
} else {
|
||||
mSensorManager.unregisterListener(this,
|
||||
mSensorManager.getDefaultSensor(sensortype));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
|
||||
SDLActivity.onNativeAccel(event.values[0] / SensorManager.GRAVITY_EARTH,
|
||||
event.values[1] / SensorManager.GRAVITY_EARTH,
|
||||
event.values[2] / SensorManager.GRAVITY_EARTH);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* This is a fake invisible editor view that receives the input and defines the
|
||||
* pan&scan region
|
||||
*/
|
||||
class DummyEdit extends View implements View.OnKeyListener {
|
||||
InputConnection ic;
|
||||
|
||||
public DummyEdit(Context context) {
|
||||
super(context);
|
||||
setFocusableInTouchMode(true);
|
||||
setFocusable(true);
|
||||
setOnKeyListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckIsTextEditor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
|
||||
// This handles the hardware keyboard input
|
||||
if (event.isPrintingKey()) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
SDLActivity.onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
SDLActivity.onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
@Override
|
||||
public boolean onKeyPreIme (int keyCode, KeyEvent event) {
|
||||
// As seen on StackOverflow: http://stackoverflow.com/questions/7634346/keyboard-hide-event
|
||||
// FIXME: Discussion at http://bugzilla.libsdl.org/show_bug.cgi?id=1639
|
||||
// FIXME: This is not a 100% effective solution to the problem of detecting if the keyboard is showing or not
|
||||
// FIXME: A more effective solution would be to change our Layout from AbsoluteLayout to Relative or Linear
|
||||
// FIXME: And determine the keyboard presence doing this: http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android
|
||||
// FIXME: An even more effective way would be if Android provided this out of the box, but where would the fun be in that :)
|
||||
if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (SDLActivity.mTextEdit != null && SDLActivity.mTextEdit.getVisibility() == View.VISIBLE) {
|
||||
SDLActivity.onNativeKeyboardFocusLost();
|
||||
}
|
||||
}
|
||||
return super.onKeyPreIme(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
ic = new SDLInputConnection(this, true);
|
||||
|
||||
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
|
||||
| 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */;
|
||||
|
||||
return ic;
|
||||
}
|
||||
}
|
||||
|
||||
class SDLInputConnection extends BaseInputConnection {
|
||||
|
||||
public SDLInputConnection(View targetView, boolean fullEditor) {
|
||||
super(targetView, fullEditor);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
|
||||
/*
|
||||
* This handles the keycodes from soft keyboard (and IME-translated
|
||||
* input from hardkeyboard)
|
||||
*/
|
||||
int keyCode = event.getKeyCode();
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (event.isPrintingKey()) {
|
||||
commitText(String.valueOf((char) event.getUnicodeChar()), 1);
|
||||
}
|
||||
SDLActivity.onNativeKeyDown(keyCode);
|
||||
return true;
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
|
||||
SDLActivity.onNativeKeyUp(keyCode);
|
||||
return true;
|
||||
}
|
||||
return super.sendKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||
|
||||
nativeCommitText(text.toString(), newCursorPosition);
|
||||
|
||||
return super.commitText(text, newCursorPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setComposingText(CharSequence text, int newCursorPosition) {
|
||||
|
||||
nativeSetComposingText(text.toString(), newCursorPosition);
|
||||
|
||||
return super.setComposingText(text, newCursorPosition);
|
||||
}
|
||||
|
||||
public native void nativeCommitText(String text, int newCursorPosition);
|
||||
|
||||
public native void nativeSetComposingText(String text, int newCursorPosition);
|
||||
|
||||
}
|
||||
|
||||
25122
project/jni/sdl-2.0/configure
vendored
Executable file
25122
project/jni/sdl-2.0/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
2870
project/jni/sdl-2.0/configure.in
Normal file
2870
project/jni/sdl-2.0/configure.in
Normal file
File diff suppressed because it is too large
Load Diff
2870
project/jni/sdl-2.0/configure.in.orig
Normal file
2870
project/jni/sdl-2.0/configure.in.orig
Normal file
File diff suppressed because it is too large
Load Diff
2618
project/jni/sdl-2.0/configure.in.rej
Normal file
2618
project/jni/sdl-2.0/configure.in.rej
Normal file
File diff suppressed because it is too large
Load Diff
25122
project/jni/sdl-2.0/configure.orig
Executable file
25122
project/jni/sdl-2.0/configure.orig
Executable file
File diff suppressed because it is too large
Load Diff
30350
project/jni/sdl-2.0/configure.rej
Normal file
30350
project/jni/sdl-2.0/configure.rej
Normal file
File diff suppressed because it is too large
Load Diff
160
project/jni/sdl-2.0/include/SDL.h
Normal file
160
project/jni/sdl-2.0/include/SDL.h
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL.h
|
||||
*
|
||||
* Main include header for the SDL library
|
||||
*/
|
||||
|
||||
/**
|
||||
* \mainpage Simple DirectMedia Layer (SDL)
|
||||
*
|
||||
* http://www.libsdl.org/
|
||||
*
|
||||
* \section intro_sec Introduction
|
||||
*
|
||||
* This is the Simple DirectMedia Layer, a general API that provides low
|
||||
* level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
||||
* and 2D framebuffer across multiple platforms.
|
||||
*
|
||||
* SDL is written in C, but works with C++ natively, and has bindings to
|
||||
* several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
|
||||
* Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||
* Pike, Pliant, Python, Ruby, and Smalltalk.
|
||||
*
|
||||
* This library is distributed under the zlib license, which can be
|
||||
* found in the file "COPYING". This license allows you to use SDL
|
||||
* freely for any purpose as long as you retain the copyright notice.
|
||||
*
|
||||
* 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 header files and test programs are well commented and always up to date.
|
||||
* More documentation and FAQs are available online at:
|
||||
* http://wiki.libsdl.org/
|
||||
*
|
||||
* If you need help with the library, or just want to discuss SDL related
|
||||
* issues, you can join the developers mailing list:
|
||||
* http://www.libsdl.org/mailing-list.php
|
||||
*
|
||||
* Enjoy!
|
||||
* Sam Lantinga (slouken@libsdl.org)
|
||||
*/
|
||||
|
||||
#ifndef _SDL_H
|
||||
#define _SDL_H
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_clipboard.h"
|
||||
#include "SDL_cpuinfo.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_gamecontroller.h"
|
||||
#include "SDL_haptic.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_messagebox.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_power.h"
|
||||
#include "SDL_render.h"
|
||||
#include "SDL_rwops.h"
|
||||
#include "SDL_system.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* As of version 0.5, SDL is loaded dynamically into the application */
|
||||
|
||||
/**
|
||||
* \name SDL_INIT_*
|
||||
*
|
||||
* These are the flags which may be passed to SDL_Init(). You should
|
||||
* specify the subsystems which you will be using in your application.
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_INIT_TIMER 0x00000001
|
||||
#define SDL_INIT_AUDIO 0x00000010
|
||||
#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
|
||||
#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
|
||||
#define SDL_INIT_HAPTIC 0x00001000
|
||||
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
|
||||
#define SDL_INIT_EVENTS 0x00004000
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
|
||||
#define SDL_INIT_EVERYTHING ( \
|
||||
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
|
||||
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
|
||||
)
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* This function initializes the subsystems specified by \c flags
|
||||
* Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
|
||||
* signal handlers for some commonly ignored fatal signals (like SIGSEGV).
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
|
||||
|
||||
/**
|
||||
* This function initializes specific SDL subsystems
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
|
||||
|
||||
/**
|
||||
* This function cleans up specific SDL subsystems
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
|
||||
|
||||
/**
|
||||
* This function returns a mask of the specified subsystems which have
|
||||
* previously been initialized.
|
||||
*
|
||||
* If \c flags is 0, it returns a mask of all initialized subsystems.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
|
||||
|
||||
/**
|
||||
* This function cleans up all initialized subsystems. You should
|
||||
* call it upon all exit conditions.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Quit(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
237
project/jni/sdl-2.0/include/SDL_assert.h
Normal file
237
project/jni/sdl-2.0/include/SDL_assert.h
Normal file
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_assert_h
|
||||
#define _SDL_assert_h
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef SDL_ASSERT_LEVEL
|
||||
#ifdef SDL_DEFAULT_ASSERT_LEVEL
|
||||
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
|
||||
#elif defined(_DEBUG) || defined(DEBUG) || \
|
||||
(defined(__GNUC__) && !defined(__OPTIMIZE__))
|
||||
#define SDL_ASSERT_LEVEL 2
|
||||
#else
|
||||
#define SDL_ASSERT_LEVEL 1
|
||||
#endif
|
||||
#endif /* SDL_ASSERT_LEVEL */
|
||||
|
||||
/*
|
||||
These are macros and not first class functions so that the debugger breaks
|
||||
on the assertion line and not in some random guts of SDL, and so each
|
||||
assert can have unique static variables associated with it.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/* Don't include intrin.h here because it contains C++ code */
|
||||
extern void __cdecl __debugbreak(void);
|
||||
#define SDL_TriggerBreakpoint() __debugbreak()
|
||||
#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
|
||||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
|
||||
#elif defined(HAVE_SIGNAL_H)
|
||||
#include <signal.h>
|
||||
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
|
||||
#else
|
||||
/* How do we trigger breakpoints on this platform? */
|
||||
#define SDL_TriggerBreakpoint()
|
||||
#endif
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
|
||||
# define SDL_FUNCTION __func__
|
||||
#elif ((__GNUC__ >= 2) || defined(_MSC_VER))
|
||||
# define SDL_FUNCTION __FUNCTION__
|
||||
#else
|
||||
# define SDL_FUNCTION "???"
|
||||
#endif
|
||||
#define SDL_FILE __FILE__
|
||||
#define SDL_LINE __LINE__
|
||||
|
||||
/*
|
||||
sizeof (x) makes the compiler still parse the expression even without
|
||||
assertions enabled, so the code is always checked at compile time, but
|
||||
doesn't actually generate code for it, so there are no side effects or
|
||||
expensive checks at run time, just the constant size of what x WOULD be,
|
||||
which presumably gets optimized out as unused.
|
||||
This also solves the problem of...
|
||||
|
||||
int somevalue = blah();
|
||||
SDL_assert(somevalue == 1);
|
||||
|
||||
...which would cause compiles to complain that somevalue is unused if we
|
||||
disable assertions.
|
||||
*/
|
||||
|
||||
#define SDL_disabled_assert(condition) \
|
||||
do { (void) sizeof ((condition)); } while (0)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
|
||||
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
|
||||
SDL_ASSERTION_ABORT, /**< Terminate the program. */
|
||||
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
|
||||
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
|
||||
} SDL_assert_state;
|
||||
|
||||
typedef struct SDL_assert_data
|
||||
{
|
||||
int always_ignore;
|
||||
unsigned int trigger_count;
|
||||
const char *condition;
|
||||
const char *filename;
|
||||
int linenum;
|
||||
const char *function;
|
||||
const struct SDL_assert_data *next;
|
||||
} SDL_assert_data;
|
||||
|
||||
#if (SDL_ASSERT_LEVEL > 0)
|
||||
|
||||
/* Never call this directly. Use the SDL_assert* macros. */
|
||||
extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
|
||||
const char *,
|
||||
const char *, int);
|
||||
|
||||
/* the do {} while(0) avoids dangling else problems:
|
||||
if (x) SDL_assert(y); else blah();
|
||||
... without the do/while, the "else" could attach to this macro's "if".
|
||||
We try to handle just the minimum we need here in a macro...the loop,
|
||||
the static vars, and break points. The heavy lifting is handled in
|
||||
SDL_ReportAssertion(), in SDL_assert.c.
|
||||
*/
|
||||
#define SDL_enabled_assert(condition) \
|
||||
do { \
|
||||
while ( !(condition) ) { \
|
||||
static struct SDL_assert_data assert_data = { \
|
||||
0, 0, #condition, 0, 0, 0, 0 \
|
||||
}; \
|
||||
const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \
|
||||
SDL_FUNCTION, \
|
||||
SDL_FILE, \
|
||||
SDL_LINE); \
|
||||
if (state == SDL_ASSERTION_RETRY) { \
|
||||
continue; /* go again. */ \
|
||||
} else if (state == SDL_ASSERTION_BREAK) { \
|
||||
SDL_TriggerBreakpoint(); \
|
||||
} \
|
||||
break; /* not retrying. */ \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* enabled assertions support code */
|
||||
|
||||
/* Enable various levels of assertions. */
|
||||
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
|
||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
|
||||
# define SDL_assert(condition) SDL_disabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
|
||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
|
||||
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
|
||||
# define SDL_assert(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
|
||||
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
|
||||
#else
|
||||
# error Unknown assertion level.
|
||||
#endif
|
||||
|
||||
|
||||
typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
|
||||
const SDL_assert_data* data, void* userdata);
|
||||
|
||||
/**
|
||||
* \brief Set an application-defined assertion handler.
|
||||
*
|
||||
* This allows an app to show its own assertion UI and/or force the
|
||||
* response to an assertion failure. If the app doesn't provide this, SDL
|
||||
* will try to do the right thing, popping up a system-specific GUI dialog,
|
||||
* and probably minimizing any fullscreen windows.
|
||||
*
|
||||
* This callback may fire from any thread, but it runs wrapped in a mutex, so
|
||||
* it will only fire from one thread at a time.
|
||||
*
|
||||
* Setting the callback to NULL restores SDL's original internal handler.
|
||||
*
|
||||
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
|
||||
*
|
||||
* \return SDL_assert_state value of how to handle the assertion failure.
|
||||
*
|
||||
* \param handler Callback function, called when an assertion fails.
|
||||
* \param userdata A pointer passed to the callback as-is.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||
SDL_AssertionHandler handler,
|
||||
void *userdata);
|
||||
|
||||
/**
|
||||
* \brief Get a list of all assertion failures.
|
||||
*
|
||||
* Get all assertions triggered since last call to SDL_ResetAssertionReport(),
|
||||
* or the start of the program.
|
||||
*
|
||||
* The proper way to examine this data looks something like this:
|
||||
*
|
||||
* <code>
|
||||
* const SDL_assert_data *item = SDL_GetAssertionReport();
|
||||
* while (item) {
|
||||
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
|
||||
* item->condition, item->function, item->filename,
|
||||
* item->linenum, item->trigger_count,
|
||||
* item->always_ignore ? "yes" : "no");
|
||||
* item = item->next;
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* \return List of all assertions.
|
||||
* \sa SDL_ResetAssertionReport
|
||||
*/
|
||||
extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
|
||||
|
||||
/**
|
||||
* \brief Reset the list of all assertion failures.
|
||||
*
|
||||
* Reset list of all assertions triggered.
|
||||
*
|
||||
* \sa SDL_GetAssertionReport
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_assert_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
359
project/jni/sdl-2.0/include/SDL_atomic.h
Normal file
359
project/jni/sdl-2.0/include/SDL_atomic.h
Normal file
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_atomic.h
|
||||
*
|
||||
* Atomic operations.
|
||||
*
|
||||
* IMPORTANT:
|
||||
* If you are not an expert in concurrent lockless programming, you should
|
||||
* only be using the atomic lock and reference counting functions in this
|
||||
* file. In all other cases you should be protecting your data structures
|
||||
* with full mutexes.
|
||||
*
|
||||
* The list of "safe" functions to use are:
|
||||
* SDL_AtomicLock()
|
||||
* SDL_AtomicUnlock()
|
||||
* SDL_AtomicIncRef()
|
||||
* SDL_AtomicDecRef()
|
||||
*
|
||||
* Seriously, here be dragons!
|
||||
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
*
|
||||
* You can find out a little more about lockless programming and the
|
||||
* subtle issues that can arise here:
|
||||
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
|
||||
*
|
||||
* There's also lots of good information here:
|
||||
* http://www.1024cores.net/home/lock-free-algorithms
|
||||
* http://preshing.com/
|
||||
*
|
||||
* These operations may or may not actually be implemented using
|
||||
* processor specific atomic operations. When possible they are
|
||||
* implemented as true processor specific atomic operations. When that
|
||||
* is not possible the are implemented using locks that *do* use the
|
||||
* available atomic operations.
|
||||
*
|
||||
* All of the atomic operations that modify memory are full memory barriers.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_atomic_h_
|
||||
#define _SDL_atomic_h_
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_platform.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
|
||||
/* Need to do this here because intrin.h has C++ code in it */
|
||||
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||||
#include <intrin.h>
|
||||
#define HAVE_MSC_ATOMICS 1
|
||||
#endif
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name SDL AtomicLock
|
||||
*
|
||||
* The atomic locks are efficient spinlocks using CPU instructions,
|
||||
* but are vulnerable to starvation and can spin forever if a thread
|
||||
* holding a lock has been terminated. For this reason you should
|
||||
* minimize the code executed inside an atomic lock and never do
|
||||
* expensive things like API or system calls while holding them.
|
||||
*
|
||||
* The atomic locks are not safe to lock recursively.
|
||||
*
|
||||
* Porting Note:
|
||||
* The spin lock functions and type are required and can not be
|
||||
* emulated because they are used in the atomic emulation code.
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
typedef int SDL_SpinLock;
|
||||
|
||||
/**
|
||||
* \brief Try to lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
*
|
||||
* \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
|
||||
|
||||
/**
|
||||
* \brief Lock a spin lock by setting it to a non-zero value.
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
|
||||
|
||||
/**
|
||||
* \brief Unlock a spin lock by setting it to 0. Always returns immediately
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
||||
|
||||
/*@}*//*SDL AtomicLock*/
|
||||
|
||||
|
||||
/**
|
||||
* The compiler barrier prevents the compiler from reordering
|
||||
* reads and writes to globally visible variables across the call.
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
void _ReadWriteBarrier(void);
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
||||
#elif defined(__GNUC__)
|
||||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
|
||||
#else
|
||||
#define SDL_CompilerBarrier() \
|
||||
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Memory barriers are designed to prevent reads and writes from being
|
||||
* reordered by the compiler and being seen out of order on multi-core CPUs.
|
||||
*
|
||||
* A typical pattern would be for thread A to write some data and a flag,
|
||||
* and for thread B to read the flag and get the data. In this case you
|
||||
* would insert a release barrier between writing the data and the flag,
|
||||
* guaranteeing that the data write completes no later than the flag is
|
||||
* written, and you would insert an acquire barrier between reading the
|
||||
* flag and reading the data, to ensure that all the reads associated
|
||||
* with the flag have completed.
|
||||
*
|
||||
* In this pattern you should always see a release barrier paired with
|
||||
* an acquire barrier and you should gate the data reads/writes with a
|
||||
* single flag variable.
|
||||
*
|
||||
* For more information on these semantics, take a look at the blog post:
|
||||
* http://preshing.com/20120913/acquire-and-release-semantics
|
||||
*/
|
||||
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
|
||||
#elif defined(__GNUC__) && defined(__arm__)
|
||||
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
|
||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
|
||||
#ifdef __thumb__
|
||||
/* The mcr instruction isn't available in thumb mode, use real functions */
|
||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
|
||||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
|
||||
#else
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
|
||||
#endif /* __thumb__ */
|
||||
#else
|
||||
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
|
||||
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
|
||||
#endif /* __GNUC__ && __arm__ */
|
||||
#else
|
||||
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
|
||||
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
|
||||
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
|
||||
#endif
|
||||
|
||||
|
||||
/* Platform specific optimized versions of the atomic functions,
|
||||
* you can disable these by defining SDL_DISABLE_ATOMIC_INLINE
|
||||
*/
|
||||
#if defined(SDL_ATOMIC_DISABLED) && SDL_ATOMIC_DISABLED
|
||||
#define SDL_DISABLE_ATOMIC_INLINE
|
||||
#endif
|
||||
#ifndef SDL_DISABLE_ATOMIC_INLINE
|
||||
|
||||
#ifdef HAVE_MSC_ATOMICS
|
||||
|
||||
#define SDL_AtomicSet(a, v) _InterlockedExchange((long*)&(a)->value, (v))
|
||||
#define SDL_AtomicAdd(a, v) _InterlockedExchangeAdd((long*)&(a)->value, (v))
|
||||
#define SDL_AtomicCAS(a, oldval, newval) (_InterlockedCompareExchange((long*)&(a)->value, (newval), (oldval)) == (oldval))
|
||||
#define SDL_AtomicSetPtr(a, v) _InterlockedExchangePointer((a), (v))
|
||||
#if _M_IX86
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchange((long*)(a), (long)(newval), (long)(oldval)) == (long)(oldval))
|
||||
#else
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchangePointer((a), (newval), (oldval)) == (oldval))
|
||||
#endif
|
||||
|
||||
#elif defined(__MACOSX__)
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
#define SDL_AtomicCAS(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((oldval), (newval), &(a)->value)
|
||||
#ifdef __LP64__
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap64Barrier((int64_t)(oldval), (int64_t)(newval), (int64_t*)(a))
|
||||
#else
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((int32_t)(oldval), (int32_t)(newval), (int32_t*)(a))
|
||||
#endif
|
||||
|
||||
#elif defined(HAVE_GCC_ATOMICS)
|
||||
|
||||
#define SDL_AtomicSet(a, v) __sync_lock_test_and_set(&(a)->value, v)
|
||||
#define SDL_AtomicAdd(a, v) __sync_fetch_and_add(&(a)->value, v)
|
||||
#define SDL_AtomicSetPtr(a, v) __sync_lock_test_and_set(a, v)
|
||||
#define SDL_AtomicCAS(a, oldval, newval) __sync_bool_compare_and_swap(&(a)->value, oldval, newval)
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) __sync_bool_compare_and_swap(a, oldval, newval)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !SDL_DISABLE_ATOMIC_INLINE */
|
||||
|
||||
|
||||
/**
|
||||
* \brief A type representing an atomic integer value. It is a struct
|
||||
* so people don't accidentally use numeric operations on it.
|
||||
*/
|
||||
#ifndef SDL_atomic_t_defined
|
||||
typedef struct { int value; } SDL_atomic_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set an atomic variable to a new value if it is currently an old value.
|
||||
*
|
||||
* \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
|
||||
*
|
||||
* \note If you don't know what this function is for, you shouldn't use it!
|
||||
*/
|
||||
#ifndef SDL_AtomicCAS
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set an atomic variable to a value.
|
||||
*
|
||||
* \return The previous value of the atomic variable.
|
||||
*/
|
||||
#ifndef SDL_AtomicSet
|
||||
SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||
{
|
||||
int value;
|
||||
do {
|
||||
value = a->value;
|
||||
} while (!SDL_AtomicCAS(a, value, v));
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Get the value of an atomic variable
|
||||
*/
|
||||
#ifndef SDL_AtomicGet
|
||||
SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
|
||||
{
|
||||
int value = a->value;
|
||||
SDL_CompilerBarrier();
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Add to an atomic variable.
|
||||
*
|
||||
* \return The previous value of the atomic variable.
|
||||
*
|
||||
* \note This same style can be used for any number operation
|
||||
*/
|
||||
#ifndef SDL_AtomicAdd
|
||||
SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||
{
|
||||
int value;
|
||||
do {
|
||||
value = a->value;
|
||||
} while (!SDL_AtomicCAS(a, value, (value + v)));
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Increment an atomic variable used as a reference count.
|
||||
*/
|
||||
#ifndef SDL_AtomicIncRef
|
||||
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Decrement an atomic variable used as a reference count.
|
||||
*
|
||||
* \return SDL_TRUE if the variable reached zero after decrementing,
|
||||
* SDL_FALSE otherwise
|
||||
*/
|
||||
#ifndef SDL_AtomicDecRef
|
||||
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set a pointer to a new value if it is currently an old value.
|
||||
*
|
||||
* \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
|
||||
*
|
||||
* \note If you don't know what this function is for, you shouldn't use it!
|
||||
*/
|
||||
#ifndef SDL_AtomicCASPtr
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set a pointer to a value atomically.
|
||||
*
|
||||
* \return The previous value of the pointer.
|
||||
*/
|
||||
#ifndef SDL_AtomicSetPtr
|
||||
SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
|
||||
{
|
||||
void* value;
|
||||
do {
|
||||
value = *a;
|
||||
} while (!SDL_AtomicCASPtr(a, value, v));
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Get the value of a pointer atomically.
|
||||
*/
|
||||
#ifndef SDL_AtomicGetPtr
|
||||
SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
|
||||
{
|
||||
void* value = *a;
|
||||
SDL_CompilerBarrier();
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_atomic_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
506
project/jni/sdl-2.0/include/SDL_audio.h
Normal file
506
project/jni/sdl-2.0/include/SDL_audio.h
Normal file
@@ -0,0 +1,506 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_audio.h
|
||||
*
|
||||
* Access to the raw audio mixing buffer for the SDL library.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_audio_h
|
||||
#define _SDL_audio_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Audio format flags.
|
||||
*
|
||||
* These are what the 16 bits in SDL_AudioFormat currently mean...
|
||||
* (Unspecified bits are always zero).
|
||||
*
|
||||
* \verbatim
|
||||
++-----------------------sample is signed if set
|
||||
||
|
||||
|| ++-----------sample is bigendian if set
|
||||
|| ||
|
||||
|| || ++---sample is float if set
|
||||
|| || ||
|
||||
|| || || +---sample bit size---+
|
||||
|| || || | |
|
||||
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
|
||||
\endverbatim
|
||||
*
|
||||
* There are macros in SDL 2.0 and later to query these bits.
|
||||
*/
|
||||
typedef Uint16 SDL_AudioFormat;
|
||||
|
||||
/**
|
||||
* \name Audio flags
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#define SDL_AUDIO_MASK_BITSIZE (0xFF)
|
||||
#define SDL_AUDIO_MASK_DATATYPE (1<<8)
|
||||
#define SDL_AUDIO_MASK_ENDIAN (1<<12)
|
||||
#define SDL_AUDIO_MASK_SIGNED (1<<15)
|
||||
#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
|
||||
#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
|
||||
#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
|
||||
#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
|
||||
#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
|
||||
#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
|
||||
#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
|
||||
|
||||
/**
|
||||
* \name Audio format flags
|
||||
*
|
||||
* Defaults to LSB byte order.
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
|
||||
#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
|
||||
#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
|
||||
#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
|
||||
#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_U16 AUDIO_U16LSB
|
||||
#define AUDIO_S16 AUDIO_S16LSB
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name int32 support
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
|
||||
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_S32 AUDIO_S32LSB
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name float32 support
|
||||
*/
|
||||
/*@{*/
|
||||
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
|
||||
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
|
||||
#define AUDIO_F32 AUDIO_F32LSB
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Native audio byte ordering
|
||||
*/
|
||||
/*@{*/
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
#define AUDIO_U16SYS AUDIO_U16LSB
|
||||
#define AUDIO_S16SYS AUDIO_S16LSB
|
||||
#define AUDIO_S32SYS AUDIO_S32LSB
|
||||
#define AUDIO_F32SYS AUDIO_F32LSB
|
||||
#else
|
||||
#define AUDIO_U16SYS AUDIO_U16MSB
|
||||
#define AUDIO_S16SYS AUDIO_S16MSB
|
||||
#define AUDIO_S32SYS AUDIO_S32MSB
|
||||
#define AUDIO_F32SYS AUDIO_F32MSB
|
||||
#endif
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Allow change flags
|
||||
*
|
||||
* Which audio format changes are allowed when opening a device.
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
|
||||
#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
|
||||
#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
|
||||
#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
|
||||
/*@}*/
|
||||
|
||||
/*@}*//*Audio flags*/
|
||||
|
||||
/**
|
||||
* This function is called when the audio device needs more data.
|
||||
*
|
||||
* \param userdata An application-specific parameter saved in
|
||||
* the SDL_AudioSpec structure
|
||||
* \param stream A pointer to the audio data buffer.
|
||||
* \param len The length of that buffer in bytes.
|
||||
*
|
||||
* Once the callback returns, the buffer will no longer be valid.
|
||||
* Stereo samples are stored in a LRLRLR ordering.
|
||||
*/
|
||||
typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
|
||||
int len);
|
||||
|
||||
/**
|
||||
* The calculated values in this structure are calculated by SDL_OpenAudio().
|
||||
*/
|
||||
typedef struct SDL_AudioSpec
|
||||
{
|
||||
int freq; /**< DSP frequency -- samples per second */
|
||||
SDL_AudioFormat format; /**< Audio data format */
|
||||
Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
|
||||
Uint8 silence; /**< Audio buffer silence value (calculated) */
|
||||
Uint16 samples; /**< Audio buffer size in samples (power of 2) */
|
||||
Uint16 padding; /**< Necessary for some compile environments */
|
||||
Uint32 size; /**< Audio buffer size in bytes (calculated) */
|
||||
SDL_AudioCallback callback;
|
||||
void *userdata;
|
||||
} SDL_AudioSpec;
|
||||
|
||||
|
||||
struct SDL_AudioCVT;
|
||||
typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
|
||||
SDL_AudioFormat format);
|
||||
|
||||
/**
|
||||
* A structure to hold a set of audio conversion filters and buffers.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
|
||||
pad it out to 88 bytes to guarantee ABI compatibility between compilers.
|
||||
vvv
|
||||
The next time we rev the ABI, make sure to size the ints and add padding.
|
||||
*/
|
||||
#define SDL_AUDIOCVT_PACKED __attribute__((packed))
|
||||
#else
|
||||
#define SDL_AUDIOCVT_PACKED
|
||||
#endif
|
||||
/* */
|
||||
typedef struct SDL_AudioCVT
|
||||
{
|
||||
int needed; /**< Set to 1 if conversion possible */
|
||||
SDL_AudioFormat src_format; /**< Source audio format */
|
||||
SDL_AudioFormat dst_format; /**< Target audio format */
|
||||
double rate_incr; /**< Rate conversion increment */
|
||||
Uint8 *buf; /**< Buffer to hold entire audio data */
|
||||
int len; /**< Length of original audio buffer */
|
||||
int len_cvt; /**< Length of converted audio buffer */
|
||||
int len_mult; /**< buffer must be len*len_mult big */
|
||||
double len_ratio; /**< Given len, final size is len*len_ratio */
|
||||
SDL_AudioFilter filters[10]; /**< Filter list */
|
||||
int filter_index; /**< Current audio conversion function */
|
||||
} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \name Driver discovery functions
|
||||
*
|
||||
* These functions return the list of built in audio drivers, in the
|
||||
* order that they are normally initialized by default.
|
||||
*/
|
||||
/*@{*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Initialization and cleanup
|
||||
*
|
||||
* \internal These functions are used internally, and should not be used unless
|
||||
* you have a specific need to specify the audio driver you want to
|
||||
* use. You should normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*/
|
||||
/*@{*/
|
||||
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
|
||||
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* This function returns the name of the current audio driver, or NULL
|
||||
* if no driver has been initialized.
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
|
||||
|
||||
/**
|
||||
* This function opens the audio device with the desired parameters, and
|
||||
* returns 0 if successful, placing the actual hardware parameters in the
|
||||
* structure pointed to by \c obtained. If \c obtained is NULL, the audio
|
||||
* data passed to the callback function will be guaranteed to be in the
|
||||
* requested format, and will be automatically converted to the hardware
|
||||
* audio format if necessary. This function returns -1 if it failed
|
||||
* to open the audio device, or couldn't set up the audio thread.
|
||||
*
|
||||
* When filling in the desired audio spec structure,
|
||||
* - \c desired->freq should be the desired audio frequency in samples-per-
|
||||
* second.
|
||||
* - \c desired->format should be the desired audio format.
|
||||
* - \c desired->samples is the desired size of the audio buffer, in
|
||||
* samples. This number should be a power of two, and may be adjusted by
|
||||
* the audio driver to a value more suitable for the hardware. Good values
|
||||
* seem to range between 512 and 8096 inclusive, depending on the
|
||||
* application and CPU speed. Smaller values yield faster response time,
|
||||
* but can lead to underflow if the application is doing heavy processing
|
||||
* and cannot fill the audio buffer in time. A stereo sample consists of
|
||||
* both right and left channels in LR ordering.
|
||||
* Note that the number of samples is directly related to time by the
|
||||
* following formula: \code ms = (samples*1000)/freq \endcode
|
||||
* - \c desired->size is the size in bytes of the audio buffer, and is
|
||||
* calculated by SDL_OpenAudio().
|
||||
* - \c desired->silence is the value used to set the buffer to silence,
|
||||
* and is calculated by SDL_OpenAudio().
|
||||
* - \c desired->callback should be set to a function that will be called
|
||||
* when the audio device is ready for more data. It is passed a pointer
|
||||
* to the audio buffer, and the length in bytes of the audio buffer.
|
||||
* This function usually runs in a separate thread, and so you should
|
||||
* protect data structures that it accesses by calling SDL_LockAudio()
|
||||
* and SDL_UnlockAudio() in your code.
|
||||
* - \c desired->userdata is passed as the first parameter to your callback
|
||||
* function.
|
||||
*
|
||||
* The audio device starts out playing silence when it's opened, and should
|
||||
* be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
|
||||
* for your audio callback function to be called. Since the audio driver
|
||||
* may modify the requested size of the audio buffer, you should allocate
|
||||
* any local mixing buffers after you open the audio device.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
|
||||
SDL_AudioSpec * obtained);
|
||||
|
||||
/**
|
||||
* SDL Audio Device IDs.
|
||||
*
|
||||
* A successful call to SDL_OpenAudio() is always device id 1, and legacy
|
||||
* SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
|
||||
* always returns devices >= 2 on success. The legacy calls are good both
|
||||
* for backwards compatibility and when you don't care about multiple,
|
||||
* specific, or capture devices.
|
||||
*/
|
||||
typedef Uint32 SDL_AudioDeviceID;
|
||||
|
||||
/**
|
||||
* Get the number of available devices exposed by the current driver.
|
||||
* Only valid after a successfully initializing the audio subsystem.
|
||||
* Returns -1 if an explicit list of devices can't be determined; this is
|
||||
* not an error. For example, if SDL is set up to talk to a remote audio
|
||||
* server, it can't list every one available on the Internet, but it will
|
||||
* still allow a specific host to be specified to SDL_OpenAudioDevice().
|
||||
*
|
||||
* In many common cases, when this function returns a value <= 0, it can still
|
||||
* successfully open the default device (NULL for first argument of
|
||||
* SDL_OpenAudioDevice()).
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
|
||||
|
||||
/**
|
||||
* Get the human-readable name of a specific audio device.
|
||||
* Must be a value between 0 and (number of audio devices-1).
|
||||
* Only valid after a successfully initializing the audio subsystem.
|
||||
* The values returned by this function reflect the latest call to
|
||||
* SDL_GetNumAudioDevices(); recall that function to redetect available
|
||||
* hardware.
|
||||
*
|
||||
* The string returned by this function is UTF-8 encoded, read-only, and
|
||||
* managed internally. You are not to free it. If you need to keep the
|
||||
* string for any length of time, you should make your own copy of it, as it
|
||||
* will be invalid next time any of several other SDL functions is called.
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
|
||||
int iscapture);
|
||||
|
||||
|
||||
/**
|
||||
* Open a specific audio device. Passing in a device name of NULL requests
|
||||
* the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
|
||||
*
|
||||
* The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but
|
||||
* some drivers allow arbitrary and driver-specific strings, such as a
|
||||
* hostname/IP address for a remote audio server, or a filename in the
|
||||
* diskaudio driver.
|
||||
*
|
||||
* \return 0 on error, a valid device ID that is >= 2 on success.
|
||||
*
|
||||
* SDL_OpenAudio(), unlike this function, always acts on device ID 1.
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
|
||||
*device,
|
||||
int iscapture,
|
||||
const
|
||||
SDL_AudioSpec *
|
||||
desired,
|
||||
SDL_AudioSpec *
|
||||
obtained,
|
||||
int
|
||||
allowed_changes);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \name Audio state
|
||||
*
|
||||
* Get the current audio state.
|
||||
*/
|
||||
/*@{*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_AUDIO_STOPPED = 0,
|
||||
SDL_AUDIO_PLAYING,
|
||||
SDL_AUDIO_PAUSED
|
||||
} SDL_AudioStatus;
|
||||
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
|
||||
|
||||
extern DECLSPEC SDL_AudioStatus SDLCALL
|
||||
SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
|
||||
/*@}*//*Audio State*/
|
||||
|
||||
/**
|
||||
* \name Pause audio functions
|
||||
*
|
||||
* These functions pause and unpause the audio callback processing.
|
||||
* They should be called with a parameter of 0 after opening the audio
|
||||
* device to start playing sound. This is so you can safely initialize
|
||||
* data for your callback function after opening the audio device.
|
||||
* Silence will be written to the audio device during the pause.
|
||||
*/
|
||||
/*@{*/
|
||||
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
|
||||
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
|
||||
int pause_on);
|
||||
/*@}*//*Pause audio functions*/
|
||||
|
||||
/**
|
||||
* This function loads a WAVE from the data source, automatically freeing
|
||||
* that source if \c freesrc is non-zero. For example, to load a WAVE file,
|
||||
* you could do:
|
||||
* \code
|
||||
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||
* \endcode
|
||||
*
|
||||
* If this function succeeds, it returns the given SDL_AudioSpec,
|
||||
* filled with the audio data format of the wave data, and sets
|
||||
* \c *audio_buf to a malloc()'d buffer containing the audio data,
|
||||
* and sets \c *audio_len to the length of that audio buffer, in bytes.
|
||||
* You need to free the audio buffer with SDL_FreeWAV() when you are
|
||||
* done with it.
|
||||
*
|
||||
* This function returns NULL and sets the SDL error message if the
|
||||
* wave file cannot be opened, uses an unknown data format, or is
|
||||
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
|
||||
int freesrc,
|
||||
SDL_AudioSpec * spec,
|
||||
Uint8 ** audio_buf,
|
||||
Uint32 * audio_len);
|
||||
|
||||
/**
|
||||
* Loads a WAV from a file.
|
||||
* Compatibility convenience function.
|
||||
*/
|
||||
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
|
||||
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
|
||||
|
||||
/**
|
||||
* This function frees data previously allocated with SDL_LoadWAV_RW()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
|
||||
|
||||
/**
|
||||
* This function takes a source format and rate and a destination format
|
||||
* and rate, and initializes the \c cvt structure with information needed
|
||||
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
|
||||
* to the other.
|
||||
*
|
||||
* \return -1 if the format conversion is not supported, 0 if there's
|
||||
* no conversion needed, or 1 if the audio filter is set up.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
||||
SDL_AudioFormat src_format,
|
||||
Uint8 src_channels,
|
||||
int src_rate,
|
||||
SDL_AudioFormat dst_format,
|
||||
Uint8 dst_channels,
|
||||
int dst_rate);
|
||||
|
||||
/**
|
||||
* Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(),
|
||||
* created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of
|
||||
* audio data in the source format, this function will convert it in-place
|
||||
* to the desired format.
|
||||
*
|
||||
* The data conversion may expand the size of the audio data, so the buffer
|
||||
* \c cvt->buf should be allocated after the \c cvt structure is initialized by
|
||||
* SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
|
||||
|
||||
#define SDL_MIX_MAXVOLUME 128
|
||||
/**
|
||||
* This takes two audio buffers of the playing audio format and mixes
|
||||
* them, performing addition, volume adjustment, and overflow clipping.
|
||||
* The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME
|
||||
* for full audio volume. Note this does not change hardware volume.
|
||||
* This is provided for convenience -- you can mix your own audio data.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
|
||||
Uint32 len, int volume);
|
||||
|
||||
/**
|
||||
* This works like SDL_MixAudio(), but you specify the audio format instead of
|
||||
* using the format of audio device 1. Thus it can be used when no audio
|
||||
* device is open at all.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
|
||||
const Uint8 * src,
|
||||
SDL_AudioFormat format,
|
||||
Uint32 len, int volume);
|
||||
|
||||
/**
|
||||
* \name Audio lock functions
|
||||
*
|
||||
* The lock manipulated by these functions protects the callback function.
|
||||
* During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that
|
||||
* the callback function is not running. Do not call these from the callback
|
||||
* function or you will cause deadlock.
|
||||
*/
|
||||
/*@{*/
|
||||
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
|
||||
extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
|
||||
/*@}*//*Audio lock functions*/
|
||||
|
||||
/**
|
||||
* This function shuts down audio processing and closes the audio device.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
|
||||
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_audio_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
97
project/jni/sdl-2.0/include/SDL_bits.h
Normal file
97
project/jni/sdl-2.0/include/SDL_bits.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_bits.h
|
||||
*
|
||||
* Functions for fiddling with bits and bitmasks.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_bits_h
|
||||
#define _SDL_bits_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file SDL_bits.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the index of the most significant bit. Result is undefined when called
|
||||
* with 0. This operation can also be stated as "count leading zeroes" and
|
||||
* "log base 2".
|
||||
*
|
||||
* \return Index of the most significant bit, or -1 if the value is 0.
|
||||
*/
|
||||
SDL_FORCE_INLINE int
|
||||
SDL_MostSignificantBitIndex32(Uint32 x)
|
||||
{
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
/* Count Leading Zeroes builtin in GCC.
|
||||
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
|
||||
*/
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
return 31 - __builtin_clz(x);
|
||||
#else
|
||||
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
||||
* <seander@cs.stanford.edu>, released in the public domain.
|
||||
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
|
||||
*/
|
||||
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
|
||||
const int S[] = {1, 2, 4, 8, 16};
|
||||
|
||||
int msbIndex = 0;
|
||||
int i;
|
||||
|
||||
if (x == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 4; i >= 0; i--)
|
||||
{
|
||||
if (x & b[i])
|
||||
{
|
||||
x >>= S[i];
|
||||
msbIndex |= S[i];
|
||||
}
|
||||
}
|
||||
|
||||
return msbIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_bits_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
63
project/jni/sdl-2.0/include/SDL_blendmode.h
Normal file
63
project/jni/sdl-2.0/include/SDL_blendmode.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_blendmode.h
|
||||
*
|
||||
* Header file declaring the SDL_BlendMode enumeration
|
||||
*/
|
||||
|
||||
#ifndef _SDL_blendmode_h
|
||||
#define _SDL_blendmode_h
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
|
||||
dstRGBA = srcRGBA */
|
||||
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
|
||||
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
|
||||
dstA = srcA + (dstA * (1-srcA)) */
|
||||
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
|
||||
dstRGB = (srcRGB * srcA) + dstRGB
|
||||
dstA = dstA */
|
||||
SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
|
||||
dstRGB = srcRGB * dstRGB
|
||||
dstA = dstA */
|
||||
} SDL_BlendMode;
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_video_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
71
project/jni/sdl-2.0/include/SDL_clipboard.h
Normal file
71
project/jni/sdl-2.0/include/SDL_clipboard.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
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
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file SDL_clipboard.h
|
||||
*
|
||||
* Include file for SDL clipboard handling
|
||||
*/
|
||||
|
||||
#ifndef _SDL_clipboard_h
|
||||
#define _SDL_clipboard_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Put UTF-8 text into the clipboard
|
||||
*
|
||||
* \sa SDL_GetClipboardText()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
|
||||
|
||||
/**
|
||||
* \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
|
||||
*
|
||||
* \sa SDL_SetClipboardText()
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
||||
|
||||
/**
|
||||
* \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty
|
||||
*
|
||||
* \sa SDL_GetClipboardText()
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_clipboard_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user