Updated SDL 1.3 to the latest hg-5868:33245988e8a2 , video resize is not supported yet
This commit is contained in:
@@ -436,7 +436,7 @@ fi
|
||||
|
||||
if [ -z "$ResetSdlConfigForThisVersion" -o -z "$AUTO" ]; then
|
||||
echo
|
||||
echo "Reset SDL config when updating application to the new version (y) / (n) ($ResetSdlConfigForThisVersion): "
|
||||
echo -n "Reset SDL config when updating application to the new version (y) / (n) ($ResetSdlConfigForThisVersion): "
|
||||
read var
|
||||
if [ -n "$var" ] ; then
|
||||
ResetSdlConfigForThisVersion="$var"
|
||||
|
||||
5
build.sh
5
build.sh
@@ -34,5 +34,6 @@ cd project && env PATH=$NDKBUILDPATH nice -n19 ndk-build V=1 -j4 && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
|
||||
|| true ; } && \
|
||||
ant debug && \
|
||||
test -z "$1" && cd bin && adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && \
|
||||
adb install -r MainActivity-debug.apk
|
||||
test -z "$1" && cd bin && \
|
||||
{ adb install -r MainActivity-debug.apk || { \
|
||||
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; } ; }
|
||||
|
||||
@@ -16,6 +16,7 @@ SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=
|
||||
AppUsesMouse=n
|
||||
AppNeedsTwoButtonMouse=n
|
||||
ShowMouseCursor=n
|
||||
ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsTextInput=y
|
||||
@@ -33,6 +34,7 @@ FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
AppVersionCode=110014
|
||||
AppVersionName="1.1.0.14"
|
||||
ResetSdlConfigForThisVersion=n
|
||||
CompiledLibraries="sdl_mixer sdl_image"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-O3'
|
||||
|
||||
@@ -35,7 +35,7 @@ static inline SdlCompat_AcceleratedSurface * SdlCompat_CreateAcceleratedSurface(
|
||||
|
||||
format = SDL_PIXELFORMAT_RGB565;
|
||||
if( surface->flags & SDL_SRCCOLORKEY )
|
||||
format = SDL_PIXELFORMAT_RGBA5551;
|
||||
format = SDL_PIXELFORMAT_RGBA4444;
|
||||
|
||||
ret->t = SDL_CreateTextureFromSurface(format, surface);
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
ufoai
|
||||
gemrb-sdl-1.3
|
||||
@@ -1 +0,0 @@
|
||||
../sdl-1.3/Android.mk
|
||||
65
project/jni/sdl-1.2/Android.mk
Normal file
65
project/jni/sdl-1.2/Android.mk
Normal file
@@ -0,0 +1,65 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
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 \
|
||||
-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/video/android/*.cpp \
|
||||
src/haptic/dummy/*.c \
|
||||
src/loadso/dlopen/*.c \
|
||||
src/atomic/dummy/*.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
|
||||
|
||||
# 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_LDLIBS := -lGLESv1_CM -ldl -llog
|
||||
|
||||
ifneq ($(CRYSTAX_R5_TOOLCHAIN),)
|
||||
LOCAL_LDLIBS += -L$(NDK_PATH)/sources/crystax/libs/armeabi -lcrystax_static
|
||||
endif
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/SDL_glesfuncs.h
|
||||
229
project/jni/sdl-1.2/src/video/android/SDL_glesfuncs.h
Normal file
229
project/jni/sdl-1.2/src/video/android/SDL_glesfuncs.h
Normal file
@@ -0,0 +1,229 @@
|
||||
/* list of OpenGL ES functions sorted alphabetically
|
||||
If you need to use a GLES function from the SDL video subsystem,
|
||||
change it's entry from SDL_PROC_UNUSED to SDL_PROC and rebuild.
|
||||
*/
|
||||
#define SDL_PROC_UNUSED(ret,func,params)
|
||||
|
||||
SDL_PROC_UNUSED(void, glAlphaFunc, (GLenum func, GLclampf ref))
|
||||
SDL_PROC(void, glClearColor,
|
||||
(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
|
||||
SDL_PROC_UNUSED(void, glClearDepthf, (GLclampf depth))
|
||||
SDL_PROC_UNUSED(void, glClipPlanef, (GLenum plane, const GLfloat * equation))
|
||||
SDL_PROC(void, glColor4f,
|
||||
(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
|
||||
SDL_PROC_UNUSED(void, glDepthRangef, (GLclampf zNear, GLclampf zFar))
|
||||
SDL_PROC_UNUSED(void, glFogf, (GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glFogfv, (GLenum pname, const GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glFrustumf,
|
||||
(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
|
||||
GLfloat zNear, GLfloat zFar))
|
||||
SDL_PROC_UNUSED(void, glGetClipPlanef, (GLenum pname, GLfloat eqn[4]))
|
||||
SDL_PROC(void, glGetFloatv, (GLenum pname, GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glGetLightfv,
|
||||
(GLenum light, GLenum pname, GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glGetMaterialfv,
|
||||
(GLenum face, GLenum pname, GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glGetTexEnvfv,
|
||||
(GLenum env, GLenum pname, GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glGetTexParameterfv,
|
||||
(GLenum target, GLenum pname, GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glLightModelf, (GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glLightModelfv, (GLenum pname, const GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glLightf, (GLenum light, GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glLightfv,
|
||||
(GLenum light, GLenum pname, const GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glLineWidth, (GLfloat width))
|
||||
SDL_PROC_UNUSED(void, glLoadMatrixf, (const GLfloat * m))
|
||||
SDL_PROC_UNUSED(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glMaterialfv,
|
||||
(GLenum face, GLenum pname, const GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glMultMatrixf, (const GLfloat * m))
|
||||
SDL_PROC_UNUSED(void, glMultiTexCoord4f,
|
||||
(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q))
|
||||
SDL_PROC_UNUSED(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz))
|
||||
SDL_PROC(void, glOrthof,
|
||||
(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
|
||||
GLfloat zNear, GLfloat zFar))
|
||||
SDL_PROC_UNUSED(void, glPointParameterf, (GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glPointParameterfv,
|
||||
(GLenum pname, const GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glPointSize, (GLfloat size))
|
||||
SDL_PROC_UNUSED(void, glPolygonOffset, (GLfloat factor, GLfloat units))
|
||||
SDL_PROC_UNUSED(void, glRotatef,
|
||||
(GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
|
||||
SDL_PROC_UNUSED(void, glScalef, (GLfloat x, GLfloat y, GLfloat z))
|
||||
SDL_PROC(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glTexEnvfv,
|
||||
(GLenum target, GLenum pname, const GLfloat * params))
|
||||
SDL_PROC(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param))
|
||||
SDL_PROC_UNUSED(void, glTexParameterfv,
|
||||
(GLenum target, GLenum pname, const GLfloat * params))
|
||||
SDL_PROC_UNUSED(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z))
|
||||
|
||||
/* Available in both Common and Common-Lite profiles */
|
||||
SDL_PROC_UNUSED(void, glActiveTexture, (GLenum texture))
|
||||
SDL_PROC_UNUSED(void, glAlphaFuncx, (GLenum func, GLclampx ref))
|
||||
SDL_PROC_UNUSED(void, glBindBuffer, (GLenum target, GLuint buffer))
|
||||
SDL_PROC(void, glBindTexture, (GLenum target, GLuint texture))
|
||||
SDL_PROC(void, glBlendFunc, (GLenum sfactor, GLenum dfactor))
|
||||
SDL_PROC_UNUSED(void, glBufferData,
|
||||
(GLenum target, GLsizeiptr size, const GLvoid * data,
|
||||
GLenum usage))
|
||||
SDL_PROC_UNUSED(void, glBufferSubData,
|
||||
(GLenum target, GLintptr offset, GLsizeiptr size,
|
||||
const GLvoid * data))
|
||||
SDL_PROC(void, glClear, (GLbitfield mask))
|
||||
SDL_PROC_UNUSED(void, glClearColorx,
|
||||
(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha))
|
||||
SDL_PROC_UNUSED(void, glClearDepthx, (GLclampx depth))
|
||||
SDL_PROC_UNUSED(void, glClearStencil, (GLint s))
|
||||
SDL_PROC_UNUSED(void, glClientActiveTexture, (GLenum texture))
|
||||
SDL_PROC_UNUSED(void, glClipPlanex, (GLenum plane, const GLfixed * equation))
|
||||
SDL_PROC_UNUSED(void, glColor4ub,
|
||||
(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
|
||||
SDL_PROC_UNUSED(void, glColor4x,
|
||||
(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha))
|
||||
SDL_PROC_UNUSED(void, glColorMask,
|
||||
(GLboolean red, GLboolean green, GLboolean blue,
|
||||
GLboolean alpha))
|
||||
SDL_PROC(void, glColorPointer,
|
||||
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer))
|
||||
SDL_PROC_UNUSED(void, glCompressedTexImage2D,
|
||||
(GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
GLsizei imageSize, const GLvoid * data))
|
||||
SDL_PROC_UNUSED(void, glCompressedTexSubImage2D,
|
||||
(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format,
|
||||
GLsizei imageSize, const GLvoid * data))
|
||||
SDL_PROC_UNUSED(void, glCopyTexImage2D,
|
||||
(GLenum target, GLint level, GLenum internalformat, GLint x,
|
||||
GLint y, GLsizei width, GLsizei height, GLint border))
|
||||
SDL_PROC_UNUSED(void, glCopyTexSubImage2D,
|
||||
(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height))
|
||||
SDL_PROC_UNUSED(void, glCullFace, (GLenum mode))
|
||||
SDL_PROC_UNUSED(void, glDeleteBuffers, (GLsizei n, const GLuint * buffers))
|
||||
SDL_PROC_UNUSED(void, glDeleteTextures, (GLsizei n, const GLuint * textures))
|
||||
SDL_PROC_UNUSED(void, glDepthFunc, (GLenum func))
|
||||
SDL_PROC_UNUSED(void, glDepthMask, (GLboolean flag))
|
||||
SDL_PROC_UNUSED(void, glDepthRangex, (GLclampx zNear, GLclampx zFar))
|
||||
SDL_PROC(void, glDisable, (GLenum cap))
|
||||
SDL_PROC(void, glDisableClientState, (GLenum array))
|
||||
SDL_PROC(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
|
||||
SDL_PROC_UNUSED(void, glDrawElements,
|
||||
(GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid * indices))
|
||||
SDL_PROC(void, glEnable, (GLenum cap))
|
||||
SDL_PROC(void, glEnableClientState, (GLenum array))
|
||||
SDL_PROC_UNUSED(void, glFinish, (void))
|
||||
SDL_PROC_UNUSED(void, glFlush, (void))
|
||||
SDL_PROC_UNUSED(void, glFogx, (GLenum pname, GLfixed param))
|
||||
SDL_PROC_UNUSED(void, glFogxv, (GLenum pname, const GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glFrontFace, (GLenum mode))
|
||||
SDL_PROC_UNUSED(void, glFrustumx,
|
||||
(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
|
||||
GLfixed zNear, GLfixed zFar))
|
||||
SDL_PROC_UNUSED(void, glGetBooleanv, (GLenum pname, GLboolean * params))
|
||||
SDL_PROC_UNUSED(void, glGetBufferParameteriv,
|
||||
(GLenum target, GLenum pname, GLint * params))
|
||||
SDL_PROC_UNUSED(void, glGetClipPlanex, (GLenum pname, GLfixed eqn[4]))
|
||||
SDL_PROC_UNUSED(void, glGenBuffers, (GLsizei n, GLuint * buffers))
|
||||
SDL_PROC(void, glGenTextures, (GLsizei n, GLuint * textures))
|
||||
SDL_PROC(GLenum, glGetError, (void))
|
||||
SDL_PROC_UNUSED(void, glGetFixedv, (GLenum pname, GLfixed * params))
|
||||
SDL_PROC(void, glGetIntegerv, (GLenum pname, GLint * params))
|
||||
SDL_PROC_UNUSED(void, glGetLightxv,
|
||||
(GLenum light, GLenum pname, GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glGetMaterialxv,
|
||||
(GLenum face, GLenum pname, GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glGetPointerv, (GLenum pname, void **params))
|
||||
SDL_PROC_UNUSED(const GLubyte *, glGetString, (GLenum name))
|
||||
SDL_PROC_UNUSED(void, glGetTexEnviv,
|
||||
(GLenum env, GLenum pname, GLint * params))
|
||||
SDL_PROC_UNUSED(void, glGetTexEnvxv,
|
||||
(GLenum env, GLenum pname, GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glGetTexParameteriv,
|
||||
(GLenum target, GLenum pname, GLint * params))
|
||||
SDL_PROC_UNUSED(void, glGetTexParameterxv,
|
||||
(GLenum target, GLenum pname, GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glHint, (GLenum target, GLenum mode))
|
||||
SDL_PROC_UNUSED(GLboolean, glIsBuffer, (GLuint buffer))
|
||||
SDL_PROC_UNUSED(GLboolean, glIsEnabled, (GLenum cap))
|
||||
SDL_PROC_UNUSED(GLboolean, glIsTexture, (GLuint texture))
|
||||
SDL_PROC_UNUSED(void, glLightModelx, (GLenum pname, GLfixed param))
|
||||
SDL_PROC_UNUSED(void, glLightModelxv, (GLenum pname, const GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glLightx, (GLenum light, GLenum pname, GLfixed param))
|
||||
SDL_PROC_UNUSED(void, glLightxv,
|
||||
(GLenum light, GLenum pname, const GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glLineWidthx, (GLfixed width))
|
||||
SDL_PROC(void, glLoadIdentity, (void))
|
||||
SDL_PROC_UNUSED(void, glLoadMatrixx, (const GLfixed * m))
|
||||
SDL_PROC_UNUSED(void, glLogicOp, (GLenum opcode))
|
||||
SDL_PROC_UNUSED(void, glMaterialx, (GLenum face, GLenum pname, GLfixed param))
|
||||
SDL_PROC_UNUSED(void, glMaterialxv,
|
||||
(GLenum face, GLenum pname, const GLfixed * params))
|
||||
SDL_PROC(void, glMatrixMode, (GLenum mode))
|
||||
SDL_PROC_UNUSED(void, glMultMatrixx, (const GLfixed * m))
|
||||
SDL_PROC_UNUSED(void, glMultiTexCoord4x,
|
||||
(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q))
|
||||
SDL_PROC_UNUSED(void, glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz))
|
||||
SDL_PROC_UNUSED(void, glNormalPointer,
|
||||
(GLenum type, GLsizei stride, const GLvoid * pointer))
|
||||
SDL_PROC_UNUSED(void, glOrthox,
|
||||
(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
|
||||
GLfixed zNear, GLfixed zFar))
|
||||
SDL_PROC(void, glPixelStorei, (GLenum pname, GLint param))
|
||||
SDL_PROC_UNUSED(void, glPointParameterx, (GLenum pname, GLfixed param))
|
||||
SDL_PROC_UNUSED(void, glPointParameterxv,
|
||||
(GLenum pname, const GLfixed * params))
|
||||
SDL_PROC_UNUSED(void, glPointSizex, (GLfixed size))
|
||||
SDL_PROC_UNUSED(void, glPolygonOffsetx, (GLfixed factor, GLfixed units))
|
||||
SDL_PROC_UNUSED(void, glPopMatrix, (void))
|
||||
SDL_PROC_UNUSED(void, glPushMatrix, (void))
|
||||
SDL_PROC_UNUSED(void, glReadPixels,
|
||||
(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, GLvoid * pixels))
|
||||
SDL_PROC_UNUSED(void, glRotatex,
|
||||
(GLfixed angle, GLfixed x, GLfixed y, GLfixed z))
|
||||
SDL_PROC_UNUSED(void, glSampleCoverage, (GLclampf value, GLboolean invert))
|
||||
SDL_PROC_UNUSED(void, glSampleCoveragex, (GLclampx value, GLboolean invert))
|
||||
SDL_PROC_UNUSED(void, glScalex, (GLfixed x, GLfixed y, GLfixed z))
|
||||
SDL_PROC(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height))
|
||||
SDL_PROC_UNUSED(void, glShadeModel, (GLenum mode))
|
||||
SDL_PROC_UNUSED(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
|
||||
SDL_PROC_UNUSED(void, glStencilMask, (GLuint mask))
|
||||
SDL_PROC_UNUSED(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
|
||||
SDL_PROC(void, glTexCoordPointer,
|
||||
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer))
|
||||
SDL_PROC_UNUSED(void, glTexEnvi, (GLenum target, GLenum pname, GLint param))
|
||||
SDL_PROC_UNUSED(void, glTexEnvx, (GLenum target, GLenum pname, GLfixed param))
|
||||
SDL_PROC_UNUSED(void, glTexEnviv,
|
||||
(GLenum target, GLenum pname, const GLint * params))
|
||||
SDL_PROC_UNUSED(void, glTexEnvxv,
|
||||
(GLenum target, GLenum pname, const GLfixed * params))
|
||||
SDL_PROC(void, glTexImage2D,
|
||||
(GLenum target, GLint level, GLint internalformat, GLsizei width,
|
||||
GLsizei height, GLint border, GLenum format, GLenum type,
|
||||
const GLvoid * pixels))
|
||||
SDL_PROC(void, glTexParameteri, (GLenum target, GLenum pname, GLint param))
|
||||
SDL_PROC_UNUSED(void, glTexParameterx,
|
||||
(GLenum target, GLenum pname, GLfixed param))
|
||||
SDL_PROC(void, glTexParameteriv,
|
||||
(GLenum target, GLenum pname, const GLint * params))
|
||||
SDL_PROC_UNUSED(void, glTexParameterxv,
|
||||
(GLenum target, GLenum pname, const GLfixed * params))
|
||||
SDL_PROC(void, glTexSubImage2D,
|
||||
(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format, GLenum type,
|
||||
const GLvoid * pixels))
|
||||
SDL_PROC_UNUSED(void, glTranslatex, (GLfixed x, GLfixed y, GLfixed z))
|
||||
SDL_PROC(void, glVertexPointer,
|
||||
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer))
|
||||
SDL_PROC(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
|
||||
|
||||
/* extension functions used */
|
||||
SDL_PROC(void, glDrawTexiOES,
|
||||
(GLint x, GLint y, GLint z, GLint width, GLint height))
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/SDL_renderer_gles.c
|
||||
1056
project/jni/sdl-1.2/src/video/android/SDL_renderer_gles.c
Normal file
1056
project/jni/sdl-1.2/src/video/android/SDL_renderer_gles.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/SDL_renderer_gles.h
|
||||
28
project/jni/sdl-1.2/src/video/android/SDL_renderer_gles.h
Normal file
28
project/jni/sdl-1.2/src/video/android/SDL_renderer_gles.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/* OpenGL renderer implementation */
|
||||
|
||||
extern SDL_RenderDriver GL_ES_RenderDriver;
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -25,8 +25,12 @@
|
||||
#define _SDL_sysvideo_1_3_h
|
||||
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_keysym.h"
|
||||
#include "SDL_rect.h"
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#include "SDL_keycode.h"
|
||||
#else
|
||||
#include "SDL_keysym.h"
|
||||
#endif
|
||||
|
||||
/* The SDL video driver */
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ $(error Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package wit
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_CFLAGS := -O3 \
|
||||
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) \
|
||||
@@ -38,10 +38,13 @@ SDL_SRCS := \
|
||||
src/audio/android/*.c \
|
||||
src/cdrom/dummy/*.c \
|
||||
src/video/android/*.c \
|
||||
src/video/android/*.cpp \
|
||||
src/haptic/dummy/*.c \
|
||||
src/loadso/dlopen/*.c \
|
||||
src/atomic/dummy/*.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
|
||||
|
||||
|
||||
13
project/jni/sdl-1.3/README.BeOS
Normal file
13
project/jni/sdl-1.3/README.BeOS
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
SDL on BeOS R5
|
||||
==============
|
||||
|
||||
You can build SDL on BeOS like any other GNU style package.
|
||||
e.g. ./configure && make && make install
|
||||
By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.}
|
||||
|
||||
Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib,
|
||||
so it can be found by the dynamic linker.
|
||||
|
||||
Enjoy!
|
||||
Sam Lantinga (slouken@libsdl.org)
|
||||
106
project/jni/sdl-1.3/README.DirectFB
Normal file
106
project/jni/sdl-1.3/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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
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
|
||||
@@ -16,6 +15,7 @@ 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
|
||||
|
||||
186
project/jni/sdl-1.3/README.MacOSX
Normal file
186
project/jni/sdl-1.3/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-1.3/README.Platforms
Normal file
33
project/jni/sdl-1.3/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
|
||||
139
project/jni/sdl-1.3/README.Watcom
Normal file
139
project/jni/sdl-1.3/README.Watcom
Normal file
@@ -0,0 +1,139 @@
|
||||
|
||||
Using SDL 1.3 under Windows with the OpenWatcom compiler
|
||||
|
||||
====================================================
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
I have done the port under Windows XP Professional with SP2 installed.
|
||||
Windows 2000 should also be working. I'm not so sure about ancient Windows NT,
|
||||
since only DirectX 3 is available there. Building should be possible,
|
||||
but running the compiled applications will probalbly fail with
|
||||
SDL_VIDEODRIVER=directx. The windib driver should work, though.
|
||||
|
||||
To compile and use the SDL with Open Watcom you will need the following:
|
||||
- Open Watcom compiler. I used version 1.8. The environment variables
|
||||
PATH, WATCOM and INCLUDE need to be set appropriately - please consult
|
||||
the OpenWatcom documentation and instructions given during the
|
||||
installation of the compiler.
|
||||
My setup looks like this in owvars.bat:
|
||||
set WATCOM=C:\dev\ow18
|
||||
set INCLUDE=%WATCOM%\h;%WATCOM%\h\nt
|
||||
set PATH=%PATH%;%WATCOM%\binnt;%WATCOM%\binw
|
||||
- A recent DirectX SDK. The library needs D3d9.h so at leat the
|
||||
directx 9 sdk is to be used. I used DirectX 10 SDK from August 2009
|
||||
taken directly from the microsoft site.
|
||||
- The SDL 1.3 sources from Subversion
|
||||
- The file Watcom-Win32.zip (now available in Subversion)
|
||||
|
||||
|
||||
Building the Library
|
||||
--------------------
|
||||
|
||||
1) In the SDL base directory extract the archive Watcom-Win32.zip. This
|
||||
creates a subdirectory named 'watcom'.
|
||||
2) The makefile expects the environment variable DXDIR to be set to the
|
||||
base directory of a DirectX SDK. I have tried the August 2009
|
||||
DirectX SDK from Microsoft
|
||||
You can also edit the makefile directly and hard code your path to
|
||||
the SDK on your system.
|
||||
I have this in my setup:
|
||||
set DXDIR=..\dx10
|
||||
3) Enter the watcom directory and run
|
||||
wmake sdl
|
||||
4) All tests from the test directory are working and can be built by
|
||||
running
|
||||
wmake tests
|
||||
|
||||
Notes:
|
||||
|
||||
The makefile offers some options to tweak the way the library is built.
|
||||
You have at your disposal the option to build a static (default)
|
||||
library, or a DLL (with tgt=dll). You can also choose whether to build
|
||||
a Release (default) or a Debug version (with build=debug) of the tests
|
||||
and library. Please consult the usage comment at the top of the
|
||||
makefile for usage instructions.
|
||||
|
||||
If you specify a test target (i.e. 'wmake tests' for all tests, or
|
||||
selected targets like 'wmake testgl testvidinfo testoverlay2'), the
|
||||
tests are always freshly compiled and linked. This is done to
|
||||
minimise hassle when switching between library versions (static vs.
|
||||
DLL), because they require subtly different options.
|
||||
Also, the test executables are put directly into the test directory,
|
||||
so they can find their data files. The clean target of the makefile
|
||||
removes the test executables and the SDL.dll file from the test
|
||||
directory.
|
||||
|
||||
To use the library in your own projects with Open Watcom, you can use
|
||||
the way the tests are built as base of your own build environment.
|
||||
|
||||
The library can also be built with the stack calling convention of the
|
||||
compiler (-6s instead of -6r).
|
||||
|
||||
Test applications
|
||||
-----------------
|
||||
$FixME: which test works ? which one compiles ?
|
||||
|
||||
I've tried to make all tests work. The following table gives an overview
|
||||
of the current status.
|
||||
|
||||
Testname Status
|
||||
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
checkkeys +
|
||||
graywin +
|
||||
loopwave +
|
||||
testalpha +
|
||||
testbitmap +
|
||||
testdyngl +
|
||||
testerror +
|
||||
testfile +
|
||||
testgamma +
|
||||
testgl +
|
||||
testhread +
|
||||
testiconv - (all failed)
|
||||
testkeys +
|
||||
testlock +
|
||||
testoverlay + (needs 'set SDL_VIDEODRIVER=directx')
|
||||
testoverlay2 + (needs 'set SDL_VIDEODRIVER=directx')
|
||||
testpalette +
|
||||
testplatform +
|
||||
testsem +
|
||||
testsprite +
|
||||
testtimer +
|
||||
testver +
|
||||
testvidinfo +
|
||||
testwin ? (fading doesn't seem right)
|
||||
testwm +
|
||||
torturethread +
|
||||
testcdrom +
|
||||
testjoystick not tested
|
||||
threadwin +
|
||||
testcursor +
|
||||
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
There is room for further improvement:
|
||||
- Test joystick functionality.
|
||||
- Investigate fading issue in 'testwin' test.
|
||||
- Fix the UTF-8 support.
|
||||
- Adapt the makefile/object file list to support more target systems
|
||||
- Use "#pragma aux" syntax for the CPU info functions.
|
||||
|
||||
|
||||
Questions and Comments
|
||||
----------------------
|
||||
|
||||
Please direct any questions or comments to me:
|
||||
|
||||
ow_sdl [at] digitalfantasy [dot] it
|
||||
|
||||
The original porting to the open watcom compiler was made by
|
||||
Marc Peter <mailto:macpete@gmx.de>
|
||||
|
||||
Happy Coding!
|
||||
|
||||
Daniele Forghieri
|
||||
|
||||
55
project/jni/sdl-1.3/README.WinCE
Normal file
55
project/jni/sdl-1.3/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
|
||||
174
project/jni/sdl-1.3/README.android
Normal file
174
project/jni/sdl-1.3/README.android
Normal file
@@ -0,0 +1,174 @@
|
||||
================================================================================
|
||||
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
|
||||
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
|
||||
59
project/jni/sdl-1.3/README.ds
Normal file
59
project/jni/sdl-1.3/README.ds
Normal file
@@ -0,0 +1,59 @@
|
||||
================================================================================
|
||||
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.
|
||||
* The hardware renderer is using the libgl2d abstraction library that can be found at:
|
||||
http://rel.phatcode.net/junk.php?id=117
|
||||
Build it, and install the library and the header where SDL can find them (ie. in
|
||||
the libnds/lib and libnds/include directories).
|
||||
|
||||
|
||||
-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. Additionnaly it will compile several
|
||||
tests that you can run either on the DS or with desmume. For instance:
|
||||
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 port is very basic and incomplete:
|
||||
- SDL currently has to be compiled for either framebuffer mode or render mode.
|
||||
See USE_HW_RENDERER in Makefile.ds.
|
||||
- some optional renderer functions are not implemented.
|
||||
|
||||
-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 1.3 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.
|
||||
111
project/jni/sdl-1.3/README.iphoneos
Normal file
111
project/jni/sdl-1.3/README.iphoneos
Normal file
@@ -0,0 +1,111 @@
|
||||
==============================================================================
|
||||
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 SDLiPhoneOS.xcodeproj (located in Xcode-iPhoneOS/SDL) in XCode.
|
||||
2. Set Project->Set Active SDK to "Use Project Settings"
|
||||
3. Select your desired target, and hit build.
|
||||
|
||||
There are three build targets:
|
||||
- StaticLibiPhoneOS:
|
||||
Build SDL as a statically linked (armv6) library for iPhone OS 2.0.
|
||||
- StaticLibSimulator:
|
||||
Build SDL as a statically linked (x86) library for the iPhone Simulator
|
||||
- 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 iPhone OS 2.0
|
||||
==============================================================================
|
||||
|
||||
Here is the easiest method:
|
||||
1. Build the SDL libraries (libSDLiPhoneOS.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/iPhoneOS.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 (libSDLiPhoneOS.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/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/chapter_6_section_3.html#//apple_ref/doc/uid/TP40007072-CH7-SW21
|
||||
|
||||
==============================================================================
|
||||
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 1.3 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-1.3/README.pandora
Normal file
16
project/jni/sdl-1.3/README.pandora
Normal file
@@ -0,0 +1,16 @@
|
||||
SDL 1.3 with open pandora console support ( http://openpandora.org/ )
|
||||
=====================================================================
|
||||
|
||||
- A pandora specific video driver was writed to allow SDL 1.3 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
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -37,10 +36,6 @@
|
||||
* 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, and QNX. 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,
|
||||
* Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||
@@ -76,6 +71,7 @@
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "SDL_clipboard.h"
|
||||
@@ -83,9 +79,12 @@
|
||||
#include "SDL_endian.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_events.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_power.h"
|
||||
#include "SDL_render.h"
|
||||
#include "SDL_rwops.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_timer.h"
|
||||
@@ -116,7 +115,6 @@ extern "C" {
|
||||
#define SDL_INIT_JOYSTICK 0x00000200
|
||||
#define SDL_INIT_HAPTIC 0x00001000
|
||||
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
|
||||
#define SDL_INIT_EVENTTHREAD 0x01000000 /**< Not supported on all OS's */
|
||||
#define SDL_INIT_EVERYTHING 0x0000FFFF
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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
|
||||
@@ -50,9 +49,11 @@ 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) && ((_M_IX86) || (_M_X64)))
|
||||
#define SDL_TriggerBreakpoint() __asm { int 3 }
|
||||
#elif (defined(__GNUC__) && ((__i386__) || (__x86_64__)))
|
||||
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
|
||||
/* 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>
|
||||
@@ -62,7 +63,7 @@ assert can have unique static variables associated with it.
|
||||
#define SDL_TriggerBreakpoint()
|
||||
#endif
|
||||
|
||||
#if (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
|
||||
#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__
|
||||
@@ -98,7 +99,7 @@ typedef enum
|
||||
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_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
|
||||
} SDL_assert_state;
|
||||
|
||||
typedef struct SDL_assert_data
|
||||
@@ -168,7 +169,7 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
|
||||
|
||||
|
||||
typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
|
||||
const SDL_assert_data *, void *userdata);
|
||||
const SDL_assert_data* data, void* userdata);
|
||||
|
||||
/**
|
||||
* \brief Set an application-defined assertion handler.
|
||||
@@ -204,7 +205,7 @@ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||
*
|
||||
* <code>
|
||||
* const SDL_assert_data *item = SDL_GetAssertionReport();
|
||||
* while (item->condition) {
|
||||
* 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,
|
||||
@@ -213,8 +214,7 @@ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* \return List of all assertions. This never returns NULL,
|
||||
* even if there are no items.
|
||||
* \return List of all assertions.
|
||||
* \sa SDL_ResetAssertionReport
|
||||
*/
|
||||
extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
|
||||
|
||||
@@ -1,41 +1,58 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
|
||||
Contributed by Bob Pendleton, bob@pendleton.com
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* At the very minimum spin locks must be implemented. Without spin
|
||||
* locks it is not possible (AFAICT) to emulate the rest of the atomic
|
||||
* operations.
|
||||
* \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
|
||||
*
|
||||
* 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_
|
||||
@@ -46,6 +63,13 @@
|
||||
|
||||
#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) && !defined(_WIN32_WCE)
|
||||
#include <intrin.h>
|
||||
#define HAVE_MSC_ATOMICS 1
|
||||
#endif
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
@@ -53,154 +77,232 @@ extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \name SDL AtomicLock
|
||||
*
|
||||
* The spin lock functions and type are required and can not be
|
||||
* emulated because they are used in the emulation code.
|
||||
* \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 volatile Uint32 SDL_SpinLock;
|
||||
typedef int SDL_SpinLock;
|
||||
|
||||
/**
|
||||
* \brief Lock a spin lock by setting it to a none zero value.
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
* \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
|
||||
* \brief Unlock a spin lock by setting it to 0. Always returns immediately
|
||||
*
|
||||
* \param lock Points to the lock.
|
||||
* \param lock Points to the lock.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
||||
|
||||
/*@}*//*SDL AtomicLock*/
|
||||
|
||||
/**
|
||||
* \name 32 bit atomic operations
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* \brief Check to see if \c *ptr == 0 and set it to 1.
|
||||
*
|
||||
* \return SDL_True if the value pointed to by \c ptr was zero and
|
||||
* SDL_False if it was not zero
|
||||
*
|
||||
* \param ptr Points to the value to be tested and set.
|
||||
* The compiler barrier prevents the compiler from reordering
|
||||
* reads and writes to globally visible variables across the call.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
|
||||
#ifdef _MSC_VER
|
||||
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
|
||||
|
||||
/* 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)
|
||||
#if SIZEOF_VOIDP == 4
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((int32_t)(oldval), (int32_t)(newval), (int32_t*)(a))
|
||||
#elif SIZEOF_VOIDP == 8
|
||||
#define SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap64Barrier((int64_t)(oldval), (int64_t)(newval), (int64_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 Set the value pointed to by \c ptr to be zero.
|
||||
*
|
||||
* \param ptr Address of the value to be set to zero
|
||||
* \brief A type representing an atomic integer value. It is a struct
|
||||
* so people don't accidentally use numeric operations on it.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicClear32(volatile Uint32 * ptr);
|
||||
#ifndef SDL_atomic_t_defined
|
||||
typedef struct { int value; } SDL_atomic_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Fetch the current value of \c *ptr and then increment that
|
||||
* value in place.
|
||||
*
|
||||
* \return The value before it was incremented.
|
||||
*
|
||||
* \param ptr Address of the value to fetch and increment
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
|
||||
* \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
|
||||
#define SDL_AtomicCAS SDL_AtomicCAS_
|
||||
#endif
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval);
|
||||
|
||||
/**
|
||||
* \brief Fetch \c *ptr and then decrement the value in place.
|
||||
*
|
||||
* \return The value before it was decremented.
|
||||
*
|
||||
* \param ptr Address of the value to fetch and decrement
|
||||
* \brief Set an atomic variable to a value.
|
||||
*
|
||||
* \return The previous value of the atomic variable.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
|
||||
#ifndef SDL_AtomicSet
|
||||
static __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 Fetch the current value at \c ptr and then add \c value to \c *ptr.
|
||||
*
|
||||
* \return \c *ptr before the addition took place.
|
||||
*
|
||||
* \param ptr The address of data we are changing.
|
||||
* \param value The value to add to \c *ptr.
|
||||
* \brief Get the value of an atomic variable
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
|
||||
#ifndef SDL_AtomicGet
|
||||
static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
|
||||
{
|
||||
int value = a->value;
|
||||
SDL_CompilerBarrier();
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Fetch \c *ptr and then subtract \c value from it.
|
||||
*
|
||||
* \return \c *ptr before the subtraction took place.
|
||||
*
|
||||
* \param ptr The address of the data being changed.
|
||||
* \param value The value to subtract from \c *ptr.
|
||||
* \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
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
|
||||
#ifndef SDL_AtomicAdd
|
||||
static __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 Add one to the data pointed to by \c ptr and return that value.
|
||||
*
|
||||
* \return The incremented value.
|
||||
*
|
||||
* \param ptr The address of the data to increment.
|
||||
* \brief Increment an atomic variable used as a reference count.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
|
||||
#ifndef SDL_AtomicIncRef
|
||||
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Subtract one from data pointed to by \c ptr and return the new value.
|
||||
*
|
||||
* \return The decremented value.
|
||||
*
|
||||
* \param ptr The address of the data to decrement.
|
||||
* \brief Decrement an atomic variable used as a reference count.
|
||||
*
|
||||
* \return SDL_TRUE if the variable reached zero after decrementing,
|
||||
* SDL_FALSE otherwise
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
|
||||
#ifndef SDL_AtomicDecRef
|
||||
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Add \c value to the data pointed to by \c ptr and return result.
|
||||
*
|
||||
* \return The sum of \c *ptr and \c value.
|
||||
*
|
||||
* \param ptr The address of the data to be modified.
|
||||
* \param value The value to be added.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
||||
* \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
|
||||
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_
|
||||
#endif
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval);
|
||||
|
||||
/**
|
||||
* \brief Subtract \c value from the data pointed to by \c ptr and return the result.
|
||||
*
|
||||
* \return The difference between \c *ptr and \c value.
|
||||
*
|
||||
* \param ptr The address of the data to be modified.
|
||||
* \param value The value to be subtracted.
|
||||
* \brief Set a pointer to a value atomically.
|
||||
*
|
||||
* \return The previous value of the pointer.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
||||
|
||||
/*@}*//*32 bit atomic operations*/
|
||||
#ifndef SDL_AtomicSetPtr
|
||||
static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
|
||||
{
|
||||
void* value;
|
||||
do {
|
||||
value = *a;
|
||||
} while (!SDL_AtomicCASPtr(a, value, v));
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name 64 bit atomic operations
|
||||
* \brief Get the value of a pointer atomically.
|
||||
*/
|
||||
/*@{*/
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
#ifndef SDL_AtomicGetPtr
|
||||
static __inline__ void* SDL_AtomicGetPtr(void* *a)
|
||||
{
|
||||
void* value = *a;
|
||||
SDL_CompilerBarrier();
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet64(volatile Uint64 * ptr);
|
||||
extern DECLSPEC void SDLCALL SDL_AtomicClear64(volatile Uint64 * ptr);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenIncrement64(volatile Uint64 * ptr);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenDecrement64(volatile Uint64 * ptr);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenAdd64(volatile Uint64 * ptr, Uint64 value);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenSubtract64(volatile Uint64 * ptr, Uint64 value);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicIncrementThenFetch64(volatile Uint64 * ptr);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicDecrementThenFetch64(volatile Uint64 * ptr);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicAddThenFetch64(volatile Uint64 * ptr, Uint64 value);
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_AtomicSubtractThenFetch64(volatile Uint64 * ptr, Uint64 value);
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
/*@}*//*64 bit atomic operations*/
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -43,12 +42,9 @@ extern "C" {
|
||||
typedef enum
|
||||
{
|
||||
SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
|
||||
SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst
|
||||
(alpha is mask) */
|
||||
|
||||
SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
|
||||
SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
|
||||
SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
|
||||
SDL_BLENDMODE_BLEND = 0x00000001, /**< dst = (src * A) + (dst * (1-A)) */
|
||||
SDL_BLENDMODE_ADD = 0x00000002, /**< dst = (src * A) + dst */
|
||||
SDL_BLENDMODE_MOD = 0x00000004 /**< dst = src * dst */
|
||||
} SDL_BlendMode;
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -56,7 +55,7 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
|
||||
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
|
||||
|
||||
/**
|
||||
* \brief Returns whether the clipboard has text
|
||||
* \brief Returns a flag indicating whether the clipboard exists and contains a text string that it non-empty
|
||||
*
|
||||
* \sa SDL_GetClipboardText()
|
||||
*/
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -64,6 +63,12 @@ extern "C" {
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/* Platform */
|
||||
#ifdef __WIN32__
|
||||
#undef __WIN32__
|
||||
#define __WIN32__ 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \name Surface flags
|
||||
*/
|
||||
@@ -202,14 +207,6 @@ typedef enum
|
||||
SDL_GRAB_ON = 1
|
||||
} SDL_GrabMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_TEXTURESCALEMODE_NONE = SDL_SCALEMODE_NONE,
|
||||
SDL_TEXTURESCALEMODE_FAST = SDL_SCALEMODE_FAST,
|
||||
SDL_TEXTURESCALEMODE_SLOW = SDL_SCALEMODE_SLOW,
|
||||
SDL_TEXTURESCALEMODE_BEST = SDL_SCALEMODE_BEST
|
||||
} SDL_TextureScaleMode;
|
||||
|
||||
struct SDL_SysWMinfo;
|
||||
|
||||
/**
|
||||
@@ -217,6 +214,13 @@ struct SDL_SysWMinfo;
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#define SDL_keysym SDL_Keysym
|
||||
#define SDL_KeySym SDL_Keysym
|
||||
#define SDL_scancode SDL_Scancode
|
||||
#define SDL_ScanCode SDL_Scancode
|
||||
#define SDLKey SDL_Keycode
|
||||
#define SDLMod SDL_Keymod
|
||||
|
||||
/**
|
||||
* \name Renamed keys
|
||||
*
|
||||
@@ -272,8 +276,8 @@ struct SDL_SysWMinfo;
|
||||
#define SDL_AllocSurface SDL_CreateRGBSurface
|
||||
|
||||
extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
|
||||
extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
||||
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
|
||||
extern DECLSPEC const char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
|
||||
extern DECLSPEC const char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
|
||||
extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
|
||||
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
|
||||
int height,
|
||||
@@ -323,18 +327,27 @@ extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
|
||||
SDL_Rect * dstrect);
|
||||
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
|
||||
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
|
||||
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
|
||||
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
|
||||
const Uint16 * green,
|
||||
const Uint16 * blue);
|
||||
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
|
||||
Uint16 * blue);
|
||||
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
|
||||
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
|
||||
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
|
||||
|
||||
typedef SDL_Texture* SDL_TextureID;
|
||||
typedef SDL_Window* SDL_WindowID;
|
||||
|
||||
#define SDL_RenderPoint SDL_RenderDrawPoint
|
||||
#define SDL_RenderLine SDL_RenderDrawLine
|
||||
#define SDL_RenderFill(X) (X) ? SDL_RenderFillRect(X) : SDL_RenderClear()
|
||||
#define SDL_KillThread(X)
|
||||
|
||||
/* The timeslice and timer resolution are no longer relevant */
|
||||
#define SDL_TIMESLICE 10
|
||||
#define TIMER_RESOLUTION 10
|
||||
|
||||
typedef Uint32 (SDLCALL * SDL_OldTimerCallback) (Uint32 interval);
|
||||
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_OldTimerCallback callback);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
|
||||
|
||||
/*@}*//*Compatibility*/
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_h
|
||||
@@ -34,7 +33,7 @@
|
||||
|
||||
/* Make sure that this isn't included by Visual C++ */
|
||||
#ifdef _MSC_VER
|
||||
#error You should copy include/SDL_config.h.default to include/SDL_config.h
|
||||
#error You should run hg revert SDL_config.h
|
||||
#endif
|
||||
|
||||
/* C language features */
|
||||
@@ -43,21 +42,10 @@
|
||||
#undef volatile
|
||||
|
||||
/* C datatypes */
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#undef size_t
|
||||
#undef int8_t
|
||||
#undef uint8_t
|
||||
#undef int16_t
|
||||
#undef uint16_t
|
||||
#undef int32_t
|
||||
#undef uint32_t
|
||||
#undef int64_t
|
||||
#undef uint64_t
|
||||
#undef uintptr_t
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
#undef SIZEOF_VOIDP
|
||||
#undef SDL_HAS_64BIT_TYPE
|
||||
#undef HAVE_GCC_ATOMICS
|
||||
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
|
||||
#undef HAVE_PTHREAD_SPINLOCK
|
||||
|
||||
/* Comment this if you want to build without any C library requirements */
|
||||
#undef HAVE_LIBC
|
||||
@@ -81,6 +69,7 @@
|
||||
#undef HAVE_ICONV_H
|
||||
#undef HAVE_SIGNAL_H
|
||||
#undef HAVE_ALTIVEC_H
|
||||
#undef HAVE_PTHREAD_NP_H
|
||||
|
||||
/* C library functions */
|
||||
#undef HAVE_MALLOC
|
||||
@@ -88,7 +77,7 @@
|
||||
#undef HAVE_REALLOC
|
||||
#undef HAVE_FREE
|
||||
#undef HAVE_ALLOCA
|
||||
#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
|
||||
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
|
||||
#undef HAVE_GETENV
|
||||
#undef HAVE_SETENV
|
||||
#undef HAVE_PUTENV
|
||||
@@ -151,6 +140,7 @@
|
||||
#undef HAVE_SINF
|
||||
#undef HAVE_SQRT
|
||||
#undef HAVE_SIGACTION
|
||||
#undef HAVE_SA_SIGACTION
|
||||
#undef HAVE_SETJMP
|
||||
#undef HAVE_NANOSLEEP
|
||||
#undef HAVE_SYSCONF
|
||||
@@ -158,6 +148,9 @@
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
#undef HAVE_GETPAGESIZE
|
||||
#undef HAVE_MPROTECT
|
||||
#undef HAVE_ICONV
|
||||
#undef HAVE_PTHREAD_SETNAME_NP
|
||||
#undef HAVE_PTHREAD_SET_NAME_NP
|
||||
|
||||
#else
|
||||
/* We may need some replacement for stdarg.h here */
|
||||
@@ -168,6 +161,7 @@
|
||||
#undef SDL_DEFAULT_ASSERT_LEVEL
|
||||
|
||||
/* Allow disabling of core subsystems */
|
||||
#undef SDL_ATOMIC_DISABLED
|
||||
#undef SDL_AUDIO_DISABLED
|
||||
#undef SDL_CPUINFO_DISABLED
|
||||
#undef SDL_EVENTS_DISABLED
|
||||
@@ -175,6 +169,7 @@
|
||||
#undef SDL_JOYSTICK_DISABLED
|
||||
#undef SDL_HAPTIC_DISABLED
|
||||
#undef SDL_LOADSO_DISABLED
|
||||
#undef SDL_RENDER_DISABLED
|
||||
#undef SDL_THREADS_DISABLED
|
||||
#undef SDL_TIMERS_DISABLED
|
||||
#undef SDL_VIDEO_DISABLED
|
||||
@@ -192,11 +187,10 @@
|
||||
#undef SDL_AUDIO_DRIVER_COREAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_DISK
|
||||
#undef SDL_AUDIO_DRIVER_DUMMY
|
||||
#undef SDL_AUDIO_DRIVER_DMEDIA
|
||||
#undef SDL_AUDIO_DRIVER_XAUDIO2
|
||||
#undef SDL_AUDIO_DRIVER_DSOUND
|
||||
#undef SDL_AUDIO_DRIVER_ESD
|
||||
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_MMEAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_NAS
|
||||
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
|
||||
#undef SDL_AUDIO_DRIVER_NDS
|
||||
@@ -205,7 +199,7 @@
|
||||
#undef SDL_AUDIO_DRIVER_PAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_QSA
|
||||
#undef SDL_AUDIO_DRIVER_SUNAUDIO
|
||||
#undef SDL_AUDIO_DRIVER_WINWAVEOUT
|
||||
#undef SDL_AUDIO_DRIVER_WINMM
|
||||
#undef SDL_AUDIO_DRIVER_FUSIONSOUND
|
||||
#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
|
||||
|
||||
@@ -218,7 +212,6 @@
|
||||
#undef SDL_JOYSTICK_IOKIT
|
||||
#undef SDL_JOYSTICK_LINUX
|
||||
#undef SDL_JOYSTICK_NDS
|
||||
#undef SDL_JOYSTICK_RISCOS
|
||||
#undef SDL_JOYSTICK_WINMM
|
||||
#undef SDL_JOYSTICK_USBHID
|
||||
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
|
||||
@@ -229,11 +222,10 @@
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#undef SDL_LOADSO_BEOS
|
||||
#undef SDL_LOADSO_DLCOMPAT
|
||||
#undef SDL_LOADSO_DLOPEN
|
||||
#undef SDL_LOADSO_DUMMY
|
||||
#undef SDL_LOADSO_LDG
|
||||
#undef SDL_LOADSO_WIN32
|
||||
#undef SDL_LOADSO_WINDOWS
|
||||
|
||||
/* Enable various threading systems */
|
||||
#undef SDL_THREAD_BEOS
|
||||
@@ -241,16 +233,14 @@
|
||||
#undef SDL_THREAD_PTHREAD
|
||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
|
||||
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
|
||||
#undef SDL_THREAD_SPROC
|
||||
#undef SDL_THREAD_WIN32
|
||||
#undef SDL_THREAD_WINDOWS
|
||||
|
||||
/* Enable various timer systems */
|
||||
#undef SDL_TIMER_BEOS
|
||||
#undef SDL_TIMER_DUMMY
|
||||
#undef SDL_TIMER_NDS
|
||||
#undef SDL_TIMER_RISCOS
|
||||
#undef SDL_TIMER_UNIX
|
||||
#undef SDL_TIMER_WIN32
|
||||
#undef SDL_TIMER_WINDOWS
|
||||
#undef SDL_TIMER_WINCE
|
||||
|
||||
/* Enable various video drivers */
|
||||
@@ -259,41 +249,29 @@
|
||||
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||
#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
|
||||
#undef SDL_VIDEO_DRIVER_DUMMY
|
||||
#undef SDL_VIDEO_DRIVER_FBCON
|
||||
#undef SDL_VIDEO_DRIVER_NDS
|
||||
#undef SDL_VIDEO_DRIVER_PHOTON
|
||||
#undef SDL_VIDEO_DRIVER_QNXGF
|
||||
#undef SDL_VIDEO_DRIVER_PS3
|
||||
#undef SDL_VIDEO_DRIVER_RISCOS
|
||||
#undef SDL_VIDEO_DRIVER_SVGALIB
|
||||
#undef SDL_VIDEO_DRIVER_WIN32
|
||||
#undef SDL_VIDEO_DRIVER_WINDOWS
|
||||
#undef SDL_VIDEO_DRIVER_X11
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
|
||||
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
|
||||
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
|
||||
#undef SDL_VIDEO_DRIVER_X11_XCURSOR
|
||||
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
|
||||
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||
#undef SDL_VIDEO_DRIVER_X11_XINPUT
|
||||
#undef SDL_VIDEO_DRIVER_X11_SCRNSAVER
|
||||
#undef SDL_VIDEO_DRIVER_X11_XV
|
||||
#undef SDL_VIDEO_DRIVER_X11_XRENDER
|
||||
#undef SDL_VIDEO_DRIVER_X11_XDAMAGE
|
||||
#undef SDL_VIDEO_DRIVER_X11_XFIXES
|
||||
#undef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||
#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
|
||||
#undef SDL_VIDEO_DRIVER_X11_XSHAPE
|
||||
#undef SDL_VIDEO_DRIVER_X11_XVIDMODE
|
||||
|
||||
#undef SDL_VIDEO_RENDER_D3D
|
||||
#undef SDL_VIDEO_RENDER_GDI
|
||||
#undef SDL_VIDEO_RENDER_OGL
|
||||
#undef SDL_VIDEO_RENDER_OGL_ES
|
||||
#undef SDL_VIDEO_RENDER_X11
|
||||
#undef SDL_VIDEO_RENDER_GAPI
|
||||
#undef SDL_VIDEO_RENDER_DDRAW
|
||||
#undef SDL_VIDEO_RENDER_DIRECTFB
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#undef SDL_VIDEO_OPENGL
|
||||
|
||||
@@ -163,6 +163,7 @@
|
||||
#undef HAVE_SYSCTLBYNAME
|
||||
#undef SDL_ALTIVEC_BLITTERS
|
||||
#define SDL_ASSEMBLY_ROUTINES 1 // There is no assembly code for Arm CPU yet
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
/* Prototypes for Android-specific functions */
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_iphoneos_h
|
||||
@@ -25,23 +24,13 @@
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
#ifdef __LP64__
|
||||
#define SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#define SDL_HAS_64BIT_TYPE 1
|
||||
#define HAVE_GCC_ATOMICS 1
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
@@ -93,6 +82,9 @@ typedef unsigned long uintptr_t;
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
@@ -112,7 +104,7 @@ typedef unsigned long uintptr_t;
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
|
||||
/* enable iPhone version of Core Audio driver */
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIOIPHONE 1
|
||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
@@ -140,6 +132,7 @@ typedef unsigned long uintptr_t;
|
||||
/* enable OpenGL ES */
|
||||
#define SDL_VIDEO_OPENGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES 1
|
||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_UIKIT 1
|
||||
@@ -147,6 +140,9 @@ typedef unsigned long uintptr_t;
|
||||
/* enable iPhone keyboard support */
|
||||
#define SDL_IPHONE_KEYBOARD 1
|
||||
|
||||
/* enable joystick subsystem */
|
||||
#define SDL_JOYSTICK_DISABLED 0
|
||||
|
||||
/* Set max recognized G-force from accelerometer
|
||||
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
|
||||
*/
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_macosx_h
|
||||
@@ -36,8 +35,6 @@
|
||||
#define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#define SDL_HAS_64BIT_TYPE 1
|
||||
|
||||
/* Useful headers */
|
||||
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
|
||||
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
|
||||
@@ -136,25 +133,32 @@
|
||||
#define SDL_VIDEO_DRIVER_X11 1
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER "/usr/X11R6/lib/libXrender.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT "/usr/X11R6/lib/libXi.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.6.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
|
||||
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XINPUT 1
|
||||
#define SDL_VIDEO_DRIVER_X11_SCRNSAVER 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XV 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
|
||||
#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
|
||||
|
||||
#ifndef SDL_VIDEO_RENDER_OGL
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#define SDL_VIDEO_RENDER_X11 1
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_CGL
|
||||
#define SDL_VIDEO_OPENGL_CGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_GLX
|
||||
#define SDL_VIDEO_OPENGL_GLX 1
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_MACOSX 1
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_minimal_h
|
||||
@@ -31,19 +30,26 @@
|
||||
* This is the minimal configuration that can be used to build SDL.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
typedef unsigned int size_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned int size_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
|
||||
#endif
|
||||
|
||||
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_nintendods_h
|
||||
@@ -46,7 +45,7 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
|
||||
#endif
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
#define SDL_HAS_64BIT_TYPE 1
|
||||
#define SIZEOF_VOIDP 4
|
||||
|
||||
/* Useful headers */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
@@ -113,9 +112,18 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_NDS 1
|
||||
/*#define SDL_VIDEO_DRIVER_DUMMY 1 TODO: uncomment this later*/
|
||||
#ifdef USE_HW_RENDERER
|
||||
#define SDL_VIDEO_RENDER_NDS 1
|
||||
#else
|
||||
#define SDL_VIDEO_RENDER_NDS 0
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_NINTENDODS 1
|
||||
|
||||
/* Enable haptic support */
|
||||
#define SDL_HAPTIC_NDS 1
|
||||
|
||||
#define SDL_BYTEORDER SDL_LIL_ENDIAN
|
||||
|
||||
#endif /* _SDL_config_nintendods_h */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_h
|
||||
@@ -34,7 +33,6 @@
|
||||
#define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#define SDL_HAS_64BIT_TYPE 1
|
||||
#define SDL_BYTEORDER 1234
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
|
||||
207
project/jni/sdl-1.3/include/SDL_config_windows.h
Normal file
207
project/jni/sdl-1.3/include/SDL_config_windows.h
Normal file
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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_config_windows_h
|
||||
#define _SDL_config_windows_h
|
||||
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* This is a set of defines to configure the SDL features */
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
|
||||
#define HAVE_STDINT_H 1
|
||||
#elif defined(_MSC_VER)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#ifndef _UINTPTR_T_DEFINED
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
#define _UINTPTR_T_DEFINED
|
||||
#endif
|
||||
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
||||
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
||||
#define DWORD_PTR DWORD
|
||||
#endif
|
||||
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
|
||||
#define LONG_PTR LONG
|
||||
#endif
|
||||
#else /* !__GNUC__ && !_MSC_VER */
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
#ifndef _SIZE_T_DEFINED_
|
||||
#define _SIZE_T_DEFINED_
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif /* __GNUC__ || _MSC_VER */
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
#ifdef _WIN64
|
||||
# define SIZEOF_VOIDP 8
|
||||
#else
|
||||
# define SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
/* Enabled for SDL 1.2 (binary compatibility) */
|
||||
//#define HAVE_LIBC 1
|
||||
#ifdef HAVE_LIBC
|
||||
/* Useful headers */
|
||||
#define HAVE_STDIO_H 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_MATH_H 1
|
||||
#ifndef _WIN32_WCE
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#endif
|
||||
|
||||
/* C library functions */
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE__STRREV 1
|
||||
#define HAVE__STRUPR 1
|
||||
#define HAVE__STRLWR 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_ITOA 1
|
||||
#define HAVE__LTOA 1
|
||||
#define HAVE__ULTOA 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE__STRICMP 1
|
||||
#define HAVE__STRNICMP 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_M_PI 1
|
||||
#define HAVE_ATAN 1
|
||||
#define HAVE_ATAN2 1
|
||||
#define HAVE_CEIL 1
|
||||
#define HAVE_COPYSIGN 1
|
||||
#define HAVE_COS 1
|
||||
#define HAVE_COSF 1
|
||||
#define HAVE_FABS 1
|
||||
#define HAVE_FLOOR 1
|
||||
#define HAVE_LOG 1
|
||||
#define HAVE_POW 1
|
||||
#define HAVE_SCALBN 1
|
||||
#define HAVE_SIN 1
|
||||
#define HAVE_SINF 1
|
||||
#define HAVE_SQRT 1
|
||||
#else
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
#endif
|
||||
|
||||
/* Enable various audio drivers */
|
||||
#ifndef _WIN32_WCE
|
||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
||||
#endif
|
||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||
#define SDL_AUDIO_DRIVER_DISK 1
|
||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||
|
||||
/* Enable various input drivers */
|
||||
#ifdef _WIN32_WCE
|
||||
#define SDL_JOYSTICK_DISABLED 1
|
||||
#define SDL_HAPTIC_DUMMY 1
|
||||
#else
|
||||
#define SDL_JOYSTICK_DINPUT 1
|
||||
#define SDL_HAPTIC_DINPUT 1
|
||||
#endif
|
||||
|
||||
/* Enable various shared object loading systems */
|
||||
#define SDL_LOADSO_WINDOWS 1
|
||||
|
||||
/* Enable various threading systems */
|
||||
#define SDL_THREAD_WINDOWS 1
|
||||
|
||||
/* Enable various timer systems */
|
||||
#ifdef _WIN32_WCE
|
||||
#define SDL_TIMER_WINCE 1
|
||||
#else
|
||||
#define SDL_TIMER_WINDOWS 1
|
||||
#endif
|
||||
|
||||
/* Enable various video drivers */
|
||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||
#define SDL_VIDEO_DRIVER_WINDOWS 1
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#ifndef SDL_VIDEO_RENDER_D3D
|
||||
#define SDL_VIDEO_RENDER_D3D 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable OpenGL support */
|
||||
#ifndef _WIN32_WCE
|
||||
#ifndef SDL_VIDEO_OPENGL
|
||||
#define SDL_VIDEO_OPENGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_OPENGL_WGL
|
||||
#define SDL_VIDEO_OPENGL_WGL 1
|
||||
#endif
|
||||
#ifndef SDL_VIDEO_RENDER_OGL
|
||||
#define SDL_VIDEO_RENDER_OGL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable system power support */
|
||||
#define SDL_POWER_WINDOWS 1
|
||||
|
||||
/* Enable assembly routines (Win64 doesn't have inline asm) */
|
||||
#ifndef _WIN64
|
||||
#define SDL_ASSEMBLY_ROUTINES 1
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_config_windows_h */
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_config_h
|
||||
@@ -28,12 +27,6 @@
|
||||
/* General platform specific identifiers */
|
||||
#include "SDL_platform.h"
|
||||
|
||||
/* Make sure that this isn't included by Visual C++ */
|
||||
#ifdef _MSC_VER
|
||||
#error You should copy include/SDL_config.h.default to include/SDL_config.h
|
||||
#endif
|
||||
|
||||
#define SDL_HAS_64BIT_TYPE 1
|
||||
#define SDL_BYTEORDER 1234
|
||||
|
||||
#define HAVE_ALLOCA_H 1
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -31,6 +30,39 @@
|
||||
|
||||
#include "SDL_stdinc.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) && !defined(_WIN32_WCE)
|
||||
#include <intrin.h>
|
||||
#ifndef _WIN64
|
||||
#define __MMX__
|
||||
#define __3dNOW__
|
||||
#endif
|
||||
#define __SSE__
|
||||
#define __SSE2__
|
||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#ifdef __ALTIVEC__
|
||||
#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__)
|
||||
#include <altivec.h>
|
||||
#undef pixel
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __MMX__
|
||||
#include <mmintrin.h>
|
||||
#endif
|
||||
#ifdef __3dNOW__
|
||||
#include <mm3dnow.h>
|
||||
#endif
|
||||
#ifdef __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#ifdef __SSE2__
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
@@ -39,36 +71,46 @@ extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/* This is a guess for the cacheline size used for padding.
|
||||
* Most x86 processors have a 64 byte cache line.
|
||||
* The 64-bit PowerPC processors have a 128 byte cache line.
|
||||
* We'll use the larger value to be generally safe.
|
||||
*/
|
||||
#define SDL_CACHELINE_SIZE 128
|
||||
|
||||
/**
|
||||
* This function returns the number of CPU cores available.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
|
||||
|
||||
/**
|
||||
* This function returns the L1 cache line size of the CPU
|
||||
*
|
||||
* This is useful for determining multi-threaded structure padding
|
||||
* or SIMD prefetch sizes.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has the RDTSC instruction.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has AltiVec features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has MMX features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has MMX Ext.\ features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has 3DNow!\ features.
|
||||
* This function returns true if the CPU has 3DNow! features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has 3DNow!\ Ext.\ features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has SSE features.
|
||||
*/
|
||||
@@ -80,9 +122,20 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has AltiVec features.
|
||||
* This function returns true if the CPU has SSE3 features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has SSE4.1 features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
|
||||
|
||||
/**
|
||||
* This function returns true if the CPU has SSE4.2 features.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -153,7 +152,6 @@ SDL_Swap32(Uint32 x)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
static __inline__ Uint64
|
||||
SDL_Swap64(Uint64 x)
|
||||
@@ -195,14 +193,6 @@ SDL_Swap64(Uint64 x)
|
||||
return (x);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/**
|
||||
* This is mainly to keep compilers from complaining in SDL code.
|
||||
* If there is no real 64-bit datatype, then compilers will complain about
|
||||
* the fake 64-bit datatype that SDL provides when it compiles user code.
|
||||
*/
|
||||
#define SDL_Swap64(X) (X)
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
|
||||
static __inline__ float
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -48,7 +47,7 @@ extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||
* \name Internal error functions
|
||||
*
|
||||
* \internal
|
||||
* Private error message function - used internally.
|
||||
* Private error reporting function - used internally.
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -105,9 +104,11 @@ typedef enum
|
||||
SDL_MULTIGESTURE,
|
||||
|
||||
/* Clipboard events */
|
||||
|
||||
SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
|
||||
|
||||
/* Drag and drop events */
|
||||
SDL_DROPFILE = 0x1000, /**< The system requests a file open */
|
||||
|
||||
/* Obsolete events */
|
||||
SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
|
||||
SDL_EVENT_COMPAT2,
|
||||
@@ -151,7 +152,7 @@ typedef struct SDL_KeyboardEvent
|
||||
Uint8 repeat; /**< Non-zero if this is a key repeat */
|
||||
Uint8 padding2;
|
||||
Uint8 padding3;
|
||||
SDL_keysym keysym; /**< The key that was pressed or released */
|
||||
SDL_Keysym keysym; /**< The key that was pressed or released */
|
||||
} SDL_KeyboardEvent;
|
||||
|
||||
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
|
||||
@@ -281,7 +282,7 @@ typedef struct SDL_JoyButtonEvent
|
||||
|
||||
|
||||
/**
|
||||
* \brief Touch finger motion/finger event structure (event.tmotion.*)
|
||||
* \brief Touch finger motion/finger event structure (event.tfinger.*)
|
||||
*/
|
||||
typedef struct SDL_TouchFingerEvent
|
||||
{
|
||||
@@ -303,7 +304,7 @@ typedef struct SDL_TouchFingerEvent
|
||||
|
||||
|
||||
/**
|
||||
* \brief Touch finger motion/finger event structure (event.tmotion.*)
|
||||
* \brief Touch finger motion/finger event structure (event.tbutton.*)
|
||||
*/
|
||||
typedef struct SDL_TouchButtonEvent
|
||||
{
|
||||
@@ -317,9 +318,8 @@ typedef struct SDL_TouchButtonEvent
|
||||
} SDL_TouchButtonEvent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Multiple Finger Gesture Event
|
||||
* \brief Multiple Finger Gesture Event (event.mgesture.*)
|
||||
*/
|
||||
typedef struct SDL_MultiGestureEvent
|
||||
{
|
||||
@@ -334,6 +334,7 @@ typedef struct SDL_MultiGestureEvent
|
||||
Uint16 padding;
|
||||
} SDL_MultiGestureEvent;
|
||||
|
||||
/* (event.dgesture.*) */
|
||||
typedef struct SDL_DollarGestureEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_DOLLARGESTURE */
|
||||
@@ -350,6 +351,16 @@ typedef struct SDL_DollarGestureEvent
|
||||
} SDL_DollarGestureEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief An event used to request a file open by the system (event.drop.*)
|
||||
* This event is disabled by default, you can enable it with SDL_EventState()
|
||||
* \note If you enable this event, you must free the filename in the event.
|
||||
*/
|
||||
typedef struct SDL_DropEvent
|
||||
{
|
||||
Uint32 type; /**< ::SDL_DROPFILE */
|
||||
char *file; /**< The file name, which should be freed with SDL_free() */
|
||||
} SDL_DropEvent;
|
||||
|
||||
|
||||
/**
|
||||
@@ -360,6 +371,7 @@ typedef struct SDL_QuitEvent
|
||||
Uint32 type; /**< ::SDL_QUIT */
|
||||
} SDL_QuitEvent;
|
||||
|
||||
|
||||
/**
|
||||
* \brief A user-defined event type (event.user.*)
|
||||
*/
|
||||
@@ -372,12 +384,14 @@ typedef struct SDL_UserEvent
|
||||
void *data2; /**< User defined data pointer */
|
||||
} SDL_UserEvent;
|
||||
|
||||
|
||||
struct SDL_SysWMmsg;
|
||||
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
|
||||
|
||||
/**
|
||||
* \brief A video driver dependent system event (event.syswm.*)
|
||||
*
|
||||
* This event is disabled by default, you can enable it with SDL_EventState()
|
||||
*
|
||||
* \note If you want to use this event, you should include SDL_syswm.h.
|
||||
*/
|
||||
typedef struct SDL_SysWMEvent
|
||||
@@ -438,6 +452,7 @@ typedef union SDL_Event
|
||||
SDL_TouchButtonEvent tbutton; /**< Touch button event data */
|
||||
SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */
|
||||
SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */
|
||||
SDL_DropEvent drop; /**< Drag and drop event data */
|
||||
|
||||
/** Temporarily here for backwards compatibility */
|
||||
/*@{*/
|
||||
@@ -580,6 +595,18 @@ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
|
||||
void **userdata);
|
||||
|
||||
/**
|
||||
* Add a function which is called when an event is added to the queue.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
|
||||
void *userdata);
|
||||
|
||||
/**
|
||||
* Remove an event watch function added with SDL_AddEventWatch()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
|
||||
void *userdata);
|
||||
|
||||
/**
|
||||
* Run the filter function on the current event queue, removing any
|
||||
* events for which the filter returns 0.
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 2008 Edgar Simo
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -25,7 +24,7 @@
|
||||
*
|
||||
* \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
|
||||
* devices.
|
||||
*
|
||||
*
|
||||
* The basic usage is as follows:
|
||||
* - Initialize the Subsystem (::SDL_INIT_HAPTIC).
|
||||
* - Open a Haptic Device.
|
||||
@@ -37,7 +36,29 @@
|
||||
* - (optional) Free the effect with SDL_HapticDestroyEffect().
|
||||
* - Close the haptic device with SDL_HapticClose().
|
||||
*
|
||||
* \par Example:
|
||||
* \par Simple rumble example:
|
||||
* \code
|
||||
* SDL_Haptic *haptic;
|
||||
*
|
||||
* // Open the device
|
||||
* haptic = SDL_HapticOpen( 0 );
|
||||
* if (haptic == NULL)
|
||||
* return -1;
|
||||
*
|
||||
* // Initialize simple rumble
|
||||
* if (SDL_HapticRumbleInit( haptic ) != 0)
|
||||
* return -1;
|
||||
*
|
||||
* // Play effect at 50% strength for 2 seconds
|
||||
* if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
|
||||
* return -1;
|
||||
* SDL_Delay( 2000 );
|
||||
*
|
||||
* // Clean up
|
||||
* SDL_HapticClose( haptic );
|
||||
* \endcode
|
||||
*
|
||||
* \par Complete example:
|
||||
* \code
|
||||
* int test_haptic( SDL_Joystick * joystick ) {
|
||||
* SDL_Haptic *haptic;
|
||||
@@ -81,6 +102,10 @@
|
||||
* return 0; // Success
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* You can also find out more information on my blog:
|
||||
* http://bobbens.dyndns.org/journal/2010/sdl_haptic/
|
||||
*
|
||||
* \author Edgar Simo Serra
|
||||
*/
|
||||
|
||||
@@ -929,7 +954,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
|
||||
*
|
||||
* \param haptic Haptic device to check on.
|
||||
* \param effect Effect to check to see if it is supported.
|
||||
* \return 1 if effect is supported, 0 if it isn't or -1 on error.
|
||||
* \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
|
||||
*
|
||||
* \sa SDL_HapticQuery
|
||||
* \sa SDL_HapticNewEffect
|
||||
@@ -1109,6 +1134,58 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Checks to see if rumble is supported on a haptic device..
|
||||
*
|
||||
* \param haptic Haptic device to check to see if it supports rumble.
|
||||
* \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
|
||||
*
|
||||
* \sa SDL_HapticRumbleInit
|
||||
* \sa SDL_HapticRumblePlay
|
||||
* \sa SDL_HapticRumbleStop
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Initializes the haptic device for simple rumble playback.
|
||||
*
|
||||
* \param haptic Haptic device to initialize for simple rumble playback.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
* \sa SDL_HapticOpen
|
||||
* \sa SDL_HapticRumbleSupported
|
||||
* \sa SDL_HapticRumblePlay
|
||||
* \sa SDL_HapticRumbleStop
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
|
||||
|
||||
/**
|
||||
* \brief Runs simple rumble on a haptic device
|
||||
*
|
||||
* \param haptic Haptic device to play rumble effect on.
|
||||
* \param strength Strength of the rumble to play as a 0-1 float value.
|
||||
* \param length Length of the rumble to play in miliseconds.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
* \sa SDL_HapticRumbleSupported
|
||||
* \sa SDL_HapticRumbleInit
|
||||
* \sa SDL_HapticRumbleStop
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
|
||||
|
||||
/**
|
||||
* \brief Stops the simple rumble on a haptic device.
|
||||
*
|
||||
* \param haptic Haptic to stop the rumble on.
|
||||
* \return 0 on success or -1 on error.
|
||||
*
|
||||
* \sa SDL_HapticRumbleSupported
|
||||
* \sa SDL_HapticRumbleInit
|
||||
* \sa SDL_HapticRumblePlay
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
|
||||
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
||||
206
project/jni/sdl-1.3/include/SDL_hints.h
Normal file
206
project/jni/sdl-1.3/include/SDL_hints.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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_hints.h
|
||||
*
|
||||
* Official documentation for SDL configuration variables
|
||||
*
|
||||
* This file contains functions to set and get configuration hints,
|
||||
* as well as listing each of them alphabetically.
|
||||
*
|
||||
* The convention for naming hints is SDL_HINT_X, where "SDL_X" is
|
||||
* the environment variable that can be used to override the default.
|
||||
*
|
||||
* In general these hints are just that - they may or may not be
|
||||
* supported or applicable on any given platform, but they provide
|
||||
* a way for an application or user to give the library a hint as
|
||||
* to how they would like the library to work.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_hints_h
|
||||
#define _SDL_hints_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface.
|
||||
*
|
||||
* SDL can try to accelerate the SDL 1.2 screen surface by using streaming
|
||||
* textures with a 3D rendering engine. This variable controls whether and
|
||||
* how this is done.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Disable 3D acceleration
|
||||
* "1" - Enable 3D acceleration, using the default renderer.
|
||||
* "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.)
|
||||
*
|
||||
* By default SDL tries to make a best guess for each platform whether
|
||||
* to use acceleration or not.
|
||||
*/
|
||||
#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
|
||||
|
||||
/**
|
||||
* \brief A variable specifying which render driver to use.
|
||||
*
|
||||
* If the application doesn't pick a specific renderer to use, this variable
|
||||
* specifies the name of the preferred renderer. If the preferred renderer
|
||||
* can't be initialized, the normal default renderer is used.
|
||||
*
|
||||
* This variable is case insensitive and can be set to the following values:
|
||||
* "direct3d"
|
||||
* "opengl"
|
||||
* "opengles2"
|
||||
* "opengles"
|
||||
* "software"
|
||||
*
|
||||
* The default varies by platform, but it's the first one in the list that
|
||||
* is available on the current platform.
|
||||
*/
|
||||
#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the OpenGL render driver uses shaders if they are available.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Disable shaders
|
||||
* "1" - Enable shaders
|
||||
*
|
||||
* By default shaders are used if OpenGL supports them.
|
||||
*/
|
||||
#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling the scaling quality
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" or "nearest" - Nearest pixel sampling
|
||||
* "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
|
||||
* "2" or "best" - Anisotropic filtering (supported by Direct3D)
|
||||
*
|
||||
* By default nearest pixel sampling is used
|
||||
*/
|
||||
#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Disable vsync
|
||||
* "1" - Enable vsync
|
||||
*
|
||||
* By default SDL does not sync screen surface updates with vertical refresh.
|
||||
*/
|
||||
#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the idle timer is disabled on iOS.
|
||||
*
|
||||
* When an iOS app does not receive touches for some time, the screen is
|
||||
* dimmed automatically. For games where the accelerometer is the only input
|
||||
* this is problematic. This functionality can be disabled by setting this
|
||||
* hint.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - Enable idle timer
|
||||
* "1" - Disable idle timer
|
||||
*/
|
||||
#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling which orientations are allowed on iOS.
|
||||
*
|
||||
* In some circumstances it is necessary to be able to explicitly control
|
||||
* which UI orientations are allowed.
|
||||
*
|
||||
* This variable is a space delimited list of the following values:
|
||||
* "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown"
|
||||
*/
|
||||
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
|
||||
|
||||
|
||||
/**
|
||||
* \brief An enumeration of hint priorities
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_HINT_DEFAULT,
|
||||
SDL_HINT_NORMAL,
|
||||
SDL_HINT_OVERRIDE
|
||||
} SDL_HintPriority;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set a hint with a specific priority
|
||||
*
|
||||
* The priority controls the behavior when setting a hint that already
|
||||
* has a value. Hints will replace existing hints of their priority and
|
||||
* lower. Environment variables are considered to have override priority.
|
||||
*
|
||||
* \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
|
||||
const char *value,
|
||||
SDL_HintPriority priority);
|
||||
|
||||
/**
|
||||
* \brief Set a hint with normal priority
|
||||
*
|
||||
* \return SDL_TRUE if the hint was set, SDL_FALSE otherwise
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
|
||||
const char *value);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get a hint
|
||||
*
|
||||
* \return The string value of a hint variable.
|
||||
*/
|
||||
extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
|
||||
|
||||
/**
|
||||
* \brief Clear all hints
|
||||
*
|
||||
* This function is called during SDL_Quit() to free stored hints.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_ClearHints(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_hints_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -31,7 +30,7 @@
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_keysym.h"
|
||||
#include "SDL_keycode.h"
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
@@ -45,13 +44,13 @@ extern "C" {
|
||||
/**
|
||||
* \brief The SDL keysym structure, used in key events.
|
||||
*/
|
||||
typedef struct SDL_keysym
|
||||
typedef struct SDL_Keysym
|
||||
{
|
||||
SDL_scancode scancode; /**< SDL physical key code - see ::SDL_scancode for details */
|
||||
SDLKey sym; /**< SDL virtual key code - see ::SDLKey for details */
|
||||
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
|
||||
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
|
||||
Uint16 mod; /**< current key modifiers */
|
||||
Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */
|
||||
} SDL_keysym;
|
||||
} SDL_Keysym;
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
@@ -65,7 +64,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
|
||||
*
|
||||
* \param numkeys if non-NULL, receives the length of the returned array.
|
||||
*
|
||||
* \return An array of key states. Indexes into this array are obtained by using ::SDL_scancode values.
|
||||
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
|
||||
*
|
||||
* \b Example:
|
||||
* \code
|
||||
@@ -80,47 +79,54 @@ extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
|
||||
/**
|
||||
* \brief Get the current key modifier state for the keyboard.
|
||||
*/
|
||||
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
|
||||
extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
|
||||
|
||||
/**
|
||||
* \brief Set the current key modifier state for the keyboard.
|
||||
*
|
||||
* \note This does not change the keyboard state, only the key modifier flags.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
|
||||
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
|
||||
|
||||
/**
|
||||
* \brief Get the key code corresponding to the given scancode according
|
||||
* to the current keyboard layout.
|
||||
*
|
||||
* See ::SDLKey for details.
|
||||
* See ::SDL_Keycode for details.
|
||||
*
|
||||
* \sa SDL_GetKeyName()
|
||||
*/
|
||||
extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_scancode scancode);
|
||||
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
|
||||
|
||||
/**
|
||||
* \brief Get the scancode corresponding to the given key code according to the
|
||||
* current keyboard layout.
|
||||
*
|
||||
* See ::SDL_scancode for details.
|
||||
* See ::SDL_Scancode for details.
|
||||
*
|
||||
* \sa SDL_GetScancodeName()
|
||||
*/
|
||||
extern DECLSPEC SDL_scancode SDLCALL SDL_GetScancodeFromKey(SDLKey key);
|
||||
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* \brief Get a human-readable name for a scancode.
|
||||
*
|
||||
* \return A pointer to a UTF-8 string that stays valid at least until the next
|
||||
* call to this function. If you need it around any longer, you must
|
||||
* copy it. If the scancode doesn't have a name, this function returns
|
||||
* \return A pointer to the name for the scancode.
|
||||
* If the scancode doesn't have a name, this function returns
|
||||
* an empty string ("").
|
||||
*
|
||||
* \sa SDL_scancode
|
||||
* \sa SDL_Scancode
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_scancode
|
||||
scancode);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
|
||||
|
||||
/**
|
||||
* \brief Get a scancode from a human-readable name
|
||||
*
|
||||
* \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
|
||||
*
|
||||
* \sa SDL_Scancode
|
||||
*/
|
||||
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
|
||||
|
||||
/**
|
||||
* \brief Get a human-readable name for a key.
|
||||
@@ -130,9 +136,18 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_scancode
|
||||
* copy it. If the key doesn't have a name, this function returns an
|
||||
* empty string ("").
|
||||
*
|
||||
* \sa SDLKey
|
||||
* \sa SDL_Key
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
|
||||
|
||||
/**
|
||||
* \brief Get a key code from a human-readable name
|
||||
*
|
||||
* \return key code, or SDLK_UNKNOWN if the name wasn't recognized
|
||||
*
|
||||
* \sa SDL_Keycode
|
||||
*/
|
||||
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
|
||||
|
||||
/**
|
||||
* \brief Start accepting Unicode text input events.
|
||||
|
||||
@@ -1,33 +1,32 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_keysym.h
|
||||
* \file SDL_keycode.h
|
||||
*
|
||||
* Defines constants which identify keyboard keys and modifiers.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_keysym_h
|
||||
#define _SDL_keysym_h
|
||||
#ifndef _SDL_keycode_h
|
||||
#define _SDL_keycode_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_scancode.h"
|
||||
@@ -40,7 +39,7 @@
|
||||
* the unmodified character that would be generated by pressing the key, or
|
||||
* an SDLK_* constant for those keys that do not generate characters.
|
||||
*/
|
||||
typedef Sint32 SDLKey;
|
||||
typedef Sint32 SDL_Keycode;
|
||||
|
||||
#define SDLK_SCANCODE_MASK (1<<30)
|
||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||
@@ -330,13 +329,13 @@ typedef enum
|
||||
KMOD_CAPS = 0x2000,
|
||||
KMOD_MODE = 0x4000,
|
||||
KMOD_RESERVED = 0x8000
|
||||
} SDLMod;
|
||||
} SDL_Keymod;
|
||||
|
||||
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
|
||||
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
|
||||
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
|
||||
#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
|
||||
|
||||
#endif /* _SDL_keysym_h */
|
||||
#endif /* _SDL_keycode_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
211
project/jni/sdl-1.3/include/SDL_log.h
Normal file
211
project/jni/sdl-1.3/include/SDL_log.h
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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_log.h
|
||||
*
|
||||
* Simple log messages with categories and priorities.
|
||||
*
|
||||
* By default logs are quiet, but if you're debugging SDL you might want:
|
||||
*
|
||||
* SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
|
||||
*
|
||||
* Here's where the messages go on different platforms:
|
||||
* Windows: debug output stream
|
||||
* Android: log output
|
||||
* Others: standard error output (stderr)
|
||||
*/
|
||||
|
||||
#ifndef _SDL_log_h
|
||||
#define _SDL_log_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \brief The maximum size of a log message
|
||||
*
|
||||
* Messages longer than the maximum size will be truncated
|
||||
*/
|
||||
#define SDL_MAX_LOG_MESSAGE 4096
|
||||
|
||||
/**
|
||||
* \brief The predefined log categories
|
||||
*
|
||||
* By default the application category is enabled at the INFO level,
|
||||
* and all other categories are enabled at the CRITICAL level.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
SDL_LOG_CATEGORY_ERROR,
|
||||
SDL_LOG_CATEGORY_SYSTEM,
|
||||
SDL_LOG_CATEGORY_AUDIO,
|
||||
SDL_LOG_CATEGORY_VIDEO,
|
||||
SDL_LOG_CATEGORY_RENDER,
|
||||
SDL_LOG_CATEGORY_INPUT,
|
||||
|
||||
/* Reserved for future SDL library use */
|
||||
SDL_LOG_CATEGORY_RESERVED1,
|
||||
SDL_LOG_CATEGORY_RESERVED2,
|
||||
SDL_LOG_CATEGORY_RESERVED3,
|
||||
SDL_LOG_CATEGORY_RESERVED4,
|
||||
SDL_LOG_CATEGORY_RESERVED5,
|
||||
SDL_LOG_CATEGORY_RESERVED6,
|
||||
SDL_LOG_CATEGORY_RESERVED7,
|
||||
SDL_LOG_CATEGORY_RESERVED8,
|
||||
SDL_LOG_CATEGORY_RESERVED9,
|
||||
SDL_LOG_CATEGORY_RESERVED10,
|
||||
|
||||
/* Beyond this point is reserved for application use, e.g.
|
||||
enum {
|
||||
MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
|
||||
MYAPP_CATEGORY_AWESOME2,
|
||||
MYAPP_CATEGORY_AWESOME3,
|
||||
...
|
||||
};
|
||||
*/
|
||||
SDL_LOG_CATEGORY_CUSTOM
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The predefined log priorities
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_LOG_PRIORITY_VERBOSE = 1,
|
||||
SDL_LOG_PRIORITY_DEBUG,
|
||||
SDL_LOG_PRIORITY_INFO,
|
||||
SDL_LOG_PRIORITY_WARN,
|
||||
SDL_LOG_PRIORITY_ERROR,
|
||||
SDL_LOG_PRIORITY_CRITICAL,
|
||||
SDL_NUM_LOG_PRIORITIES
|
||||
} SDL_LogPriority;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set the priority of all log categories
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
|
||||
|
||||
/**
|
||||
* \brief Set the priority of a particular log category
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
|
||||
SDL_LogPriority priority);
|
||||
|
||||
/**
|
||||
* \brief Get the priority of a particular log category
|
||||
*/
|
||||
extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
|
||||
|
||||
/**
|
||||
* \brief Reset all priorities to default.
|
||||
*
|
||||
* \note This is called in SDL_Quit().
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_PRIORITY_DEBUG
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_PRIORITY_INFO
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_PRIORITY_WARN
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_PRIORITY_ERROR
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with the specified category and priority.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
|
||||
SDL_LogPriority priority,
|
||||
const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* \brief Log a message with the specified category and priority.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
|
||||
SDL_LogPriority priority,
|
||||
const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* \brief The prototype for the log output function
|
||||
*/
|
||||
typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
|
||||
|
||||
/**
|
||||
* \brief Get the current log output function.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
|
||||
|
||||
/**
|
||||
* \brief This function allows you to replace the default log output
|
||||
* function with one of your own.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_log_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_main_h
|
||||
@@ -31,10 +30,11 @@
|
||||
* Redefine main() on some platforms so that it is called by SDL.
|
||||
*/
|
||||
|
||||
#if defined(__WIN32__) || \
|
||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||
defined(__SYMBIAN32__) || defined(__IPHONEOS__) || \
|
||||
defined(ANDROID)
|
||||
#if defined(__WIN32__) || defined(__IPHONEOS__) || defined(__ANDROID__)
|
||||
#ifndef SDL_MAIN_HANDLED
|
||||
#define SDL_MAIN_NEEDED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
@@ -57,7 +57,9 @@
|
||||
* \endcode
|
||||
*/
|
||||
|
||||
#ifdef SDL_MAIN_NEEDED
|
||||
#define main SDL_main
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The prototype for the application's main() function
|
||||
@@ -65,9 +67,6 @@
|
||||
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
/* From the SDL library code -- needed for registering the app on Win32 */
|
||||
#ifdef __WIN32__
|
||||
|
||||
#include "begin_code.h"
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
@@ -75,6 +74,8 @@ extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
/**
|
||||
* This can be called to set the application class at startup
|
||||
*/
|
||||
@@ -82,15 +83,15 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style,
|
||||
void *hInst);
|
||||
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
|
||||
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
#endif
|
||||
|
||||
#endif /* Need to redefine main()? */
|
||||
|
||||
#endif /* _SDL_main_h */
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -146,6 +145,15 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
|
||||
int w, int h, int hot_x,
|
||||
int hot_y);
|
||||
|
||||
/**
|
||||
* \brief Create a color cursor.
|
||||
*
|
||||
* \sa SDL_FreeCursor()
|
||||
*/
|
||||
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
|
||||
int hot_x,
|
||||
int hot_y);
|
||||
|
||||
/**
|
||||
* \brief Set the active cursor.
|
||||
*/
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_mutex_h
|
||||
@@ -164,6 +163,31 @@ typedef struct SDL_cond SDL_cond;
|
||||
|
||||
/**
|
||||
* Create a condition variable.
|
||||
*
|
||||
* Typical use of condition variables:
|
||||
*
|
||||
* Thread A:
|
||||
* SDL_LockMutex(lock);
|
||||
* while ( ! condition ) {
|
||||
* SDL_CondWait(cond, lock);
|
||||
* }
|
||||
* SDL_UnlockMutex(lock);
|
||||
*
|
||||
* Thread B:
|
||||
* SDL_LockMutex(lock);
|
||||
* ...
|
||||
* condition = true;
|
||||
* ...
|
||||
* SDL_CondSignal(cond);
|
||||
* SDL_UnlockMutex(lock);
|
||||
*
|
||||
* There is some discussion whether to signal the condition variable
|
||||
* with the mutex locked or not. There is some potential performance
|
||||
* benefit to unlocking first on some platforms, but there are some
|
||||
* potential race conditions depending on how your code is structured.
|
||||
*
|
||||
* In general it's safer to signal the condition variable while the
|
||||
* mutex is locked.
|
||||
*/
|
||||
extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
|
||||
|
||||
@@ -181,6 +205,7 @@ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
|
||||
|
||||
/**
|
||||
* Restart all threads that are waiting on the condition variable.
|
||||
*
|
||||
* \return 0 or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -31,6 +30,8 @@
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifndef __IPHONEOS__
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef NOMINMAX
|
||||
@@ -38,6 +39,11 @@
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU__ /* !!! FIXME: temp compiler warning fix... */
|
||||
#define NO_SDL_GLEXT 1
|
||||
#endif
|
||||
|
||||
#ifdef __glext_h_
|
||||
/* Someone has already included glext.h */
|
||||
#define NO_SDL_GLEXT
|
||||
@@ -47,11 +53,9 @@
|
||||
#endif
|
||||
#if defined(__MACOSX__)
|
||||
#include <OpenGL/gl.h> /* Header File For The OpenGL Library */
|
||||
#include <OpenGL/glu.h> /* Header File For The GLU Library */
|
||||
#define __X_GL_H
|
||||
#else
|
||||
#include <GL/gl.h> /* Header File For The OpenGL Library */
|
||||
#include <GL/glu.h> /* Header File For The GLU Library */
|
||||
#endif
|
||||
#ifndef NO_SDL_GLEXT
|
||||
#undef __glext_h_
|
||||
@@ -5108,21 +5112,35 @@ typedef char GLchar;
|
||||
|
||||
#ifndef GL_VERSION_1_5
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
#if defined(__APPLE__)
|
||||
typedef long GLintptr;
|
||||
typedef long GLsizeiptr;
|
||||
#else
|
||||
typedef ptrdiff_t GLintptr;
|
||||
typedef ptrdiff_t GLsizeiptr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
/* GL types for handling large vertex buffer objects */
|
||||
#if defined(__APPLE__)
|
||||
typedef long GLintptrARB;
|
||||
typedef long GLsizeiptrARB;
|
||||
#else
|
||||
typedef ptrdiff_t GLintptrARB;
|
||||
typedef ptrdiff_t GLsizeiptrARB;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_shader_objects
|
||||
/* GL types for program/shader text and shader object handles */
|
||||
typedef char GLcharARB;
|
||||
#if defined(__APPLE__)
|
||||
typedef void *GLhandleARB;
|
||||
#else
|
||||
typedef unsigned int GLhandleARB;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* GL type for "half" precision (s10e5) float data in host memory */
|
||||
#ifndef GL_ARB_half_float_pixel
|
||||
@@ -11107,6 +11125,8 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
|
||||
/* *INDENT-ON* */
|
||||
#endif /* NO_SDL_GLEXT */
|
||||
|
||||
#endif /* !__IPHONEOS__ */
|
||||
|
||||
#endif /* _SDL_opengl_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
38
project/jni/sdl-1.3/include/SDL_opengles2.h
Normal file
38
project/jni/sdl-1.3/include/SDL_opengles2.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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_opengles.h
|
||||
*
|
||||
* This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
|
||||
*/
|
||||
|
||||
#ifdef __IPHONEOS__
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -122,18 +121,24 @@ enum
|
||||
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
|
||||
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
|
||||
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
|
||||
#define SDL_BYTESPERPIXEL(X) (((X) >> 0) & 0xFF)
|
||||
#define SDL_BYTESPERPIXEL(X) \
|
||||
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
|
||||
((((X) == SDL_PIXELFORMAT_YUY2) || \
|
||||
((X) == SDL_PIXELFORMAT_UYVY) || \
|
||||
((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
|
||||
|
||||
#define SDL_ISPIXELFORMAT_INDEXED(format) \
|
||||
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
|
||||
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
|
||||
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))
|
||||
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
|
||||
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
|
||||
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
|
||||
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
|
||||
|
||||
#define SDL_ISPIXELFORMAT_ALPHA(format) \
|
||||
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
|
||||
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
|
||||
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
|
||||
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))
|
||||
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
|
||||
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
|
||||
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
|
||||
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
|
||||
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
|
||||
|
||||
#define SDL_ISPIXELFORMAT_FOURCC(format) \
|
||||
((format) && !((format) & 0x80000000))
|
||||
@@ -143,16 +148,16 @@ enum
|
||||
{
|
||||
SDL_PIXELFORMAT_UNKNOWN,
|
||||
SDL_PIXELFORMAT_INDEX1LSB =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
|
||||
1, 0),
|
||||
SDL_PIXELFORMAT_INDEX1MSB =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0,
|
||||
1, 0),
|
||||
SDL_PIXELFORMAT_INDEX1MSB =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
|
||||
1, 0),
|
||||
SDL_PIXELFORMAT_INDEX4LSB =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
|
||||
4, 0),
|
||||
SDL_PIXELFORMAT_INDEX4MSB =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0,
|
||||
4, 0),
|
||||
SDL_PIXELFORMAT_INDEX8 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
|
||||
@@ -207,9 +212,15 @@ enum
|
||||
SDL_PIXELFORMAT_RGB888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_RGBX8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_BGR888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_BGRX8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX,
|
||||
SDL_PACKEDLAYOUT_8888, 24, 4),
|
||||
SDL_PIXELFORMAT_ARGB8888 =
|
||||
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB,
|
||||
SDL_PACKEDLAYOUT_8888, 32, 4),
|
||||
@@ -247,27 +258,28 @@ typedef struct SDL_Color
|
||||
} SDL_Color;
|
||||
#define SDL_Colour SDL_Color
|
||||
|
||||
typedef struct SDL_Palette SDL_Palette;
|
||||
typedef int (*SDL_PaletteChangedFunc) (void *userdata, SDL_Palette * palette);
|
||||
typedef struct SDL_PaletteWatch SDL_PaletteWatch;
|
||||
|
||||
struct SDL_Palette
|
||||
typedef struct SDL_Palette
|
||||
{
|
||||
int ncolors;
|
||||
SDL_Color *colors;
|
||||
|
||||
Uint32 version;
|
||||
int refcount;
|
||||
SDL_PaletteWatch *watch;
|
||||
};
|
||||
} SDL_Palette;
|
||||
|
||||
/**
|
||||
* \note Everything in the pixel format structure is read-only.
|
||||
*/
|
||||
typedef struct SDL_PixelFormat
|
||||
{
|
||||
Uint32 format;
|
||||
SDL_Palette *palette;
|
||||
Uint8 BitsPerPixel;
|
||||
Uint8 BytesPerPixel;
|
||||
Uint8 padding[2];
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
Uint8 Rloss;
|
||||
Uint8 Gloss;
|
||||
Uint8 Bloss;
|
||||
@@ -276,10 +288,8 @@ typedef struct SDL_PixelFormat
|
||||
Uint8 Gshift;
|
||||
Uint8 Bshift;
|
||||
Uint8 Ashift;
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
Uint32 Bmask;
|
||||
Uint32 Amask;
|
||||
int refcount;
|
||||
struct SDL_PixelFormat *next;
|
||||
} SDL_PixelFormat;
|
||||
|
||||
/**
|
||||
@@ -315,6 +325,16 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
||||
Uint32 Bmask,
|
||||
Uint32 Amask);
|
||||
|
||||
/**
|
||||
* \brief Create an SDL_PixelFormat structure from a pixel format enum.
|
||||
*/
|
||||
extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
|
||||
|
||||
/**
|
||||
* \brief Free an SDL_PixelFormat structure.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
|
||||
|
||||
/**
|
||||
* \brief Create a palette structure with the specified number of color
|
||||
* entries.
|
||||
@@ -328,23 +348,10 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
|
||||
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
|
||||
|
||||
/**
|
||||
* \brief Add a callback function which is called when the palette changes.
|
||||
*
|
||||
* \sa SDL_DelPaletteWatch()
|
||||
* \brief Set the palette for a pixel format structure.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_AddPaletteWatch(SDL_Palette * palette,
|
||||
SDL_PaletteChangedFunc
|
||||
callback, void *userdata);
|
||||
|
||||
/**
|
||||
* \brief Remove a callback function previously added with
|
||||
* SDL_AddPaletteWatch().
|
||||
*
|
||||
* \sa SDL_AddPaletteWatch()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DelPaletteWatch(SDL_Palette * palette,
|
||||
SDL_PaletteChangedFunc
|
||||
callback, void *userdata);
|
||||
extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
|
||||
SDL_Palette *palette);
|
||||
|
||||
/**
|
||||
* \brief Set a range of colors in a palette.
|
||||
@@ -403,6 +410,12 @@ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
|
||||
Uint8 * r, Uint8 * g, Uint8 * b,
|
||||
Uint8 * a);
|
||||
|
||||
/**
|
||||
* \brief Calculate a 256 entry gamma ramp for a gamma value.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -65,28 +64,16 @@
|
||||
#undef __LINUX__
|
||||
#define __LINUX__ 1
|
||||
#endif
|
||||
/* Hack, do not enable this */
|
||||
/*
|
||||
#if defined(ANDROID)
|
||||
#undef __ANDROID__
|
||||
#undef __LINUX__
|
||||
#undef __LINUX__ /*do we need to do this?*/
|
||||
#define __ANDROID__ 1
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* lets us know what version of Mac OS X we're compiling on */
|
||||
#include "AvailabilityMacros.h"
|
||||
#include "TargetConditionals.h"
|
||||
#ifndef MAC_OS_X_VERSION_10_4
|
||||
#define MAC_OS_X_VERSION_10_4 1040
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_5
|
||||
#define MAC_OS_X_VERSION_10_5 1050
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
#if TARGET_OS_IPHONE
|
||||
/* if compiling for iPhone */
|
||||
#undef __IPHONEOS__
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_power_h
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -54,6 +53,6 @@
|
||||
/* There are no functions directly affecting the quit event */
|
||||
|
||||
#define SDL_QuitRequested() \
|
||||
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
|
||||
(SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0))
|
||||
|
||||
#endif /* _SDL_quit_h */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -72,12 +71,13 @@ typedef struct SDL_Rect
|
||||
/**
|
||||
* \brief Returns true if the rectangle has no area.
|
||||
*/
|
||||
#define SDL_RectEmpty(X) (((X)->w <= 0) || ((X)->h <= 0))
|
||||
#define SDL_RectEmpty(X) ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0))
|
||||
|
||||
/**
|
||||
* \brief Returns true if the two rectangles are equal.
|
||||
*/
|
||||
#define SDL_RectEquals(A, B) (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
|
||||
#define SDL_RectEquals(A, B) (((A)) && ((B)) && \
|
||||
((A)->x == (B)->x) && ((A)->y == (B)->y) && \
|
||||
((A)->w == (B)->w) && ((A)->h == (B)->h))
|
||||
|
||||
/**
|
||||
|
||||
615
project/jni/sdl-1.3/include/SDL_render.h
Normal file
615
project/jni/sdl-1.3/include/SDL_render.h
Normal file
@@ -0,0 +1,615 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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_render.h
|
||||
*
|
||||
* Header file for SDL 2D rendering functions.
|
||||
*
|
||||
* This API supports the following features:
|
||||
* * single pixel points
|
||||
* * single pixel lines
|
||||
* * filled rectangles
|
||||
* * texture images
|
||||
*
|
||||
* The primitives may be drawn in opaque, blended, or additive modes.
|
||||
*
|
||||
* The texture images may be drawn in opaque, blended, or additive modes.
|
||||
* They can have an additional color tint or alpha modulation applied to
|
||||
* them, and may also be stretched with linear interpolation.
|
||||
*
|
||||
* This API is designed to accelerate simple 2D operations. You may
|
||||
* want more functionality such as rotation and particle effects and
|
||||
* in that case you should use SDL's OpenGL/Direct3D support or one
|
||||
* of the many good 3D engines.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_render_h
|
||||
#define _SDL_render_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_rect.h"
|
||||
#include "SDL_video.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
extern "C" {
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Flags used when creating a rendering context
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
|
||||
SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
|
||||
acceleration */
|
||||
SDL_RENDERER_PRESENTVSYNC = 0x00000004 /**< Present is synchronized
|
||||
with the refresh rate */
|
||||
} SDL_RendererFlags;
|
||||
|
||||
/**
|
||||
* \brief Information on the capabilities of a render driver or context.
|
||||
*/
|
||||
typedef struct SDL_RendererInfo
|
||||
{
|
||||
const char *name; /**< The name of the renderer */
|
||||
Uint32 flags; /**< Supported ::SDL_RendererFlags */
|
||||
Uint32 num_texture_formats; /**< The number of available texture formats */
|
||||
Uint32 texture_formats[16]; /**< The available texture formats */
|
||||
int max_texture_width; /**< The maximimum texture width */
|
||||
int max_texture_height; /**< The maximimum texture height */
|
||||
} SDL_RendererInfo;
|
||||
|
||||
/**
|
||||
* \brief The access pattern allowed for a texture.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
|
||||
SDL_TEXTUREACCESS_STREAMING /**< Changes frequently, lockable */
|
||||
} SDL_TextureAccess;
|
||||
|
||||
/**
|
||||
* \brief The texture channel modulation used in SDL_RenderCopy().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
|
||||
SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
|
||||
SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
|
||||
} SDL_TextureModulate;
|
||||
|
||||
/**
|
||||
* \brief A structure representing rendering state
|
||||
*/
|
||||
struct SDL_Renderer;
|
||||
typedef struct SDL_Renderer SDL_Renderer;
|
||||
|
||||
/**
|
||||
* \brief An efficient driver-specific representation of pixel data
|
||||
*/
|
||||
struct SDL_Texture;
|
||||
typedef struct SDL_Texture SDL_Texture;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* \brief Get the number of 2D rendering drivers available for the current
|
||||
* display.
|
||||
*
|
||||
* A render driver is a set of code that handles rendering and texture
|
||||
* management on a particular display. Normally there is only one, but
|
||||
* some drivers may have several available with different capabilities.
|
||||
*
|
||||
* \sa SDL_GetRenderDriverInfo()
|
||||
* \sa SDL_CreateRenderer()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
|
||||
|
||||
/**
|
||||
* \brief Get information about a specific 2D rendering driver for the current
|
||||
* display.
|
||||
*
|
||||
* \param index The index of the driver to query information about.
|
||||
* \param info A pointer to an SDL_RendererInfo struct to be filled with
|
||||
* information on the rendering driver.
|
||||
*
|
||||
* \return 0 on success, -1 if the index was out of range.
|
||||
*
|
||||
* \sa SDL_CreateRenderer()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
|
||||
SDL_RendererInfo * info);
|
||||
|
||||
/**
|
||||
* \brief Create a 2D rendering context for a window.
|
||||
*
|
||||
* \param window The window where rendering is displayed.
|
||||
* \param index The index of the rendering driver to initialize, or -1 to
|
||||
* initialize the first one supporting the requested flags.
|
||||
* \param flags ::SDL_RendererFlags.
|
||||
*
|
||||
* \return A valid rendering context or NULL if there was an error.
|
||||
*
|
||||
* \sa SDL_CreateSoftwareRenderer()
|
||||
* \sa SDL_GetRendererInfo()
|
||||
* \sa SDL_DestroyRenderer()
|
||||
*/
|
||||
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
|
||||
int index, Uint32 flags);
|
||||
|
||||
/**
|
||||
* \brief Create a 2D software rendering context for a surface.
|
||||
*
|
||||
* \param surface The surface where rendering is done.
|
||||
*
|
||||
* \return A valid rendering context or NULL if there was an error.
|
||||
*
|
||||
* \sa SDL_CreateRenderer()
|
||||
* \sa SDL_DestroyRenderer()
|
||||
*/
|
||||
extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface);
|
||||
|
||||
/**
|
||||
* \brief Get the renderer associated with a window.
|
||||
*/
|
||||
extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* \brief Get information about a rendering context.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
|
||||
SDL_RendererInfo * info);
|
||||
|
||||
/**
|
||||
* \brief Create a texture for a rendering context.
|
||||
*
|
||||
* \param format The format of the texture.
|
||||
* \param access One of the enumerated values in ::SDL_TextureAccess.
|
||||
* \param w The width of the texture in pixels.
|
||||
* \param h The height of the texture in pixels.
|
||||
*
|
||||
* \return The created texture is returned, or 0 if no rendering context was
|
||||
* active, the format was unsupported, or the width or height were out
|
||||
* of range.
|
||||
*
|
||||
* \sa SDL_QueryTexture()
|
||||
* \sa SDL_UpdateTexture()
|
||||
* \sa SDL_DestroyTexture()
|
||||
*/
|
||||
extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
|
||||
Uint32 format,
|
||||
int access, int w,
|
||||
int h);
|
||||
|
||||
/**
|
||||
* \brief Create a texture from an existing surface.
|
||||
*
|
||||
* \param surface The surface containing pixel data used to fill the texture.
|
||||
*
|
||||
* \return The created texture is returned, or 0 on error.
|
||||
*
|
||||
* \note The surface is not modified or freed by this function.
|
||||
*
|
||||
* \sa SDL_QueryTexture()
|
||||
* \sa SDL_DestroyTexture()
|
||||
*/
|
||||
extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface);
|
||||
|
||||
/**
|
||||
* \brief Query the attributes of a texture
|
||||
*
|
||||
* \param texture A texture to be queried.
|
||||
* \param format A pointer filled in with the raw format of the texture. The
|
||||
* actual format may differ, but pixel transfers will use this
|
||||
* format.
|
||||
* \param access A pointer filled in with the actual access to the texture.
|
||||
* \param w A pointer filled in with the width of the texture in pixels.
|
||||
* \param h A pointer filled in with the height of the texture in pixels.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
|
||||
Uint32 * format, int *access,
|
||||
int *w, int *h);
|
||||
|
||||
/**
|
||||
* \brief Set an additional color value used in render copy operations.
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param r The red color value multiplied into copy operations.
|
||||
* \param g The green color value multiplied into copy operations.
|
||||
* \param b The blue color value multiplied into copy operations.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or color modulation
|
||||
* is not supported.
|
||||
*
|
||||
* \sa SDL_GetTextureColorMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture,
|
||||
Uint8 r, Uint8 g, Uint8 b);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get the additional color value used in render copy operations.
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param r A pointer filled in with the current red color value.
|
||||
* \param g A pointer filled in with the current green color value.
|
||||
* \param b A pointer filled in with the current blue color value.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \sa SDL_SetTextureColorMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture,
|
||||
Uint8 * r, Uint8 * g,
|
||||
Uint8 * b);
|
||||
|
||||
/**
|
||||
* \brief Set an additional alpha value used in render copy operations.
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param alpha The alpha value multiplied into copy operations.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or alpha modulation
|
||||
* is not supported.
|
||||
*
|
||||
* \sa SDL_GetTextureAlphaMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture,
|
||||
Uint8 alpha);
|
||||
|
||||
/**
|
||||
* \brief Get the additional alpha value used in render copy operations.
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param alpha A pointer filled in with the current alpha value.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \sa SDL_SetTextureAlphaMod()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture,
|
||||
Uint8 * alpha);
|
||||
|
||||
/**
|
||||
* \brief Set the blend mode used for texture copy operations.
|
||||
*
|
||||
* \param texture The texture to update.
|
||||
* \param blendMode ::SDL_BlendMode to use for texture blending.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or the blend mode is
|
||||
* not supported.
|
||||
*
|
||||
* \note If the blend mode is not supported, the closest supported mode is
|
||||
* chosen.
|
||||
*
|
||||
* \sa SDL_GetTextureBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
|
||||
SDL_BlendMode blendMode);
|
||||
|
||||
/**
|
||||
* \brief Get the blend mode used for texture copy operations.
|
||||
*
|
||||
* \param texture The texture to query.
|
||||
* \param blendMode A pointer filled in with the current blend mode.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \sa SDL_SetTextureBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Update the given texture rectangle with new pixel data.
|
||||
*
|
||||
* \param texture The texture to update
|
||||
* \param rect A pointer to the rectangle of pixels to update, or NULL to
|
||||
* update the entire texture.
|
||||
* \param pixels The raw pixel data.
|
||||
* \param pitch The number of bytes between rows of pixel data.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid.
|
||||
*
|
||||
* \note This is a fairly slow function.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
|
||||
const SDL_Rect * rect,
|
||||
const void *pixels, int pitch);
|
||||
|
||||
/**
|
||||
* \brief Lock a portion of the texture for pixel access.
|
||||
*
|
||||
* \param texture The texture to lock for access, which was created with
|
||||
* ::SDL_TEXTUREACCESS_STREAMING.
|
||||
* \param rect A pointer to the rectangle to lock for access. If the rect
|
||||
* is NULL, the entire texture will be locked.
|
||||
* \param pixels This is filled in with a pointer to the locked pixels,
|
||||
* appropriately offset by the locked area.
|
||||
* \param pitch This is filled in with the pitch of the locked pixels.
|
||||
*
|
||||
* \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
|
||||
*
|
||||
* \sa SDL_UnlockTexture()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
|
||||
const SDL_Rect * rect,
|
||||
void **pixels, int *pitch);
|
||||
|
||||
/**
|
||||
* \brief Unlock a texture, uploading the changes to video memory, if needed.
|
||||
*
|
||||
* \sa SDL_LockTexture()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
|
||||
|
||||
/**
|
||||
* \brief Set the drawing area for rendering on the current target.
|
||||
*
|
||||
* \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
|
||||
*
|
||||
* The x,y of the viewport rect represents the origin for rendering.
|
||||
*
|
||||
* \note When the window is resized, the current viewport is automatically
|
||||
* centered within the new window size.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
|
||||
const SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* \brief Get the drawing area for the current target.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
|
||||
SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* \brief Set the color used for drawing operations (Rect, Line and Clear).
|
||||
*
|
||||
* \param r The red value used to draw on the rendering target.
|
||||
* \param g The green value used to draw on the rendering target.
|
||||
* \param b The blue value used to draw on the rendering target.
|
||||
* \param a The alpha value used to draw on the rendering target, usually
|
||||
* ::SDL_ALPHA_OPAQUE (255).
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
|
||||
Uint8 r, Uint8 g, Uint8 b,
|
||||
Uint8 a);
|
||||
|
||||
/**
|
||||
* \brief Get the color used for drawing operations (Rect, Line and Clear).
|
||||
*
|
||||
* \param r A pointer to the red value used to draw on the rendering target.
|
||||
* \param g A pointer to the green value used to draw on the rendering target.
|
||||
* \param b A pointer to the blue value used to draw on the rendering target.
|
||||
* \param a A pointer to the alpha value used to draw on the rendering target,
|
||||
* usually ::SDL_ALPHA_OPAQUE (255).
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
|
||||
Uint8 * r, Uint8 * g, Uint8 * b,
|
||||
Uint8 * a);
|
||||
|
||||
/**
|
||||
* \brief Set the blend mode used for drawing operations (Fill and Line).
|
||||
*
|
||||
* \param blendMode ::SDL_BlendMode to use for blending.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*
|
||||
* \note If the blend mode is not supported, the closest supported mode is
|
||||
* chosen.
|
||||
*
|
||||
* \sa SDL_GetRenderDrawBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
|
||||
SDL_BlendMode blendMode);
|
||||
|
||||
/**
|
||||
* \brief Get the blend mode used for drawing operations.
|
||||
*
|
||||
* \param blendMode A pointer filled in with the current blend mode.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*
|
||||
* \sa SDL_SetRenderDrawBlendMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Clear the current rendering target with the drawing color
|
||||
*
|
||||
* This function clears the entire rendering target, ignoring the viewport.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
|
||||
|
||||
/**
|
||||
* \brief Draw a point on the current rendering target.
|
||||
*
|
||||
* \param x The x coordinate of the point.
|
||||
* \param y The y coordinate of the point.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
|
||||
int x, int y);
|
||||
|
||||
/**
|
||||
* \brief Draw multiple points on the current rendering target.
|
||||
*
|
||||
* \param points The points to draw
|
||||
* \param count The number of points to draw
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
|
||||
const SDL_Point * points,
|
||||
int count);
|
||||
|
||||
/**
|
||||
* \brief Draw a line on the current rendering target.
|
||||
*
|
||||
* \param x1 The x coordinate of the start point.
|
||||
* \param y1 The y coordinate of the start point.
|
||||
* \param x2 The x coordinate of the end point.
|
||||
* \param y2 The y coordinate of the end point.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
|
||||
int x1, int y1, int x2, int y2);
|
||||
|
||||
/**
|
||||
* \brief Draw a series of connected lines on the current rendering target.
|
||||
*
|
||||
* \param points The points along the lines
|
||||
* \param count The number of points, drawing count-1 lines
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
|
||||
const SDL_Point * points,
|
||||
int count);
|
||||
|
||||
/**
|
||||
* \brief Draw a rectangle on the current rendering target.
|
||||
*
|
||||
* \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
|
||||
const SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* \brief Draw some number of rectangles on the current rendering target.
|
||||
*
|
||||
* \param rects A pointer to an array of destination rectangles.
|
||||
* \param count The number of rectangles.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
|
||||
const SDL_Rect * rects,
|
||||
int count);
|
||||
|
||||
/**
|
||||
* \brief Fill a rectangle on the current rendering target with the drawing color.
|
||||
*
|
||||
* \param rect A pointer to the destination rectangle, or NULL for the entire
|
||||
* rendering target.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
|
||||
const SDL_Rect * rect);
|
||||
|
||||
/**
|
||||
* \brief Fill some number of rectangles on the current rendering target with the drawing color.
|
||||
*
|
||||
* \param rects A pointer to an array of destination rectangles.
|
||||
* \param count The number of rectangles.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
|
||||
const SDL_Rect * rects,
|
||||
int count);
|
||||
|
||||
/**
|
||||
* \brief Copy a portion of the texture to the current rendering target.
|
||||
*
|
||||
* \param texture The source texture.
|
||||
* \param srcrect A pointer to the source rectangle, or NULL for the entire
|
||||
* texture.
|
||||
* \param dstrect A pointer to the destination rectangle, or NULL for the
|
||||
* entire rendering target.
|
||||
*
|
||||
* \return 0 on success, or -1 on error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
|
||||
SDL_Texture * texture,
|
||||
const SDL_Rect * srcrect,
|
||||
const SDL_Rect * dstrect);
|
||||
|
||||
/**
|
||||
* \brief Read pixels from the current rendering target.
|
||||
*
|
||||
* \param rect A pointer to the rectangle to read, or NULL for the entire
|
||||
* render target.
|
||||
* \param format The desired format of the pixel data, or 0 to use the format
|
||||
* of the rendering target
|
||||
* \param pixels A pointer to be filled in with the pixel data
|
||||
* \param pitch The pitch of the pixels parameter.
|
||||
*
|
||||
* \return 0 on success, or -1 if pixel reading is not supported.
|
||||
*
|
||||
* \warning This is a very slow operation, and should not be used frequently.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
|
||||
const SDL_Rect * rect,
|
||||
Uint32 format,
|
||||
void *pixels, int pitch);
|
||||
|
||||
/**
|
||||
* \brief Update the screen with rendering performed.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
|
||||
|
||||
/**
|
||||
* \brief Destroy the specified texture.
|
||||
*
|
||||
* \sa SDL_CreateTexture()
|
||||
* \sa SDL_CreateTextureFromSurface()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture);
|
||||
|
||||
/**
|
||||
* \brief Destroy the rendering context for a window and free associated
|
||||
* textures.
|
||||
*
|
||||
* \sa SDL_CreateRenderer()
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_render_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -1 +1,2 @@
|
||||
#define SDL_REVISION "hg-5001:77df56570442"
|
||||
#define SDL_REVISION "hg-5868:33245988e8a2"
|
||||
#define SDL_REVISION_NUMBER 5868
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -83,7 +82,20 @@ typedef struct SDL_RWops
|
||||
Uint32 type;
|
||||
union
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
#if defined(ANDROID)
|
||||
struct
|
||||
{
|
||||
void *fileName;
|
||||
void *fileNameRef;
|
||||
void *inputStream;
|
||||
void *inputStreamRef;
|
||||
void *readableByteChannel;
|
||||
void *readableByteChannelRef;
|
||||
void *readMethod;
|
||||
long position;
|
||||
int size;
|
||||
} androidio;
|
||||
#elif defined(__WIN32__)
|
||||
struct
|
||||
{
|
||||
SDL_bool append;
|
||||
@@ -94,8 +106,9 @@ typedef struct SDL_RWops
|
||||
size_t size;
|
||||
size_t left;
|
||||
} buffer;
|
||||
} win32io;
|
||||
} windowsio;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
struct
|
||||
{
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,7 @@
|
||||
* \brief The SDL keyboard scancode representation.
|
||||
*
|
||||
* Values of this type are used to represent keyboard keys, among other places
|
||||
* in the \link SDL_keysym::scancode key.keysym.scancode \endlink field of the
|
||||
* in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
|
||||
* SDL_Event structure.
|
||||
*
|
||||
* The values in this enumeration are based on the USB usage page standard:
|
||||
@@ -392,7 +391,7 @@ typedef enum
|
||||
|
||||
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
|
||||
for array bounds */
|
||||
} SDL_scancode;
|
||||
} SDL_Scancode;
|
||||
|
||||
#endif /* _SDL_scancode_h */
|
||||
|
||||
|
||||
@@ -25,7 +25,12 @@
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_video.h"
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#include "SDL_keycode.h"
|
||||
#include "SDL_compat.h"
|
||||
#else
|
||||
#include "SDL_keysym.h"
|
||||
#endif
|
||||
|
||||
/* On-screen keyboard exposed to the application, it's yet available on Android platform only */
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 2010 Eli Gottlieb
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Eli Gottlieb
|
||||
eligottlieb@gmail.com
|
||||
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_shape_h
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -144,22 +143,14 @@ typedef int32_t Sint32;
|
||||
*/
|
||||
typedef uint32_t Uint32;
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
/**
|
||||
* \brief A signed 64-bit integer type.
|
||||
* \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32!
|
||||
*/
|
||||
typedef int64_t Sint64;
|
||||
/**
|
||||
* \brief An unsigned 64-bit integer type.
|
||||
* \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32!
|
||||
*/
|
||||
typedef uint64_t Uint64;
|
||||
#else
|
||||
/* This is really just a hack to prevent the compiler from complaining */
|
||||
typedef Sint32 Sint64;
|
||||
typedef Uint32 Uint64;
|
||||
#endif
|
||||
|
||||
/*@}*//*Basic data types*/
|
||||
|
||||
@@ -174,13 +165,8 @@ SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
|
||||
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
|
||||
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
|
||||
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
|
||||
#if !defined(__NINTENDODS__) && !defined(ANDROID)
|
||||
/* TODO: figure out why the following happens:
|
||||
include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
|
||||
include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
|
||||
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
|
||||
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
#endif
|
||||
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
|
||||
/** \endcond */
|
||||
|
||||
@@ -196,7 +182,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
|
||||
/** \cond */
|
||||
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
|
||||
#if !defined(__NINTENDODS__) && !defined(ANDROID)
|
||||
#if !defined(__NINTENDODS__) && !defined(__ANDROID__)
|
||||
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
|
||||
typedef enum
|
||||
{
|
||||
@@ -352,8 +338,8 @@ do { \
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
|
||||
#if defined(__MACOSX__)
|
||||
#define SDL_memcpy memcpy
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy(dst, src, len) \
|
||||
do { \
|
||||
@@ -385,8 +371,8 @@ extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
|
||||
#endif
|
||||
|
||||
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
|
||||
#if defined(__MACH__) && defined(__APPLE__)
|
||||
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
|
||||
#if defined(__MACOSX__)
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2)
|
||||
#elif defined(__GNUC__) && defined(i386)
|
||||
#define SDL_memcpy4(dst, src, len) \
|
||||
do { \
|
||||
@@ -400,54 +386,14 @@ do { \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_memcpy4
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(i386)
|
||||
#define SDL_revcpy(dst, src, len) \
|
||||
do { \
|
||||
int u0, u1, u2; \
|
||||
char *dstp = SDL_static_cast(char *, dst); \
|
||||
char *srcp = SDL_static_cast(char *, src); \
|
||||
int n = (len); \
|
||||
if ( n >= 4 ) { \
|
||||
__asm__ __volatile__ ( \
|
||||
"std\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
"cld\n\t" \
|
||||
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
|
||||
: "0" (n >> 2), \
|
||||
"1" (dstp+(n-4)), "2" (srcp+(n-4)) \
|
||||
: "memory" ); \
|
||||
} \
|
||||
switch (n & 3) { \
|
||||
case 3: dstp[2] = srcp[2]; \
|
||||
case 2: dstp[1] = srcp[1]; \
|
||||
case 1: dstp[0] = srcp[0]; \
|
||||
break; \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#ifndef SDL_revcpy
|
||||
extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src,
|
||||
size_t len);
|
||||
#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMMOVE
|
||||
#define SDL_memmove memmove
|
||||
#elif defined(HAVE_BCOPY)
|
||||
#define SDL_memmove(d, s, n) bcopy((s), (d), (n))
|
||||
#else
|
||||
#define SDL_memmove(dst, src, len) \
|
||||
do { \
|
||||
if ( dst < src ) { \
|
||||
SDL_memcpy(dst, src, len); \
|
||||
} else { \
|
||||
SDL_revcpy(dst, src, len); \
|
||||
} \
|
||||
} while(0)
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src,
|
||||
size_t len);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMCMP
|
||||
@@ -588,8 +534,6 @@ extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
|
||||
char **endp, int base);
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HAS_64BIT_TYPE
|
||||
|
||||
#ifdef HAVE__I64TOA
|
||||
#define SDL_lltoa _i64toa
|
||||
#else
|
||||
@@ -618,8 +562,6 @@ extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
|
||||
int base);
|
||||
#endif
|
||||
|
||||
#endif /* SDL_HAS_64BIT_TYPE */
|
||||
|
||||
#ifdef HAVE_STRTOD
|
||||
#define SDL_strtod strtod
|
||||
#else
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,6 @@
|
||||
#include "SDL_pixels.h"
|
||||
#include "SDL_rect.h"
|
||||
#include "SDL_blendmode.h"
|
||||
#include "SDL_scalemode.h"
|
||||
#include "SDL_rwops.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
@@ -55,6 +53,7 @@ extern "C" {
|
||||
/*@{*/
|
||||
#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
|
||||
#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
|
||||
#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
|
||||
/*@}*//*Surface flags*/
|
||||
|
||||
/**
|
||||
@@ -89,9 +88,6 @@ typedef struct SDL_Surface
|
||||
/** info for fast blit mapping to other surfaces */
|
||||
struct SDL_BlitMap *map; /**< Private */
|
||||
|
||||
/** format version, bumped at every change to invalidate blit maps */
|
||||
int format_version; /**< Private */
|
||||
|
||||
/** Reference count -- used when freeing surface */
|
||||
int refcount; /**< Read-mostly */
|
||||
} SDL_Surface;
|
||||
@@ -317,37 +313,6 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
||||
SDL_BlendMode *blendMode);
|
||||
|
||||
/**
|
||||
* \brief Set the scale mode used for blit operations.
|
||||
*
|
||||
* \param surface The surface to update.
|
||||
* \param scaleMode ::SDL_ScaleMode to use for blit scaling.
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid or the scale mode is
|
||||
* not supported.
|
||||
*
|
||||
* \note If the scale mode is not supported, the closest supported mode is
|
||||
* chosen. Currently only ::SDL_TEXTURESCALEMODE_FAST is supported on
|
||||
* surfaces.
|
||||
*
|
||||
* \sa SDL_GetSurfaceScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
|
||||
SDL_ScaleMode scaleMode);
|
||||
|
||||
/**
|
||||
* \brief Get the scale mode used for blit operations.
|
||||
*
|
||||
* \param surface The surface to query.
|
||||
* \param scaleMode A pointer filled in with the current scale mode.
|
||||
*
|
||||
* \return 0 on success, or -1 if the surface is not valid.
|
||||
*
|
||||
* \sa SDL_SetSurfaceScaleMode()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
|
||||
SDL_ScaleMode *scaleMode);
|
||||
|
||||
/**
|
||||
* Sets the clipping rectangle for the destination surface in a blit.
|
||||
*
|
||||
@@ -385,9 +350,13 @@ extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
|
||||
*/
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
|
||||
(SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
|
||||
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
|
||||
(SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
|
||||
|
||||
/**
|
||||
* \brief Copy a block of pixels of one format to another format
|
||||
*
|
||||
* \return 0 on success, or -1 if there was an error
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
||||
Uint32 src_format,
|
||||
@@ -395,85 +364,6 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
||||
Uint32 dst_format,
|
||||
void * dst, int dst_pitch);
|
||||
|
||||
/**
|
||||
* Draws a point with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DrawPoint
|
||||
(SDL_Surface * dst, int x, int y, Uint32 color);
|
||||
extern DECLSPEC int SDLCALL SDL_DrawPoints
|
||||
(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends a point with an RGBA value.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendPoint
|
||||
(SDL_Surface * dst, int x, int y,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendPoints
|
||||
(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Draws a line with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DrawLine
|
||||
(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color);
|
||||
extern DECLSPEC int SDLCALL SDL_DrawLines
|
||||
(SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value along a line.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendLine
|
||||
(SDL_Surface * dst, int x1, int y1, int x2, int y2,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendLines
|
||||
(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Draws the given rectangle with \c color.
|
||||
*
|
||||
* If \c rect is NULL, the whole surface will be outlined with \c color.
|
||||
*
|
||||
* The color should be a pixel of the format used by the surface, and
|
||||
* can be generated by the SDL_MapRGB() function.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_DrawRect
|
||||
(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
|
||||
extern DECLSPEC int SDLCALL SDL_DrawRects
|
||||
(SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value into the outline of the given rectangle.
|
||||
*
|
||||
* If \c rect is NULL, the whole surface will have a blended outline.
|
||||
*
|
||||
* \return 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendRect
|
||||
(SDL_Surface * dst, const SDL_Rect * rect,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendRects
|
||||
(SDL_Surface * dst, const SDL_Rect ** rects, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
/**
|
||||
* Performs a fast fill of the given rectangle with \c color.
|
||||
*
|
||||
@@ -487,21 +377,7 @@ extern DECLSPEC int SDLCALL SDL_BlendRects
|
||||
extern DECLSPEC int SDLCALL SDL_FillRect
|
||||
(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
|
||||
extern DECLSPEC int SDLCALL SDL_FillRects
|
||||
(SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color);
|
||||
|
||||
/**
|
||||
* Blends an RGBA value into the given rectangle.
|
||||
*
|
||||
* If \c rect is NULL, the whole surface will be blended with the color.
|
||||
*
|
||||
* \return This function returns 0 on success, or -1 on error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_BlendFillRect
|
||||
(SDL_Surface * dst, const SDL_Rect * rect,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
extern DECLSPEC int SDLCALL SDL_BlendFillRects
|
||||
(SDL_Surface * dst, const SDL_Rect ** rects, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
(SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
|
||||
|
||||
/**
|
||||
* Performs a fast blit from the source surface to the destination surface.
|
||||
@@ -559,22 +435,6 @@ extern DECLSPEC int SDLCALL SDL_BlendFillRects
|
||||
source colour key.
|
||||
\endverbatim
|
||||
*
|
||||
* If either of the surfaces were in video memory, and the blit returns -2,
|
||||
* the video memory was lost, so it should be reloaded with artwork and
|
||||
* re-blitted:
|
||||
* @code
|
||||
* while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
|
||||
* while ( SDL_LockSurface(image) < 0 )
|
||||
* Sleep(10);
|
||||
* -- Write image pixels to image->pixels --
|
||||
* SDL_UnlockSurface(image);
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* This happens under DirectX 5.0 when the system switches away from your
|
||||
* fullscreen application. The lock will also fail until you have access
|
||||
* to the video memory again.
|
||||
*
|
||||
* You should call SDL_BlitSurface() unless you know exactly how SDL
|
||||
* blitting works internally and how to use the other blit functions.
|
||||
*/
|
||||
@@ -607,6 +467,25 @@ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
|
||||
SDL_Surface * dst,
|
||||
const SDL_Rect * dstrect);
|
||||
|
||||
#define SDL_BlitScaled SDL_UpperBlitScaled
|
||||
|
||||
/**
|
||||
* This is the public scaled blit function, SDL_BlitScaled(), and it performs
|
||||
* rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
|
||||
(SDL_Surface * src, const SDL_Rect * srcrect,
|
||||
SDL_Surface * dst, SDL_Rect * dstrect);
|
||||
|
||||
/**
|
||||
* This is a semi-private blit function and it performs low-level surface
|
||||
* scaled blitting only.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
||||
(SDL_Surface * src, SDL_Rect * srcrect,
|
||||
SDL_Surface * dst, SDL_Rect * dstrect);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -54,7 +53,7 @@ extern "C" {
|
||||
struct SDL_SysWMinfo;
|
||||
#else
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_WIN32)
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -77,7 +76,7 @@ struct SDL_SysWMinfo;
|
||||
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
|
||||
#include <directfb/directfb.h>
|
||||
#include <directfb.h>
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
@@ -88,6 +87,14 @@ typedef struct _NSWindow NSWindow;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
||||
#ifdef __OBJC__
|
||||
#include <UIKit/UIKit.h>
|
||||
#else
|
||||
typedef struct _UIWindow UIWindow;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* These are the various supported windowing subsystems
|
||||
*/
|
||||
@@ -98,6 +105,7 @@ typedef enum
|
||||
SDL_SYSWM_X11,
|
||||
SDL_SYSWM_DIRECTFB,
|
||||
SDL_SYSWM_COCOA,
|
||||
SDL_SYSWM_UIKIT,
|
||||
} SDL_SYSWM_TYPE;
|
||||
|
||||
/**
|
||||
@@ -109,7 +117,7 @@ struct SDL_SysWMmsg
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
union
|
||||
{
|
||||
#if defined(SDL_VIDEO_DRIVER_WIN32)
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
struct {
|
||||
HWND hwnd; /**< The window for the message */
|
||||
UINT msg; /**< The type of message */
|
||||
@@ -133,7 +141,15 @@ struct SDL_SysWMmsg
|
||||
/* No Cocoa window events yet */
|
||||
} cocoa;
|
||||
#endif
|
||||
} /*msg*/;
|
||||
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
||||
struct
|
||||
{
|
||||
/* No UIKit window events yet */
|
||||
} uikit;
|
||||
#endif
|
||||
/* Can't have an empty union */
|
||||
int dummy;
|
||||
} msg;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -148,7 +164,7 @@ struct SDL_SysWMinfo
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
union
|
||||
{
|
||||
#if defined(SDL_VIDEO_DRIVER_WIN32)
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
struct
|
||||
{
|
||||
HWND window; /**< The window handle */
|
||||
@@ -175,7 +191,15 @@ struct SDL_SysWMinfo
|
||||
NSWindow *window; /* The Cocoa window */
|
||||
} cocoa;
|
||||
#endif
|
||||
} /*info*/;
|
||||
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
||||
struct
|
||||
{
|
||||
UIWindow *window; /* The UIKit window */
|
||||
} uikit;
|
||||
#endif
|
||||
/* Can't have an empty union */
|
||||
int dummy;
|
||||
} info;
|
||||
};
|
||||
|
||||
#endif /* SDL_PROTOTYPES_ONLY */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_thread_h
|
||||
@@ -50,6 +49,16 @@ typedef struct SDL_Thread SDL_Thread;
|
||||
/* The SDL thread ID */
|
||||
typedef unsigned long SDL_threadID;
|
||||
|
||||
/* The SDL thread priority
|
||||
*
|
||||
* Note: On many systems you require special privileges to set high priority.
|
||||
*/
|
||||
typedef enum {
|
||||
SDL_THREAD_PRIORITY_LOW,
|
||||
SDL_THREAD_PRIORITY_NORMAL,
|
||||
SDL_THREAD_PRIORITY_HIGH
|
||||
} SDL_ThreadPriority;
|
||||
|
||||
/* The function passed to SDL_CreateThread()
|
||||
It is passed a void* user context parameter and returns an int.
|
||||
*/
|
||||
@@ -81,17 +90,6 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
|
||||
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef unsigned long (__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
unsigned
|
||||
(__stdcall *
|
||||
func) (void *),
|
||||
void *arg,
|
||||
unsigned,
|
||||
unsigned
|
||||
*threadID);
|
||||
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
|
||||
#else
|
||||
typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
unsigned (__stdcall *
|
||||
func) (void
|
||||
@@ -99,13 +97,12 @@ typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||
void *arg, unsigned,
|
||||
unsigned *threadID);
|
||||
typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a thread.
|
||||
*/
|
||||
extern DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThread(SDL_ThreadFunction fn, void *data,
|
||||
SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
|
||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||
pfnSDL_CurrentEndThread pfnEndThread);
|
||||
|
||||
@@ -114,26 +111,50 @@ SDL_CreateThread(SDL_ThreadFunction fn, void *data,
|
||||
/**
|
||||
* Create a thread.
|
||||
*/
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, NULL, NULL)
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* Create a thread.
|
||||
*/
|
||||
#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex)
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
/**
|
||||
* Create a thread.
|
||||
*
|
||||
* Thread naming is a little complicated: Most systems have very small
|
||||
* limits for the string length (BeOS has 32 bytes, Linux currently has 16,
|
||||
* Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
|
||||
* have to see what happens with your system's debugger. The name should be
|
||||
* UTF-8 (but using the naming limits of C identifiers is a better bet).
|
||||
* There are no requirements for thread naming conventions, so long as the
|
||||
* string is null-terminated UTF-8, but these guidelines are helpful in
|
||||
* choosing a name:
|
||||
*
|
||||
* http://stackoverflow.com/questions/149932/naming-conventions-for-threads
|
||||
*
|
||||
* If a system imposes requirements, SDL will try to munge the string for
|
||||
* it (truncate, etc), but the original string contents will be available
|
||||
* from SDL_GetThreadName().
|
||||
*/
|
||||
extern DECLSPEC SDL_Thread *SDLCALL
|
||||
SDL_CreateThread(SDL_ThreadFunction fn, void *data);
|
||||
SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the thread name, as it was specified in SDL_CreateThread().
|
||||
* This function returns a pointer to a UTF-8 string that names the
|
||||
* specified thread, or NULL if it doesn't have a name. This is internal
|
||||
* memory, not to be free()'d by the caller, and remains valid until the
|
||||
* specified thread is cleaned up by SDL_WaitThread().
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
|
||||
|
||||
/**
|
||||
* Get the thread identifier for the current thread.
|
||||
*/
|
||||
@@ -146,6 +167,11 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
|
||||
*/
|
||||
extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
|
||||
|
||||
/**
|
||||
* Set the priority for the current thread
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
|
||||
|
||||
/**
|
||||
* Wait for a thread to finish.
|
||||
*
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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_timer_h
|
||||
@@ -41,104 +40,60 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the OS scheduler timeslice, in milliseconds.
|
||||
*/
|
||||
#define SDL_TIMESLICE 10
|
||||
|
||||
/**
|
||||
* This is the maximum resolution of the SDL timer on all platforms.
|
||||
*/
|
||||
#define TIMER_RESOLUTION 10 /**< Experimentally determined */
|
||||
|
||||
/**
|
||||
* Get the number of milliseconds since the SDL library initialization.
|
||||
* \brief Get the number of milliseconds since the SDL library initialization.
|
||||
*
|
||||
* Note that this value wraps if the program runs for more than ~49 days.
|
||||
* \note This value wraps if the program runs for more than ~49 days.
|
||||
*/
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
|
||||
|
||||
/**
|
||||
* Wait a specified number of milliseconds before returning.
|
||||
* \brief Get the current value of the high resolution counter
|
||||
*/
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void);
|
||||
|
||||
/**
|
||||
* \brief Get the count per second of the high resolution counter
|
||||
*/
|
||||
extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
|
||||
|
||||
/**
|
||||
* \brief Wait a specified number of milliseconds before returning.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
|
||||
|
||||
/**
|
||||
* Function prototype for the timer callback function.
|
||||
*/
|
||||
typedef Uint32(SDLCALL * SDL_TimerCallback) (Uint32 interval);
|
||||
|
||||
/**
|
||||
* Set a callback to run after the specified number of milliseconds has
|
||||
* elapsed. The callback function is passed the current timer interval
|
||||
* and returns the next timer interval. If the returned value is the
|
||||
* same as the one passed in, the periodic alarm continues, otherwise a
|
||||
* new alarm is scheduled. If the callback returns 0, the periodic alarm
|
||||
* is cancelled.
|
||||
*
|
||||
* To cancel a currently running timer, call
|
||||
* \code SDL_SetTimer(0, NULL); \endcode
|
||||
*
|
||||
* The timer callback function may run in a different thread than your
|
||||
* main code, and so shouldn't call any functions from within itself.
|
||||
*
|
||||
* The maximum resolution of this timer is 10 ms, which means that if
|
||||
* you request a 16 ms timer, your callback will run approximately 20 ms
|
||||
* later on an unloaded system. If you wanted to set a flag signaling
|
||||
* a frame update at 30 frames per second (every 33 ms), you might set a
|
||||
* timer for 30 ms:
|
||||
* \code
|
||||
* SDL_SetTimer((33/10)*10, flag_update);
|
||||
* \endcode
|
||||
*
|
||||
* If you use this function, you need to pass ::SDL_INIT_TIMER to SDL_Init().
|
||||
*
|
||||
* Under UNIX, you should not use raise or use SIGALRM and this function
|
||||
* in the same program, as it is implemented using setitimer(). You also
|
||||
* should not use this function in multi-threaded applications as signals
|
||||
* to multi-threaded apps have undefined behavior in some implementations.
|
||||
*
|
||||
* \return 0 if successful, or -1 if there was an error.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval,
|
||||
SDL_TimerCallback callback);
|
||||
|
||||
/**
|
||||
* \name Peter timers
|
||||
* New timer API, supports multiple timers
|
||||
* Written by Stephane Peter <megastep@lokigames.com>
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Function prototype for the new timer callback function.
|
||||
*
|
||||
* The callback function is passed the current timer interval and returns
|
||||
* the next timer interval. If the returned value is the same as the one
|
||||
* passed in, the periodic alarm continues, otherwise a new alarm is
|
||||
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
|
||||
*/
|
||||
typedef Uint32(SDLCALL * SDL_NewTimerCallback) (Uint32 interval, void *param);
|
||||
typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
|
||||
|
||||
/**
|
||||
* Definition of the timer ID type.
|
||||
* Definition of the timer ID type.
|
||||
*/
|
||||
typedef struct _SDL_TimerID *SDL_TimerID;
|
||||
typedef int SDL_TimerID;
|
||||
|
||||
/**
|
||||
* Add a new timer to the pool of timers already running.
|
||||
* \return A timer ID, or NULL when an error occurs.
|
||||
* \brief Add a new timer to the pool of timers already running.
|
||||
*
|
||||
* \return A timer ID, or NULL when an error occurs.
|
||||
*/
|
||||
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
|
||||
SDL_NewTimerCallback
|
||||
callback, void *param);
|
||||
SDL_TimerCallback callback,
|
||||
void *param);
|
||||
|
||||
/**
|
||||
* Remove one of the multiple timers knowing its ID.
|
||||
* \return A boolean value indicating success or failure.
|
||||
* \brief Remove a timer knowing its ID.
|
||||
*
|
||||
* \return A boolean value indicating success or failure.
|
||||
*
|
||||
* \warning It is not safe to remove a timer multiple times.
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
|
||||
|
||||
/*@}*//*Peter timers*/
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,7 +29,6 @@
|
||||
#define _SDL_version_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_revision.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@@ -145,6 +143,16 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
|
||||
|
||||
/**
|
||||
* \brief Get the revision number of SDL that is linked against your program.
|
||||
*
|
||||
* Returns a number uniquely identifying the exact revision of the SDL
|
||||
* library in use. It is an incrementing number based on commits to
|
||||
* hg.libsdl.org.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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 diff suppressed because it is too large
Load Diff
@@ -1,38 +1,34 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/* Initialization code for SDL */
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_revision.h"
|
||||
#include "SDL_fatal.h"
|
||||
#include "SDL_assert_c.h"
|
||||
#include "haptic/SDL_haptic_c.h"
|
||||
#include "joystick/SDL_joystick_c.h"
|
||||
|
||||
#if !SDL_VIDEO_DISABLED
|
||||
#include "video/SDL_leaks.h"
|
||||
#endif
|
||||
|
||||
/* Initialization/Cleanup routines */
|
||||
#if !SDL_TIMERS_DISABLED
|
||||
extern void SDL_StartTicks(void);
|
||||
@@ -49,9 +45,6 @@ extern int SDL_HelperWindowDestroy(void);
|
||||
static Uint32 SDL_initialized = 0;
|
||||
static Uint32 ticks_started = 0;
|
||||
|
||||
#ifdef CHECK_LEAKS
|
||||
int surfaces_allocated = 0;
|
||||
#endif
|
||||
|
||||
int
|
||||
SDL_InitSubSystem(Uint32 flags)
|
||||
@@ -59,7 +52,7 @@ SDL_InitSubSystem(Uint32 flags)
|
||||
#if !SDL_VIDEO_DISABLED
|
||||
/* Initialize the video/event subsystem */
|
||||
if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) {
|
||||
if (SDL_VideoInit(NULL, (flags & SDL_INIT_EVENTTHREAD)) < 0) {
|
||||
if (SDL_VideoInit(NULL) < 0) {
|
||||
return (-1);
|
||||
}
|
||||
SDL_initialized |= SDL_INIT_VIDEO;
|
||||
@@ -215,44 +208,17 @@ void
|
||||
SDL_Quit(void)
|
||||
{
|
||||
/* Quit all subsystems */
|
||||
#ifdef DEBUG_BUILD
|
||||
printf("[SDL_Quit] : Enter! Calling QuitSubSystem()\n");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32__)
|
||||
SDL_HelperWindowDestroy();
|
||||
#endif
|
||||
SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
|
||||
|
||||
#ifdef CHECK_LEAKS
|
||||
#ifdef DEBUG_BUILD
|
||||
printf("[SDL_Quit] : CHECK_LEAKS\n");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
/* !!! FIXME: make this an assertion. */
|
||||
/* Print the number of surfaces not freed */
|
||||
if (surfaces_allocated != 0) {
|
||||
fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
|
||||
surfaces_allocated);
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG_BUILD
|
||||
printf("[SDL_Quit] : SDL_UninstallParachute()\n");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
/* Uninstall any parachute signal handlers */
|
||||
SDL_UninstallParachute();
|
||||
|
||||
SDL_ClearHints();
|
||||
SDL_AssertionsQuit();
|
||||
|
||||
#ifdef DEBUG_BUILD
|
||||
printf("[SDL_Quit] : Returning!\n");
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
SDL_LogResetPriorities();
|
||||
}
|
||||
|
||||
/* Get the library version number */
|
||||
@@ -269,6 +235,13 @@ SDL_GetRevision(void)
|
||||
return SDL_REVISION;
|
||||
}
|
||||
|
||||
/* Get the library source revision number */
|
||||
int
|
||||
SDL_GetRevisionNumber(void)
|
||||
{
|
||||
return SDL_REVISION_NUMBER;
|
||||
}
|
||||
|
||||
/* Get the name of the platform */
|
||||
const char *
|
||||
SDL_GetPlatform()
|
||||
@@ -300,6 +273,8 @@ SDL_GetPlatform()
|
||||
return "Mac OS X";
|
||||
#elif __NETBSD__
|
||||
return "NetBSD";
|
||||
#elif __NDS__
|
||||
return "Nintendo DS";
|
||||
#elif __OPENBSD__
|
||||
return "OpenBSD";
|
||||
#elif __OS2__
|
||||
@@ -329,8 +304,7 @@ SDL_GetPlatform()
|
||||
|
||||
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
|
||||
/* Need to include DllMain() on Watcom C for some reason.. */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "core/windows/SDL_windows.h"
|
||||
|
||||
BOOL APIENTRY
|
||||
_DllMainCRTStartup(HANDLE hModule,
|
||||
|
||||
@@ -1,33 +1,36 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_assert_c.h"
|
||||
#include "video/SDL_sysvideo.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#ifdef __WIN32__
|
||||
#include "core/windows/SDL_windows.h"
|
||||
|
||||
#ifndef WS_OVERLAPPEDWINDOW
|
||||
#define WS_OVERLAPPEDWINDOW 0
|
||||
#endif
|
||||
#else /* fprintf, _exit(), etc. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -41,8 +44,7 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
|
||||
* We keep all triggered assertions in a singly-linked list so we can
|
||||
* generate a report later.
|
||||
*/
|
||||
static SDL_assert_data assertion_list_terminator = { 0, 0, 0, 0, 0, 0, 0 };
|
||||
static SDL_assert_data *triggered_assertions = &assertion_list_terminator;
|
||||
static SDL_assert_data *triggered_assertions = NULL;
|
||||
|
||||
static SDL_mutex *assertion_mutex = NULL;
|
||||
static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion;
|
||||
@@ -56,11 +58,12 @@ debug_print(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
|
||||
static void
|
||||
debug_print(const char *fmt, ...)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
#ifdef __WIN32__
|
||||
/* Format into a buffer for OutputDebugStringA(). */
|
||||
char buf[1024];
|
||||
char *startptr;
|
||||
char *ptr;
|
||||
LPTSTR tstr;
|
||||
int len;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@@ -77,15 +80,19 @@ debug_print(const char *fmt, ...)
|
||||
for (ptr = startptr; *ptr; ptr++) {
|
||||
if (*ptr == '\n') {
|
||||
*ptr = '\0';
|
||||
OutputDebugStringA(startptr);
|
||||
OutputDebugStringA("\r\n");
|
||||
tstr = WIN_UTF8ToString(startptr);
|
||||
OutputDebugString(tstr);
|
||||
SDL_free(tstr);
|
||||
OutputDebugString(TEXT("\r\n"));
|
||||
startptr = ptr+1;
|
||||
}
|
||||
}
|
||||
|
||||
/* catch that last piece if it didn't have a newline... */
|
||||
if (startptr != ptr) {
|
||||
OutputDebugStringA(startptr);
|
||||
tstr = WIN_UTF8ToString(startptr);
|
||||
OutputDebugString(tstr);
|
||||
SDL_free(tstr);
|
||||
}
|
||||
#else
|
||||
/* Unix has it easy. Just dump it to stderr. */
|
||||
@@ -98,7 +105,7 @@ debug_print(const char *fmt, ...)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#ifdef __WIN32__
|
||||
static SDL_assert_state SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
|
||||
static const SDL_assert_data *SDL_Windows_AssertData = NULL;
|
||||
|
||||
@@ -112,6 +119,7 @@ SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
/* !!! FIXME: all this code stinks. */
|
||||
const SDL_assert_data *data = SDL_Windows_AssertData;
|
||||
char buf[1024];
|
||||
LPTSTR tstr;
|
||||
const int w = 100;
|
||||
const int h = 25;
|
||||
const int gap = 10;
|
||||
@@ -120,14 +128,14 @@ SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
int len;
|
||||
int i;
|
||||
static const struct {
|
||||
const char *name;
|
||||
LPCTSTR name;
|
||||
SDL_assert_state state;
|
||||
} buttons[] = {
|
||||
{"Abort", SDL_ASSERTION_ABORT },
|
||||
{"Break", SDL_ASSERTION_BREAK },
|
||||
{"Retry", SDL_ASSERTION_RETRY },
|
||||
{"Ignore", SDL_ASSERTION_IGNORE },
|
||||
{"Always Ignore", SDL_ASSERTION_ALWAYS_IGNORE },
|
||||
{TEXT("Abort"), SDL_ASSERTION_ABORT },
|
||||
{TEXT("Break"), SDL_ASSERTION_BREAK },
|
||||
{TEXT("Retry"), SDL_ASSERTION_RETRY },
|
||||
{TEXT("Ignore"), SDL_ASSERTION_IGNORE },
|
||||
{TEXT("Always Ignore"), SDL_ASSERTION_ALWAYS_IGNORE },
|
||||
};
|
||||
|
||||
len = (int) SDL_snprintf(buf, sizeof (buf),
|
||||
@@ -139,14 +147,16 @@ SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
buf[sizeof (buf) - 1] = '\0';
|
||||
}
|
||||
|
||||
CreateWindowA("STATIC", buf,
|
||||
tstr = WIN_UTF8ToString(buf);
|
||||
CreateWindow(TEXT("STATIC"), tstr,
|
||||
WS_VISIBLE | WS_CHILD | SS_LEFT,
|
||||
x, y, 550, 100,
|
||||
hwnd, (HMENU) 1, NULL, NULL);
|
||||
SDL_free(tstr);
|
||||
y += 110;
|
||||
|
||||
for (i = 0; i < (sizeof (buttons) / sizeof (buttons[0])); i++) {
|
||||
CreateWindowA("BUTTON", buttons[i].name,
|
||||
CreateWindow(TEXT("BUTTON"), buttons[i].name,
|
||||
WS_VISIBLE | WS_CHILD,
|
||||
x, y, w, h,
|
||||
hwnd, (HMENU) buttons[i].state, NULL, NULL);
|
||||
@@ -206,7 +216,8 @@ static void SDL_AddAssertionToReport(SDL_assert_data *data)
|
||||
{
|
||||
/* (data) is always a static struct defined with the assert macros, so
|
||||
we don't have to worry about copying or allocating them. */
|
||||
if (data->next == NULL) { /* not yet added? */
|
||||
data->trigger_count++;
|
||||
if (data->trigger_count == 1) { /* not yet added? */
|
||||
data->next = triggered_assertions;
|
||||
triggered_assertions = data;
|
||||
}
|
||||
@@ -215,19 +226,14 @@ static void SDL_AddAssertionToReport(SDL_assert_data *data)
|
||||
|
||||
static void SDL_GenerateAssertionReport(void)
|
||||
{
|
||||
const SDL_assert_data *item;
|
||||
const SDL_assert_data *item = triggered_assertions;
|
||||
|
||||
/* only do this if the app hasn't assigned an assertion handler. */
|
||||
if (assertion_handler != SDL_PromptAssertion)
|
||||
return;
|
||||
|
||||
item = SDL_GetAssertionReport();
|
||||
if (item->condition)
|
||||
{
|
||||
if ((item != NULL) && (assertion_handler != SDL_PromptAssertion)) {
|
||||
debug_print("\n\nSDL assertion report.\n");
|
||||
debug_print("All SDL assertions between last init/quit:\n\n");
|
||||
|
||||
while (item->condition) {
|
||||
while (item != NULL) {
|
||||
debug_print(
|
||||
"'%s'\n"
|
||||
" * %s (%s:%d)\n"
|
||||
@@ -247,7 +253,7 @@ static void SDL_GenerateAssertionReport(void)
|
||||
|
||||
static void SDL_ExitProcess(int exitcode)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
#ifdef __WIN32__
|
||||
ExitProcess(42);
|
||||
#else
|
||||
_exit(42);
|
||||
@@ -310,10 +316,10 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
|
||||
|
||||
/* platform-specific UI... */
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#ifdef __WIN32__
|
||||
state = SDL_PromptAssertion_windows(data);
|
||||
|
||||
#elif __MACOSX__
|
||||
#elif defined __MACOSX__ && defined SDL_VIDEO_DRIVER_COCOA
|
||||
/* This has to be done in an Objective-C (*.m) file, so we call out. */
|
||||
extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);
|
||||
state = SDL_PromptAssertion_cocoa(data);
|
||||
@@ -331,16 +337,16 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
|
||||
if (SDL_strcmp(buf, "a") == 0) {
|
||||
state = SDL_ASSERTION_ABORT;
|
||||
break;
|
||||
} else if (SDL_strcmp(envr, "b") == 0) {
|
||||
} else if (SDL_strcmp(buf, "b") == 0) {
|
||||
state = SDL_ASSERTION_BREAK;
|
||||
break;
|
||||
} else if (SDL_strcmp(envr, "r") == 0) {
|
||||
} else if (SDL_strcmp(buf, "r") == 0) {
|
||||
state = SDL_ASSERTION_RETRY;
|
||||
break;
|
||||
} else if (SDL_strcmp(envr, "i") == 0) {
|
||||
} else if (SDL_strcmp(buf, "i") == 0) {
|
||||
state = SDL_ASSERTION_IGNORE;
|
||||
break;
|
||||
} else if (SDL_strcmp(envr, "A") == 0) {
|
||||
} else if (SDL_strcmp(buf, "A") == 0) {
|
||||
state = SDL_ASSERTION_ALWAYS_IGNORE;
|
||||
break;
|
||||
}
|
||||
@@ -387,8 +393,6 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file,
|
||||
|
||||
SDL_AddAssertionToReport(data);
|
||||
|
||||
data->trigger_count++;
|
||||
|
||||
assertion_running++;
|
||||
if (assertion_running > 1) { /* assert during assert! Abort. */
|
||||
if (assertion_running == 2) {
|
||||
@@ -461,16 +465,16 @@ const SDL_assert_data *SDL_GetAssertionReport(void)
|
||||
|
||||
void SDL_ResetAssertionReport(void)
|
||||
{
|
||||
SDL_assert_data *item = triggered_assertions;
|
||||
SDL_assert_data *next = NULL;
|
||||
for (item = triggered_assertions; item->condition; item = next) {
|
||||
SDL_assert_data *item;
|
||||
for (item = triggered_assertions; item != NULL; item = next) {
|
||||
next = (SDL_assert_data *) item->next;
|
||||
item->always_ignore = SDL_FALSE;
|
||||
item->trigger_count = 0;
|
||||
item->next = NULL;
|
||||
}
|
||||
|
||||
triggered_assertions = &assertion_list_terminator;
|
||||
triggered_assertions = NULL;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
|
||||
extern int SDL_AssertionsInit(void);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,31 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/* Simple error handling in SDL */
|
||||
|
||||
#include "SDL_log.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_error_c.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
/*#define DEBUG_ERROR*/
|
||||
|
||||
/* Routine to get the thread-specific error variable */
|
||||
#if SDL_THREADS_DISABLED
|
||||
@@ -60,6 +55,9 @@ SDL_SetError(const char *fmt, ...)
|
||||
va_list ap;
|
||||
SDL_error *error;
|
||||
|
||||
/* Ignore call if invalid format pointer was passed */
|
||||
if (fmt == NULL) return;
|
||||
|
||||
/* Copy in the key, mark error as valid */
|
||||
error = SDL_GetErrBuf();
|
||||
error->error = 1;
|
||||
@@ -113,12 +111,7 @@ SDL_SetError(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
|
||||
/* If we are in debug mode, print out an error message */
|
||||
#ifdef DEBUG_ERROR
|
||||
fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ERROR: %s", SDL_GetError());
|
||||
#endif
|
||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError());
|
||||
}
|
||||
|
||||
/* This function has a bit more overhead than most error functions
|
||||
@@ -264,4 +257,5 @@ main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
@@ -57,6 +56,9 @@ typedef struct SDL_error
|
||||
} args[ERR_MAX_ARGS];
|
||||
} SDL_error;
|
||||
|
||||
/* Defined in SDL_thread.c */
|
||||
extern SDL_error *SDL_GetErrBuf(void);
|
||||
|
||||
#endif /* _SDL_error_c_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2010 Sam Lantinga
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
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.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
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:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
|
||||
141
project/jni/sdl-1.3/src/SDL_hints.c
Normal file
141
project/jni/sdl-1.3/src/SDL_hints.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "SDL_hints.h"
|
||||
#include "SDL_hints_c.h"
|
||||
|
||||
|
||||
/* Assuming there aren't many hints set and they aren't being queried in
|
||||
critical performance paths, we'll just use a linked list here.
|
||||
*/
|
||||
typedef struct SDL_Hint {
|
||||
char *name;
|
||||
char *value;
|
||||
SDL_HintPriority priority;
|
||||
SDL_HintChangedCb callback;
|
||||
struct SDL_Hint *next;
|
||||
} SDL_Hint;
|
||||
|
||||
static SDL_Hint *SDL_hints;
|
||||
|
||||
SDL_bool
|
||||
SDL_RegisterHintChangedCb(const char *name, SDL_HintChangedCb hintCb)
|
||||
{
|
||||
SDL_Hint *hint;
|
||||
|
||||
for (hint = SDL_hints; hint; hint = hint->next) {
|
||||
if (SDL_strcmp(name, hint->name) == 0) {
|
||||
hint->callback = hintCb;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_SetHintWithPriority(const char *name, const char *value,
|
||||
SDL_HintPriority priority)
|
||||
{
|
||||
const char *env;
|
||||
SDL_Hint *prev, *hint;
|
||||
|
||||
if (!name || !value) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
env = SDL_getenv(name);
|
||||
if (env && priority < SDL_HINT_OVERRIDE) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
prev = NULL;
|
||||
for (hint = SDL_hints; hint; prev = hint, hint = hint->next) {
|
||||
if (SDL_strcmp(name, hint->name) == 0) {
|
||||
if (priority < hint->priority) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (SDL_strcmp(hint->value, value) != 0) {
|
||||
if (hint->callback != NULL) {
|
||||
(*hint->callback)(name, hint->value, value);
|
||||
}
|
||||
SDL_free(hint->value);
|
||||
hint->value = SDL_strdup(value);
|
||||
}
|
||||
hint->priority = priority;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Couldn't find the hint, add a new one */
|
||||
hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
|
||||
if (!hint) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
hint->name = SDL_strdup(name);
|
||||
hint->value = SDL_strdup(value);
|
||||
hint->priority = priority;
|
||||
hint->callback = NULL;
|
||||
hint->next = SDL_hints;
|
||||
SDL_hints = hint;
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_SetHint(const char *name, const char *value)
|
||||
{
|
||||
return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL);
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GetHint(const char *name)
|
||||
{
|
||||
const char *env;
|
||||
SDL_Hint *hint;
|
||||
|
||||
env = SDL_getenv(name);
|
||||
for (hint = SDL_hints; hint; hint = hint->next) {
|
||||
if (SDL_strcmp(name, hint->name) == 0) {
|
||||
if (!env || hint->priority == SDL_HINT_OVERRIDE) {
|
||||
return hint->value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
void SDL_ClearHints(void)
|
||||
{
|
||||
SDL_Hint *hint;
|
||||
|
||||
while (SDL_hints) {
|
||||
hint = SDL_hints;
|
||||
SDL_hints = hint->next;
|
||||
|
||||
SDL_free(hint->name);
|
||||
SDL_free(hint->value);
|
||||
SDL_free(hint);
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
34
project/jni/sdl-1.3/src/SDL_hints_c.h
Normal file
34
project/jni/sdl-1.3/src/SDL_hints_c.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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_hints_c_h
|
||||
#define _SDL_hints_c_h
|
||||
|
||||
/**
|
||||
* \brief A callback function that is optionally called when a hint changes
|
||||
*/
|
||||
typedef void (*SDL_HintChangedCb)(const char *name, const char *oldValue, const char *newValue);
|
||||
|
||||
extern SDL_bool SDL_RegisterHintChangedCb(const char *name, SDL_HintChangedCb hintCb);
|
||||
|
||||
#endif /* _SDL_hints_c_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
329
project/jni/sdl-1.3/src/SDL_log.c
Normal file
329
project/jni/sdl-1.3/src/SDL_log.c
Normal file
@@ -0,0 +1,329 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/* Simple log messages in SDL */
|
||||
|
||||
#include "SDL_log.h"
|
||||
|
||||
#if HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32__)
|
||||
#include "core/windows/SDL_windows.h"
|
||||
#elif defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_ERROR
|
||||
#define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO
|
||||
|
||||
typedef struct SDL_LogLevel
|
||||
{
|
||||
int category;
|
||||
SDL_LogPriority priority;
|
||||
struct SDL_LogLevel *next;
|
||||
} SDL_LogLevel;
|
||||
|
||||
/* The default log output function */
|
||||
static void SDL_LogOutput(void *userdata,
|
||||
int category, SDL_LogPriority priority,
|
||||
const char *message);
|
||||
|
||||
static SDL_LogLevel *SDL_loglevels;
|
||||
static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
|
||||
static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
|
||||
static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput;
|
||||
static void *SDL_log_userdata = NULL;
|
||||
|
||||
static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = {
|
||||
NULL,
|
||||
"VERBOSE",
|
||||
"DEBUG",
|
||||
"INFO",
|
||||
"WARN",
|
||||
"ERROR",
|
||||
"CRITICAL"
|
||||
};
|
||||
|
||||
#ifdef __ANDROID__
|
||||
static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = {
|
||||
"APP",
|
||||
"ERROR",
|
||||
"SYSTEM",
|
||||
"AUDIO",
|
||||
"VIDEO",
|
||||
"RENDER",
|
||||
"INPUT"
|
||||
};
|
||||
|
||||
static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = {
|
||||
ANDROID_LOG_VERBOSE,
|
||||
ANDROID_LOG_DEBUG,
|
||||
ANDROID_LOG_INFO,
|
||||
ANDROID_LOG_WARN,
|
||||
ANDROID_LOG_ERROR,
|
||||
ANDROID_LOG_FATAL
|
||||
};
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
|
||||
void
|
||||
SDL_LogSetAllPriority(SDL_LogPriority priority)
|
||||
{
|
||||
SDL_LogLevel *entry;
|
||||
|
||||
for (entry = SDL_loglevels; entry; entry = entry->next) {
|
||||
entry->priority = priority;
|
||||
}
|
||||
SDL_application_priority = SDL_default_priority = priority;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogSetPriority(int category, SDL_LogPriority priority)
|
||||
{
|
||||
SDL_LogLevel *entry;
|
||||
|
||||
for (entry = SDL_loglevels; entry; entry = entry->next) {
|
||||
if (entry->category == category) {
|
||||
entry->priority = priority;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a new entry */
|
||||
entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry));
|
||||
if (entry) {
|
||||
entry->category = category;
|
||||
entry->priority = priority;
|
||||
entry->next = SDL_loglevels;
|
||||
SDL_loglevels = entry;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LogPriority
|
||||
SDL_LogGetPriority(int category)
|
||||
{
|
||||
SDL_LogLevel *entry;
|
||||
|
||||
for (entry = SDL_loglevels; entry; entry = entry->next) {
|
||||
if (entry->category == category) {
|
||||
return entry->priority;
|
||||
}
|
||||
}
|
||||
|
||||
if (category == SDL_LOG_CATEGORY_APPLICATION) {
|
||||
return SDL_application_priority;
|
||||
} else {
|
||||
return SDL_default_priority;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogResetPriorities(void)
|
||||
{
|
||||
SDL_LogLevel *entry;
|
||||
|
||||
while (SDL_loglevels) {
|
||||
entry = SDL_loglevels;
|
||||
SDL_loglevels = entry->next;
|
||||
SDL_free(entry);
|
||||
}
|
||||
|
||||
SDL_application_priority = DEFAULT_APPLICATION_PRIORITY;
|
||||
SDL_default_priority = DEFAULT_PRIORITY;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_Log(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogVerbose(int category, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogDebug(int category, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, SDL_LOG_PRIORITY_DEBUG, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogInfo(int category, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogWarn(int category, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogError(int category, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogCritical(int category, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
SDL_LogMessageV(category, priority, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
static const char *
|
||||
GetCategoryPrefix(int category)
|
||||
{
|
||||
if (category < SDL_LOG_CATEGORY_RESERVED1) {
|
||||
return SDL_category_prefixes[category];
|
||||
}
|
||||
if (category < SDL_LOG_CATEGORY_CUSTOM) {
|
||||
return "RESERVED";
|
||||
}
|
||||
return "CUSTOM";
|
||||
}
|
||||
#endif /* __ANDROID__ */
|
||||
|
||||
void
|
||||
SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap)
|
||||
{
|
||||
char *message;
|
||||
|
||||
/* Nothing to do if we don't have an output function */
|
||||
if (!SDL_log_function) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure we don't exceed array bounds */
|
||||
if ((int)priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* See if we want to do anything with this message */
|
||||
if (priority < SDL_LogGetPriority(category)) {
|
||||
return;
|
||||
}
|
||||
|
||||
message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE);
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap);
|
||||
SDL_log_function(SDL_log_userdata, category, priority, message);
|
||||
SDL_stack_free(message);
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
|
||||
const char *message)
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
/* Way too many allocations here, urgh */
|
||||
{
|
||||
char *output;
|
||||
size_t length;
|
||||
LPTSTR tstr;
|
||||
|
||||
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1;
|
||||
output = SDL_stack_alloc(char, length);
|
||||
SDL_snprintf(output, length, "%s: %s", SDL_priority_prefixes[priority], message);
|
||||
tstr = WIN_UTF8ToString(output);
|
||||
OutputDebugString(tstr);
|
||||
SDL_free(tstr);
|
||||
SDL_stack_free(output);
|
||||
}
|
||||
#elif defined(__ANDROID__)
|
||||
{
|
||||
char tag[32];
|
||||
|
||||
SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
|
||||
__android_log_write(SDL_android_priority[priority], tag, message);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_STDIO_H
|
||||
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
|
||||
{
|
||||
if (callback) {
|
||||
*callback = SDL_log_function;
|
||||
}
|
||||
if (userdata) {
|
||||
*userdata = SDL_log_userdata;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata)
|
||||
{
|
||||
SDL_log_function = callback;
|
||||
SDL_log_userdata = userdata;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
207
project/jni/sdl-1.3/src/SDL_renderer_gles.c.diff
Normal file
207
project/jni/sdl-1.3/src/SDL_renderer_gles.c.diff
Normal file
@@ -0,0 +1,207 @@
|
||||
These are changes of my Android SDL port over the official SDL port, at the last point where I've synced them
|
||||
TODO: merge this
|
||||
|
||||
--- SDL_renderer_gles.c 2011-12-05 14:18:19.517975982 +0200
|
||||
+++ /home/pelya/src/endless_space/SDL-android/video/SDL_renderer_gles.c 2011-12-05 13:57:25.000000000 +0200
|
||||
@@ -20,15 +20,29 @@
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
+#include "SDL_version.h"
|
||||
|
||||
#if SDL_VIDEO_RENDER_OGL_ES
|
||||
|
||||
+#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_opengles.h"
|
||||
#include "SDL_sysvideo.h"
|
||||
+#else
|
||||
+#include "SDL_video-1.3.h"
|
||||
+#include "SDL_sysvideo-1.3.h"
|
||||
+#endif
|
||||
+#include "SDL_opengles.h"
|
||||
#include "SDL_pixels_c.h"
|
||||
#include "SDL_rect_c.h"
|
||||
+#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#include "SDL_yuv_sw_c.h"
|
||||
+#endif
|
||||
+#ifdef ANDROID
|
||||
+#include <android/log.h>
|
||||
+#else
|
||||
+#define __android_log_print(...)
|
||||
+#endif
|
||||
|
||||
#if defined(__QNXNTO__)
|
||||
/* Include QNX system header to check QNX version later */
|
||||
@@ -112,15 +126,14 @@
|
||||
SDL_TEXTUREMODULATE_ALPHA),
|
||||
(SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
|
||||
SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
|
||||
- (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 6,
|
||||
+ (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 5,
|
||||
{
|
||||
/* OpenGL ES 1.x supported formats list */
|
||||
SDL_PIXELFORMAT_RGBA4444,
|
||||
SDL_PIXELFORMAT_RGBA5551,
|
||||
SDL_PIXELFORMAT_RGB565,
|
||||
SDL_PIXELFORMAT_RGB24,
|
||||
- SDL_PIXELFORMAT_BGR888,
|
||||
- SDL_PIXELFORMAT_ABGR8888},
|
||||
+ SDL_PIXELFORMAT_RGBA8888},
|
||||
0,
|
||||
0}
|
||||
};
|
||||
@@ -213,11 +226,13 @@
|
||||
GLint value;
|
||||
int doublebuffer;
|
||||
|
||||
+#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
if (!(window->flags & SDL_WINDOW_OPENGL)) {
|
||||
if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
|
||||
if (!renderer) {
|
||||
@@ -295,11 +310,15 @@
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
|
||||
+#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
+ // Always double-buffered
|
||||
+#else
|
||||
if (SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer) == 0) {
|
||||
if (!doublebuffer) {
|
||||
renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
#if SDL_VIDEO_DRIVER_PANDORA
|
||||
data->GL_OES_draw_texture_supported = SDL_FALSE;
|
||||
data->useDrawTexture = SDL_FALSE;
|
||||
@@ -311,6 +330,10 @@
|
||||
data->GL_OES_draw_texture_supported = SDL_FALSE;
|
||||
data->useDrawTexture = SDL_FALSE;
|
||||
}
|
||||
+#ifdef ANDROID
|
||||
+ data->GL_OES_draw_texture_supported = SDL_TRUE;
|
||||
+ data->useDrawTexture = SDL_TRUE;
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
|
||||
@@ -337,14 +360,27 @@
|
||||
if (SDL_GL_MakeCurrent(window, data->context) < 0) {
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
+ /* Set up parameters for rendering */
|
||||
+ data->blendMode = -1;
|
||||
+ data->glDisable(GL_DEPTH_TEST);
|
||||
+ data->glDisable(GL_CULL_FACE);
|
||||
+ data->updateSize = SDL_TRUE;
|
||||
+
|
||||
if (data->updateSize) {
|
||||
data->glMatrixMode(GL_PROJECTION);
|
||||
data->glLoadIdentity();
|
||||
data->glMatrixMode(GL_MODELVIEW);
|
||||
data->glLoadIdentity();
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ data->glViewport(0, 0, window->display->desktop_mode.w, window->display->desktop_mode.h);
|
||||
+ data->glOrthof(0.0, (GLfloat) window->display->desktop_mode.w, (GLfloat) window->display->desktop_mode.h,
|
||||
+ 0.0, 0.0, 1.0);
|
||||
+#else
|
||||
data->glViewport(0, 0, window->w, window->h);
|
||||
- data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0,
|
||||
- 0.0, 1.0);
|
||||
+ data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h,
|
||||
+ 0.0, 0.0, 1.0);
|
||||
+#endif
|
||||
data->updateSize = SDL_FALSE;
|
||||
}
|
||||
return 0;
|
||||
@@ -388,6 +424,7 @@
|
||||
break;
|
||||
case SDL_PIXELFORMAT_BGR888:
|
||||
case SDL_PIXELFORMAT_ABGR8888:
|
||||
+ case SDL_PIXELFORMAT_RGBA8888:
|
||||
internalFormat = GL_RGBA;
|
||||
format = GL_RGBA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
@@ -419,7 +456,8 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING)
|
||||
+ {
|
||||
data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
|
||||
data->pixels = SDL_malloc(texture->h * data->pitch);
|
||||
if (!data->pixels) {
|
||||
@@ -441,6 +479,11 @@
|
||||
texture_h = power_of_2(texture->h);
|
||||
data->texw = (GLfloat) texture->w / texture_w;
|
||||
data->texh = (GLfloat) texture->h / texture_h;
|
||||
+ if( renderer->info.max_texture_width < texture_w || renderer->info.max_texture_height < texture_h )
|
||||
+ __android_log_print(ANDROID_LOG_WARN, "libSDL", "GLES: Allocated texture of size %dx%d which is bigger than largest possible device texture %dx%d",
|
||||
+ texture_w, texture_h, renderer->info.max_texture_width, renderer->info.max_texture_height );
|
||||
+ else if( texture_w > 1024 || texture_h > 1024 )
|
||||
+ __android_log_print(ANDROID_LOG_WARN, "libSDL", "GLES: Allocated texture of size %dx%d which is bigger than 1024x1024 - this code will not work on HTC G1", texture_w, texture_h );
|
||||
|
||||
data->format = format;
|
||||
data->formattype = type;
|
||||
@@ -557,13 +600,36 @@
|
||||
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
|
||||
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
|
||||
GLenum result;
|
||||
+ int bpp = SDL_BYTESPERPIXEL(texture->format);
|
||||
+ void * temp_buffer;
|
||||
+ void * temp_ptr;
|
||||
+ int i;
|
||||
|
||||
renderdata->glGetError();
|
||||
renderdata->glEnable(data->type);
|
||||
SetupTextureUpdate(renderdata, texture, pitch);
|
||||
+
|
||||
+ if( rect->w * bpp == pitch ) {
|
||||
+ temp_buffer = (void *)pixels; /* No need to reformat */
|
||||
+ } else {
|
||||
+ /* Reformatting of mem area required */
|
||||
+ temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
|
||||
+ temp_ptr = temp_buffer;
|
||||
+ for (i = 0; i < rect->h; i++) {
|
||||
+ SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
|
||||
+ temp_ptr += rect->w * bpp;
|
||||
+ pixels += pitch;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
|
||||
rect->h, data->format, data->formattype,
|
||||
- pixels);
|
||||
+ temp_buffer);
|
||||
+
|
||||
+ if( temp_buffer != pixels ) {
|
||||
+ SDL_free(temp_buffer);
|
||||
+ }
|
||||
+
|
||||
renderdata->glDisable(data->type);
|
||||
result = renderdata->glGetError();
|
||||
if (result != GL_NO_ERROR) {
|
||||
@@ -887,7 +953,13 @@
|
||||
cropRect[3] = -srcrect->h;
|
||||
data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
|
||||
cropRect);
|
||||
- data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h,
|
||||
+ //__android_log_print(ANDROID_LOG_INFO, "libSDL", "GLES_RenderCopy glDrawTexiOES(%d, %d, %d, %d) cropRect %d:%d:%d:%d", dstrect->x, window->display->desktop_mode.h - dstrect->y - dstrect->h, dstrect->w, dstrect->h, cropRect[0], cropRect[1], cropRect[2], cropRect[3]);
|
||||
+ data->glDrawTexiOES(dstrect->x,
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ window->display->desktop_mode.h - dstrect->y - dstrect->h,
|
||||
+#else
|
||||
+ window->h - dstrect->y - dstrect->h,
|
||||
+#endif
|
||||
0, dstrect->w, dstrect->h);
|
||||
} else {
|
||||
|
||||
330
project/jni/sdl-1.3/src/SDL_video.c.diff
Normal file
330
project/jni/sdl-1.3/src/SDL_video.c.diff
Normal file
@@ -0,0 +1,330 @@
|
||||
These are changes of my Android SDL port over the official SDL port, at the last point where I've synced them
|
||||
TODO: merge this
|
||||
|
||||
--- SDL_video.c 2011-12-05 14:18:19.537975981 +0200
|
||||
+++ /home/pelya/src/endless_space/SDL-android/project/jni/sdl-1.3/src/video/SDL_video.c 2011-12-05 14:20:10.817974963 +0200
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "SDL_renderer_sw.h"
|
||||
#include "../events/SDL_sysevents.h"
|
||||
#include "../events/SDL_events_c.h"
|
||||
+#ifdef ANDROID
|
||||
+#include <android/log.h>
|
||||
+#endif
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WIN32
|
||||
#include "win32/SDL_win32video.h"
|
||||
@@ -98,15 +101,15 @@
|
||||
#if SDL_VIDEO_DRIVER_UIKIT
|
||||
&UIKIT_bootstrap,
|
||||
#endif
|
||||
+#if SDL_VIDEO_DRIVER_ANDROID
|
||||
+ &ANDROID_bootstrap,
|
||||
+#endif
|
||||
#if SDL_VIDEO_DRIVER_DUMMY
|
||||
&DUMMY_bootstrap,
|
||||
#endif
|
||||
#if SDL_VIDEO_DRIVER_PANDORA
|
||||
&PND_bootstrap,
|
||||
#endif
|
||||
-#if SDL_VIDEO_DRIVER_ANDROID
|
||||
- &Android_bootstrap,
|
||||
-#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -2396,6 +2399,36 @@
|
||||
return renderer->RenderClear(renderer);
|
||||
}
|
||||
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+
|
||||
+static inline void
|
||||
+SDL_RESIZE_resizePoints(int realW, int fakeW, int realH, int fakeH,
|
||||
+ const SDL_Point * src, SDL_Point * dest, int count )
|
||||
+{
|
||||
+ int i;
|
||||
+ for( i = 0; i < count; i++ ) {
|
||||
+ dest[i].x = src[i].x * realW / fakeW;
|
||||
+ dest[i].y = src[i].y * realH / fakeH;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+SDL_RESIZE_resizeRects(int realW, int fakeW, int realH, int fakeH,
|
||||
+ const SDL_Rect ** src, SDL_Rect * dest, int count )
|
||||
+{
|
||||
+ int i;
|
||||
+ for( i = 0; i < count; i++ ) {
|
||||
+ // Calculate bottom-right corner instead of width/height, and substract upper-left corner,
|
||||
+ // otherwise we'll have rounding errors and holes between textures
|
||||
+ dest[i].x = src[i]->x * realW / fakeW;
|
||||
+ dest[i].y = src[i]->y * realH / fakeH;
|
||||
+ dest[i].w = (src[i]->w + src[i]->x) * realW / fakeW - dest[i].x;
|
||||
+ dest[i].h = (src[i]->h + src[i]->y) * realH / fakeH - dest[i].y;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
SDL_RenderDrawPoint(int x, int y)
|
||||
{
|
||||
@@ -2403,6 +2436,7 @@
|
||||
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
+
|
||||
return SDL_RenderDrawPoints(&point, 1);
|
||||
}
|
||||
|
||||
@@ -2410,6 +2444,9 @@
|
||||
SDL_RenderDrawPoints(const SDL_Point * points, int count)
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ int realW, realH, fakeW, fakeH, ret;
|
||||
+#endif
|
||||
|
||||
if (!points) {
|
||||
SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points");
|
||||
@@ -2427,6 +2464,26 @@
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ realW = renderer->window->display->desktop_mode.w;
|
||||
+ realH = renderer->window->display->desktop_mode.h;
|
||||
+ fakeW = renderer->window->w;
|
||||
+ fakeH = renderer->window->h;
|
||||
+ //if( fakeW > realW || fakeH > realH )
|
||||
+ {
|
||||
+ SDL_Point * resized = SDL_stack_alloc( SDL_Point, count );
|
||||
+ if( ! resized ) {
|
||||
+ SDL_OutOfMemory();
|
||||
+ return -1;
|
||||
+ }
|
||||
+ SDL_RESIZE_resizePoints( realW, fakeW, realH, fakeH, points, resized, count );
|
||||
+ ret = renderer->RenderDrawPoints(renderer, resized, count);
|
||||
+ SDL_stack_free(resized);
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return renderer->RenderDrawPoints(renderer, points, count);
|
||||
}
|
||||
|
||||
@@ -2446,6 +2503,9 @@
|
||||
SDL_RenderDrawLines(const SDL_Point * points, int count)
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ int realW, realH, fakeW, fakeH, ret;
|
||||
+#endif
|
||||
|
||||
if (!points) {
|
||||
SDL_SetError("SDL_RenderDrawLines(): Passed NULL points");
|
||||
@@ -2463,6 +2523,26 @@
|
||||
if (count < 2) {
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ realW = renderer->window->display->desktop_mode.w;
|
||||
+ realH = renderer->window->display->desktop_mode.h;
|
||||
+ fakeW = renderer->window->w;
|
||||
+ fakeH = renderer->window->h;
|
||||
+ //if( fakeW > realW || fakeH > realH )
|
||||
+ {
|
||||
+ SDL_Point * resized = SDL_stack_alloc( SDL_Point, count );
|
||||
+ if( ! resized ) {
|
||||
+ SDL_OutOfMemory();
|
||||
+ return -1;
|
||||
+ }
|
||||
+ SDL_RESIZE_resizePoints( realW, fakeW, realH, fakeH, points, resized, count );
|
||||
+ ret = renderer->RenderDrawLines(renderer, resized, count);
|
||||
+ SDL_stack_free(resized);
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return renderer->RenderDrawLines(renderer, points, count);
|
||||
}
|
||||
|
||||
@@ -2477,6 +2557,9 @@
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
int i;
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ int realW, realH, fakeW, fakeH, ret;
|
||||
+#endif
|
||||
|
||||
if (!rects) {
|
||||
SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects");
|
||||
@@ -2509,6 +2592,37 @@
|
||||
return renderer->RenderDrawRects(renderer, &rect, 1);
|
||||
}
|
||||
}
|
||||
+
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ realW = renderer->window->display->desktop_mode.w;
|
||||
+ realH = renderer->window->display->desktop_mode.h;
|
||||
+ fakeW = renderer->window->w;
|
||||
+ fakeH = renderer->window->h;
|
||||
+ //if( fakeW > realW || fakeH > realH )
|
||||
+ {
|
||||
+ SDL_Rect * resized = SDL_stack_alloc( SDL_Rect, count );
|
||||
+ if( ! resized ) {
|
||||
+ SDL_OutOfMemory();
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ const SDL_Rect ** resizedPtrs = SDL_stack_alloc( const SDL_Rect *, count );
|
||||
+ if( ! resizedPtrs ) {
|
||||
+ SDL_OutOfMemory();
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for( i = 0; i < count; i++ ) {
|
||||
+ resizedPtrs[i] = &(resized[i]);
|
||||
+ }
|
||||
+ SDL_RESIZE_resizeRects( realW, fakeW, realH, fakeH, rects, resized, count );
|
||||
+ ret = renderer->RenderDrawRects(renderer, resizedPtrs, count);
|
||||
+ SDL_stack_free(resizedPtrs);
|
||||
+ SDL_stack_free(resized);
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return renderer->RenderDrawRects(renderer, rects, count);
|
||||
}
|
||||
|
||||
@@ -2523,6 +2637,9 @@
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
int i;
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ int realW, realH, fakeW, fakeH, ret;
|
||||
+#endif
|
||||
|
||||
if (!rects) {
|
||||
SDL_SetError("SDL_RenderFillRects(): Passed NULL rects");
|
||||
@@ -2555,6 +2672,37 @@
|
||||
return renderer->RenderFillRects(renderer, &rect, 1);
|
||||
}
|
||||
}
|
||||
+
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ realW = renderer->window->display->desktop_mode.w;
|
||||
+ realH = renderer->window->display->desktop_mode.h;
|
||||
+ fakeW = renderer->window->w;
|
||||
+ fakeH = renderer->window->h;
|
||||
+ //if( fakeW > realW || fakeH > realH )
|
||||
+ {
|
||||
+ SDL_Rect * resized = SDL_stack_alloc( SDL_Rect, count );
|
||||
+ if( ! resized ) {
|
||||
+ SDL_OutOfMemory();
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ const SDL_Rect ** resizedPtrs = SDL_stack_alloc( const SDL_Rect *, count );
|
||||
+ if( ! resizedPtrs ) {
|
||||
+ SDL_OutOfMemory();
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for( i = 0; i < count; i++ ) {
|
||||
+ resizedPtrs[i] = &(resized[i]);
|
||||
+ }
|
||||
+ SDL_RESIZE_resizeRects( realW, fakeW, realH, fakeH, rects, resized, count );
|
||||
+ ret = renderer->RenderFillRects(renderer, resizedPtrs, count);
|
||||
+ SDL_stack_free(resizedPtrs);
|
||||
+ SDL_stack_free(resized);
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return renderer->RenderFillRects(renderer, rects, count);
|
||||
}
|
||||
|
||||
@@ -2566,6 +2714,12 @@
|
||||
SDL_Window *window;
|
||||
SDL_Rect real_srcrect;
|
||||
SDL_Rect real_dstrect;
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ int realW;
|
||||
+ int realH;
|
||||
+ int fakeW;
|
||||
+ int fakeH;
|
||||
+#endif
|
||||
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
@@ -2616,6 +2770,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#if SDL_VIDEO_RENDER_RESIZE
|
||||
+ realW = window->display->desktop_mode.w;
|
||||
+ realH = window->display->desktop_mode.h;
|
||||
+ fakeW = window->w;
|
||||
+ fakeH = window->h;
|
||||
+ //if( fakeW > realW || fakeH > realH )
|
||||
+ {
|
||||
+ // Calculate bottom-right corner instead of width/height, and substract upper-left corner,
|
||||
+ // otherwise we'll have rounding errors and holes between textures
|
||||
+ real_dstrect.w = (real_dstrect.w + real_dstrect.x) * realW / fakeW;
|
||||
+ real_dstrect.h = (real_dstrect.h + real_dstrect.y) * realH / fakeH;
|
||||
+ real_dstrect.x = real_dstrect.x * realW / fakeW;
|
||||
+ real_dstrect.y = real_dstrect.y * realH / fakeH;
|
||||
+ real_dstrect.w -= real_dstrect.x;
|
||||
+ real_dstrect.h -= real_dstrect.y;
|
||||
+ //__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_RenderCopy dest %d:%d+%d+%d desktop_mode %d:%d", (int)real_dstrect.x, (int)real_dstrect.y, (int)real_dstrect.w, (int)real_dstrect.h, (int)realW, (int)realH);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return renderer->RenderCopy(renderer, texture, &real_srcrect,
|
||||
&real_dstrect);
|
||||
}
|
||||
@@ -3458,4 +3631,41 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef ANDROID
|
||||
+void SDL_ANDROID_VideoContextLost()
|
||||
+{
|
||||
+ SDL_Texture * tex;
|
||||
+ if( ! SDL_CurrentDisplay || ! SDL_CurrentRenderer || ! SDL_CurrentRenderer->window || ! SDL_CurrentRenderer->textures || SDL_GetWindowFlags(SDL_CurrentRenderer->window) & SDL_WINDOW_OPENGL )
|
||||
+ return;
|
||||
+
|
||||
+ tex = SDL_CurrentRenderer->textures;
|
||||
+ while( tex )
|
||||
+ {
|
||||
+ SDL_CurrentRenderer->DestroyTexture( SDL_CurrentRenderer, tex );
|
||||
+ tex = tex->next;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void SDL_ANDROID_VideoContextRecreated()
|
||||
+{
|
||||
+ int numTextures = 0;
|
||||
+ SDL_Texture * tex;
|
||||
+ __android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_ANDROID_VideoContextRecreated(): SDL_CurrentRenderer %p", SDL_CurrentRenderer);
|
||||
+ if( ! SDL_CurrentRenderer )
|
||||
+ return;
|
||||
+
|
||||
+ if( SDL_CurrentRenderer->ActivateRenderer ) /* Re-apply glOrtho() and blend modes */
|
||||
+ SDL_CurrentRenderer->ActivateRenderer(SDL_CurrentRenderer);
|
||||
+
|
||||
+ tex = SDL_CurrentRenderer->textures;
|
||||
+ while( tex )
|
||||
+ {
|
||||
+ SDL_CurrentRenderer->CreateTexture( SDL_CurrentRenderer, tex );
|
||||
+ tex = tex->next;
|
||||
+ numTextures++;
|
||||
+ }
|
||||
+ __android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_ANDROID_VideoContextRecreated(): re-created %d textures", numTextures);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
102
project/jni/sdl-1.3/src/atomic/SDL_atomic.c
Normal file
102
project/jni/sdl-1.3/src/atomic/SDL_atomic.c
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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.
|
||||
*/
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "SDL_atomic.h"
|
||||
|
||||
/* Note that we undefine the atomic operations here, in case they are
|
||||
defined as compiler intrinsics while building SDL but the library user
|
||||
doesn't have that compiler. That way we always have a working set of
|
||||
atomic operations built into the library.
|
||||
*/
|
||||
|
||||
/*
|
||||
If any of the operations are not provided then we must emulate some
|
||||
of them. That means we need a nice implementation of spin locks
|
||||
that avoids the "one big lock" problem. We use a vector of spin
|
||||
locks and pick which one to use based on the address of the operand
|
||||
of the function.
|
||||
|
||||
To generate the index of the lock we first shift by 3 bits to get
|
||||
rid on the zero bits that result from 32 and 64 bit allignment of
|
||||
data. We then mask off all but 5 bits and use those 5 bits as an
|
||||
index into the table.
|
||||
|
||||
Picking the lock this way insures that accesses to the same data at
|
||||
the same time will go to the same lock. OTOH, accesses to different
|
||||
data have only a 1/32 chance of hitting the same lock. That should
|
||||
pretty much eliminate the chances of several atomic operations on
|
||||
different data from waiting on the same "big lock". If it isn't
|
||||
then the table of locks can be expanded to a new size so long as
|
||||
the new size is a power of two.
|
||||
|
||||
Contributed by Bob Pendleton, bob@pendleton.com
|
||||
*/
|
||||
|
||||
static SDL_SpinLock locks[32];
|
||||
|
||||
static __inline__ void
|
||||
enterLock(void *a)
|
||||
{
|
||||
uintptr_t index = ((((uintptr_t)a) >> 3) & 0x1f);
|
||||
|
||||
SDL_AtomicLock(&locks[index]);
|
||||
}
|
||||
|
||||
static __inline__ void
|
||||
leaveLock(void *a)
|
||||
{
|
||||
uintptr_t index = ((((uintptr_t)a) >> 3) & 0x1f);
|
||||
|
||||
SDL_AtomicUnlock(&locks[index]);
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
enterLock(a);
|
||||
if (a->value == oldval) {
|
||||
a->value = newval;
|
||||
retval = SDL_TRUE;
|
||||
}
|
||||
leaveLock(a);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_AtomicCASPtr_(void **a, void *oldval, void *newval)
|
||||
{
|
||||
SDL_bool retval = SDL_FALSE;
|
||||
|
||||
enterLock(a);
|
||||
if (*a == oldval) {
|
||||
*a = newval;
|
||||
retval = SDL_TRUE;
|
||||
}
|
||||
leaveLock(a);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
126
project/jni/sdl-1.3/src/atomic/SDL_spinlock.c
Normal file
126
project/jni/sdl-1.3/src/atomic/SDL_spinlock.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2011 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.
|
||||
*/
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "SDL_atomic.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_timer.h"
|
||||
|
||||
/* Don't do the check for Visual Studio 2005, it's safe here */
|
||||
#ifdef __WIN32__
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
#endif
|
||||
|
||||
/* This function is where all the magic happens... */
|
||||
SDL_bool
|
||||
SDL_AtomicTryLock(SDL_SpinLock *lock)
|
||||
{
|
||||
#if SDL_ATOMIC_DISABLED
|
||||
/* Terrible terrible damage */
|
||||
static SDL_mutex *_spinlock_mutex;
|
||||
|
||||
if (!_spinlock_mutex) {
|
||||
/* Race condition on first lock... */
|
||||
_spinlock_mutex = SDL_CreateMutex();
|
||||
}
|
||||
SDL_mutexP(_spinlock_mutex);
|
||||
if (*lock == 0) {
|
||||
*lock = 1;
|
||||
SDL_mutexV(_spinlock_mutex);
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
SDL_mutexV(_spinlock_mutex);
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long));
|
||||
return (InterlockedExchange((long*)lock, 1) == 0);
|
||||
|
||||
#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
|
||||
return (__sync_lock_test_and_set(lock, 1) == 0);
|
||||
|
||||
#elif defined(__GNUC__) && defined(__arm__) && \
|
||||
(defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
|
||||
defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
|
||||
defined(__ARM_ARCH_5TEJ__))
|
||||
int result;
|
||||
__asm__ __volatile__ (
|
||||
"swp %0, %1, [%2]\n"
|
||||
: "=&r,&r" (result) : "r,0" (1), "r,r" (lock) : "memory");
|
||||
return (result == 0);
|
||||
|
||||
#elif defined(__GNUC__) && defined(__arm__)
|
||||
int result;
|
||||
__asm__ __volatile__ (
|
||||
"ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
|
||||
: "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
|
||||
return (result == 0);
|
||||
|
||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
int result;
|
||||
__asm__ __volatile__(
|
||||
"lock ; xchgl %0, (%1)\n"
|
||||
: "=r" (result) : "r" (lock), "0" (1) : "cc", "memory");
|
||||
return (result == 0);
|
||||
|
||||
#elif defined(__MACOSX__) || defined(__IPHONEOS__)
|
||||
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
|
||||
return OSAtomicCompareAndSwap32Barrier(0, 1, lock);
|
||||
|
||||
#elif HAVE_PTHREAD_SPINLOCK
|
||||
/* pthread instructions */
|
||||
return (pthread_spin_trylock(lock) == 0);
|
||||
|
||||
#else
|
||||
#error Please implement for your platform.
|
||||
return SDL_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
SDL_AtomicLock(SDL_SpinLock *lock)
|
||||
{
|
||||
/* FIXME: Should we have an eventual timeout? */
|
||||
while (!SDL_AtomicTryLock(lock)) {
|
||||
SDL_Delay(0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SDL_AtomicUnlock(SDL_SpinLock *lock)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
_ReadWriteBarrier();
|
||||
*lock = 0;
|
||||
|
||||
#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET
|
||||
__sync_lock_release(lock);
|
||||
|
||||
#elif HAVE_PTHREAD_SPINLOCK
|
||||
pthread_spin_unlock(lock);
|
||||
|
||||
#else
|
||||
*lock = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 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