Merge branch 'master' into misc/lilium_common

Conflicts:
	Makefile
	code/client/cl_main.c
	code/qcommon/common.c
	code/qcommon/q_shared.h
	code/sys/sys_unix.c
This commit is contained in:
Zack Middleton 2018-03-04 05:08:08 -06:00
commit 51a57b8420
892 changed files with 52735 additions and 57146 deletions

5
.gitignore vendored
View file

@ -2,6 +2,7 @@ build
Makefile.local Makefile.local
*.swp *.swp
*tags *tags
*~
# OS X # OS X
#################### ####################
@ -35,4 +36,6 @@ profile
# Microsoft Visual Studio # Microsoft Visual Studio
#################### ####################
*.sdf *.sdf
*.opensdf
*.suo

View file

@ -1,3 +1,8 @@
# sudo is required for travis-ci to use ubuntu trusty
# ubuntu trusty is required for libsdl2-dev
sudo: required
dist: trusty
language: c language: c
env: env:
@ -9,24 +14,30 @@ env:
- CC=gcc - CC=gcc
- CC=clang - CC=clang
# extra libs # extra libs
- CC=gcc USE_CODEC_VORBIS=1 USE_FREETYPE=1 - CC=gcc USE_FREETYPE=1
- CC=clang USE_CODEC_VORBIS=1 USE_FREETYPE=1 - CC=clang USE_FREETYPE=1
# cross-compile using mingw # cross-compile using mingw
- CC= PLATFORM="mingw32" ARCH="x86" # dlopen curl to workaround link error because mingw-w64 in trusty is missing strtok_r required by libcurl.a
- CC= PLATFORM="mingw32" ARCH="x86_64" - CC= PLATFORM="mingw32" ARCH="x86" USE_CURL_DLOPEN=1
- CC= PLATFORM="mingw32" ARCH="x86_64" USE_CURL_DLOPEN=1
script: ./travis-ci-build.sh script: ./travis-ci-build.sh
before_install:
- echo "yes" | sudo apt-add-repository ppa:zoogie/sdl2-snapshots
- sudo apt-get update -qq
- sudo apt-get remove -qq -y mingw32
- sudo apt-get install -q -y libgl1-mesa-dev libsdl2-dev libfreetype6-dev mingw-w64
notifications: notifications:
email: false email: false
addons: addons:
apt:
packages:
- binutils-mingw-w64-i686
- gcc-mingw-w64-i686
- binutils-mingw-w64-x86-64
- gcc-mingw-w64-x86-64
- gcc-mingw-w64
- mingw-w64
- libgl1-mesa-dev
- libsdl2-dev
- libfreetype6-dev
coverity_scan: coverity_scan:
project: project:
name: "ioquake/ioq3" name: "ioquake/ioq3"
@ -34,4 +45,4 @@ addons:
notification_email: quake3-commits@icculus.org notification_email: quake3-commits@icculus.org
build_command_prepend: "make clean" build_command_prepend: "make clean"
build_command: "make release" build_command: "make release"
branch_pattern: master branch_pattern: coverity_scan

4
BUGS
View file

@ -1,4 +0,0 @@
- On Solaris/SPARC gcc optimizations higher than -O0 currently lead
to a segfault
https://bugzilla.icculus.org/ for more.

View file

@ -634,7 +634,7 @@
#1 current directory #1 current directory
#2 fs_homepath #2 fs_homepath
#3 fs_basepath #3 fs_basepath
this was needed to make mod developement easier this was needed to make mod development easier
2001-10-09 Timothee Besset <ttimo@idsoftware.com> 2001-10-09 Timothee Besset <ttimo@idsoftware.com>
+ https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=51 + https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=51
@ -814,7 +814,7 @@
* rebuilding 1.28b, various fixes on linux build: * rebuilding 1.28b, various fixes on linux build:
- SetProgramPath was renamed to Sys_SetDefaultCDPath in unix_shared.c - SetProgramPath was renamed to Sys_SetDefaultCDPath in unix_shared.c
updated unix_main.c accordingly updated unix_main.c accordingly
- some prototypes in qgl.h are guarded by #ifndef GL_VERSION_1_2 (ARB extentions) - some prototypes in qgl.h are guarded by #ifndef GL_VERSION_1_2 (ARB extensions)
those prototypes are needed by linux_glimp for importing functions and casting, added a #ifdef __linux__ those prototypes are needed by linux_glimp for importing functions and casting, added a #ifdef __linux__
(not a clean solution) (not a clean solution)
- game/q_shared.h - game/q_shared.h
@ -861,7 +861,7 @@
2001-04-23 Timothee Besset <ttimo@idsoftware.com> 2001-04-23 Timothee Besset <ttimo@idsoftware.com>
* cleanup the mod selection code, remove duplicates * cleanup the mod selection code, remove duplicates
* some issues with release builds, my main developement box doesn't build stable binaries with release settings * some issues with release builds, my main development box doesn't build stable binaries with release settings
removing -fomit-frame-pointer seems to fix (there's probably a performance hit) removing -fomit-frame-pointer seems to fix (there's probably a performance hit)
see OMIT-FRAME-POINTER.txt see OMIT-FRAME-POINTER.txt
@ -984,7 +984,7 @@
//* or // /* or variations of this. I reverted to exact mirror //* or // /* or variations of this. I reverted to exact mirror
image of SOS to be sure - short of removing it's too easy to mistake image of SOS to be sure - short of removing it's too easy to mistake
live code for dead one. live code for dead one.
Later: have to change 5 occurences to avoid gcc complaints about Later: have to change 5 occurrences to avoid gcc complaints about
nested comment tokens. nested comment tokens.
TODO: somebody please get rid of the cruft in here. TODO: somebody please get rid of the cruft in here.
@ -1235,7 +1235,7 @@
* code/game/g_cmds.c (G_SayTo): CON_CONNECTED. * code/game/g_cmds.c (G_SayTo): CON_CONNECTED.
* code/game/ai_main.c: HOOK added (SOS). * code/game/ai_main.c: HOOK added (SOS).
* code/botlib/be_aas_move.c (AAS_HorizontalVelocityForJump): * code/botlib/be_aas_move.c (AAS_HorizontalVelocityForJump):
correct fix for FPE occuring (SOS). correct fix for FPE occurring (SOS).
* code/game/ai_dmq3.c: initmove.viewoffset (SOS). * code/game/ai_dmq3.c: initmove.viewoffset (SOS).
* code/game/q_math.c: guard asser/isnan with Q3_VM (q3asm). * code/game/q_math.c: guard asser/isnan with Q3_VM (q3asm).
@ -1679,7 +1679,7 @@
* code/game/q_shared.c: Q_strncpyz does zero padding (duh). * code/game/q_shared.c: Q_strncpyz does zero padding (duh).
Note: calls strncpy, which does a zero fill up to destsize. Note: calls strncpy, which does a zero fill up to destsize.
If destsize exceeds memory size, zero padding will overwrite If destsize exceeds memory size, zero padding will overwrite
adjacent memory. Suspicion was this happend to botimport. adjacent memory. Suspicion was this happened to botimport.
* code/qcommon/cvar.c: possible problem in Q_strncpyz call. * code/qcommon/cvar.c: possible problem in Q_strncpyz call.
@ -1783,7 +1783,7 @@
* TEST: running with RC4 data files. * TEST: running with RC4 data files.
TODO: "bot library used before setup" (Q3+TA) TODO: "bot library used before setup" (Q3+TA)
TODO: Q3 old mods wreak havoc (graceful bounce) TODO: Q3 old mods wreak havoc (graceful bounce)
TODO: supress "FreeType code not available" in renderer TODO: suppress "FreeType code not available" in renderer
TODO: can't move in Q3 TODO: can't move in Q3
TODO: items flicker in Q3 TODO: items flicker in Q3
TODO: no decals in Q3 TODO: no decals in Q3
@ -2015,7 +2015,7 @@
* TEST: tried executing a script - get bounced. * TEST: tried executing a script - get bounced.
TODO: is there any way to jump into a map? TODO: is there any way to jump into a map?
TODO: cl_cinematics 0 (supress all fullscreen RoQ) TODO: cl_cinematics 0 (suppress all fullscreen RoQ)
Next: used r_logfile 200 in Win32 (RC4) and Linux. Next: used r_logfile 200 in Win32 (RC4) and Linux.
There is a buckload of setup code seemingly not done There is a buckload of setup code seemingly not done
at all in Linux? Either that, or logging is enabled at all in Linux? Either that, or logging is enabled
@ -2983,7 +2983,7 @@
Modules: Modules:
code: the Q3 engine code, including a jpeg-6/ copy code: the Q3 engine code, including a jpeg-6/ copy
common: code shared by tools common: code shared by tools
libs: code shared by tools, inlcuding a jpeg6/ copy libs: code shared by tools, including a jpeg6/ copy
q3asm: VM bytecode assembly q3asm: VM bytecode assembly
q3data: misc. Q3 data conversions q3data: misc. Q3 data conversions
q3map: BSP builder q3map: BSP builder

401
Makefile
View file

@ -3,18 +3,12 @@
# #
# GNU Make required # GNU Make required
# #
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')
COMPILE_PLATFORM=$(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]'|sed -e 's/\//_/g') COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/ | sed -e 's/^arm.*/arm/')
ifeq ($(COMPILE_PLATFORM),sunos) ifeq ($(COMPILE_PLATFORM),sunos)
# Solaris uname and GNU uname differ # Solaris uname and GNU uname differ
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/) COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/')
endif
ifeq ($(COMPILE_PLATFORM),darwin)
# Apple does some things a little differently...
COMPILE_ARCH=$(shell uname -p | sed -e s/i.86/x86/)
endif endif
ifndef BUILD_STANDALONE ifndef BUILD_STANDALONE
@ -44,6 +38,9 @@ endif
ifndef BUILD_FINAL ifndef BUILD_FINAL
BUILD_FINAL =0 BUILD_FINAL =0
endif endif
ifndef BUILD_AUTOUPDATER # DON'T build unless you mean to!
BUILD_AUTOUPDATER=0
endif
############################################################################# #############################################################################
# #
@ -186,7 +183,7 @@ ifndef USE_CURL_DLOPEN
endif endif
ifndef USE_CODEC_VORBIS ifndef USE_CODEC_VORBIS
USE_CODEC_VORBIS=0 USE_CODEC_VORBIS=1
endif endif
ifndef USE_CODEC_OPUS ifndef USE_CODEC_OPUS
@ -209,10 +206,6 @@ ifndef USE_INTERNAL_LIBS
USE_INTERNAL_LIBS=1 USE_INTERNAL_LIBS=1
endif endif
ifndef USE_INTERNAL_SPEEX
USE_INTERNAL_SPEEX=$(USE_INTERNAL_LIBS)
endif
ifndef USE_INTERNAL_OGG ifndef USE_INTERNAL_OGG
USE_INTERNAL_OGG=$(USE_INTERNAL_LIBS) USE_INTERNAL_OGG=$(USE_INTERNAL_LIBS)
endif endif
@ -241,8 +234,16 @@ ifndef USE_RENDERER_DLOPEN
USE_RENDERER_DLOPEN=1 USE_RENDERER_DLOPEN=1
endif endif
ifndef USE_YACC
USE_YACC=0
endif
ifndef USE_AUTOUPDATER # DON'T include unless you mean to!
USE_AUTOUPDATER=0
endif
ifndef DEBUG_CFLAGS ifndef DEBUG_CFLAGS
DEBUG_CFLAGS=-g -O0 DEBUG_CFLAGS=-ggdb -O0
endif endif
############################################################################# #############################################################################
@ -265,17 +266,19 @@ NDIR=$(MOUNT_DIR)/null
UIDIR=$(MOUNT_DIR)/ui UIDIR=$(MOUNT_DIR)/ui
Q3UIDIR=$(MOUNT_DIR)/q3_ui Q3UIDIR=$(MOUNT_DIR)/q3_ui
JPDIR=$(MOUNT_DIR)/jpeg-8c JPDIR=$(MOUNT_DIR)/jpeg-8c
SPEEXDIR=$(MOUNT_DIR)/libspeex OGGDIR=$(MOUNT_DIR)/libogg-1.3.2
OGGDIR=$(MOUNT_DIR)/libogg-1.3.1 VORBISDIR=$(MOUNT_DIR)/libvorbis-1.3.5
VORBISDIR=$(MOUNT_DIR)/libvorbis-1.3.4 OPUSDIR=$(MOUNT_DIR)/opus-1.1.4
OPUSDIR=$(MOUNT_DIR)/opus-1.1 OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.8
OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.5
ZDIR=$(MOUNT_DIR)/zlib ZDIR=$(MOUNT_DIR)/zlib
Q3ASMDIR=$(MOUNT_DIR)/tools/asm Q3ASMDIR=$(MOUNT_DIR)/tools/asm
LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg
Q3CPPDIR=$(MOUNT_DIR)/tools/lcc/cpp Q3CPPDIR=$(MOUNT_DIR)/tools/lcc/cpp
Q3LCCETCDIR=$(MOUNT_DIR)/tools/lcc/etc Q3LCCETCDIR=$(MOUNT_DIR)/tools/lcc/etc
Q3LCCSRCDIR=$(MOUNT_DIR)/tools/lcc/src Q3LCCSRCDIR=$(MOUNT_DIR)/tools/lcc/src
AUTOUPDATERSRCDIR=$(MOUNT_DIR)/autoupdater
LIBTOMCRYPTSRCDIR=$(AUTOUPDATERSRCDIR)/rsa_tools/libtomcrypt-1.17
TOMSFASTMATHSRCDIR=$(AUTOUPDATERSRCDIR)/rsa_tools/tomsfastmath-0.13.1
LOKISETUPDIR=misc/setup LOKISETUPDIR=misc/setup
NSISDIR=misc/nsis NSISDIR=misc/nsis
SDLHDIR=$(MOUNT_DIR)/SDL2 SDLHDIR=$(MOUNT_DIR)/SDL2
@ -283,29 +286,30 @@ LIBSDIR=$(MOUNT_DIR)/libs
bin_path=$(shell which $(1) 2> /dev/null) bin_path=$(shell which $(1) 2> /dev/null)
# The autoupdater uses curl, so figure out its flags no matter what.
# We won't need this if we only build the server # We won't need this if we only build the server
ifneq ($(BUILD_CLIENT),0)
# set PKG_CONFIG_PATH to influence this, e.g. # set PKG_CONFIG_PATH to influence this, e.g.
# PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig # PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig
ifneq ($(call bin_path, pkg-config),) ifneq ($(call bin_path, pkg-config),)
CURL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libcurl) CURL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags libcurl)
CURL_LIBS ?= $(shell pkg-config --silence-errors --libs libcurl) CURL_LIBS ?= $(shell pkg-config --silence-errors --libs libcurl)
OPENAL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags openal) OPENAL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags openal)
OPENAL_LIBS ?= $(shell pkg-config --silence-errors --libs openal) OPENAL_LIBS ?= $(shell pkg-config --silence-errors --libs openal)
SDL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//') SDL_CFLAGS ?= $(shell pkg-config --silence-errors --cflags sdl2|sed 's/-Dmain=SDL_main//')
SDL_LIBS ?= $(shell pkg-config --silence-errors --libs sdl2) SDL_LIBS ?= $(shell pkg-config --silence-errors --libs sdl2)
FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2) FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2)
else else
# assume they're in the system default paths (no -I or -L needed) # assume they're in the system default paths (no -I or -L needed)
CURL_LIBS ?= -lcurl CURL_LIBS ?= -lcurl
OPENAL_LIBS ?= -lopenal OPENAL_LIBS ?= -lopenal
endif endif
# Use sdl2-config if all else fails
ifeq ($(SDL_CFLAGS),) # Use sdl2-config if all else fails
ifneq ($(call bin_path, sdl2-config),) ifeq ($(SDL_CFLAGS),)
SDL_CFLAGS ?= $(shell sdl2-config --cflags) ifneq ($(call bin_path, sdl2-config),)
SDL_LIBS ?= $(shell sdl2-config --libs) SDL_CFLAGS = $(shell sdl2-config --cflags)
endif SDL_LIBS = $(shell sdl2-config --libs)
endif endif
endif endif
@ -329,7 +333,7 @@ endif
############################################################################# #############################################################################
INSTALL=install INSTALL=install
MKDIR=mkdir MKDIR=mkdir -p
EXTRA_FILES= EXTRA_FILES=
CLIENT_EXTRA_FILES= CLIENT_EXTRA_FILES=
@ -368,6 +372,9 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")
OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus
HAVE_VM_COMPILED=true HAVE_VM_COMPILED=true
endif endif
ifeq ($(ARCH),armv7l)
HAVE_VM_COMPILED=true
endif
ifeq ($(ARCH),alpha) ifeq ($(ARCH),alpha)
# According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555 # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555
# -ffast-math will cause the client to die with SIGFPE on Alpha # -ffast-math will cause the client to die with SIGFPE on Alpha
@ -382,9 +389,10 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")
THREAD_LIBS=-lpthread THREAD_LIBS=-lpthread
LIBS=-ldl -lm LIBS=-ldl -lm
AUTOUPDATER_LIBS += -ldl
CLIENT_LIBS=$(SDL_LIBS) CLIENT_LIBS=$(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS) -lGL RENDERER_LIBS = $(SDL_LIBS)
ifeq ($(USE_PORTABLE_RPATH),1) ifeq ($(USE_PORTABLE_RPATH),1)
# $ is escaped using two, so this is litterly $ORIGIN # $ is escaped using two, so this is litterly $ORIGIN
@ -428,14 +436,29 @@ ifeq ($(PLATFORM),darwin)
LIBS = -framework Cocoa LIBS = -framework Cocoa
CLIENT_LIBS= CLIENT_LIBS=
RENDERER_LIBS= RENDERER_LIBS=
OPTIMIZEVM= OPTIMIZEVM = -O3
BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes -mmacosx-version-min=10.5 \ # Default minimum Mac OS X version
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 ifeq ($(MACOSX_VERSION_MIN),)
MACOSX_VERSION_MIN=10.7
endif
MACOSX_MAJOR=$(shell echo $(MACOSX_VERSION_MIN) | cut -d. -f1)
MACOSX_MINOR=$(shell echo $(MACOSX_VERSION_MIN) | cut -d. -f2)
ifeq ($(shell test $(MACOSX_MINOR) -gt 9; echo $$?),0)
# Multiply and then remove decimal. 10.10 -> 101000.0 -> 101000
MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo "$(MACOSX_MAJOR) * 10000 + $(MACOSX_MINOR) * 100" | bc | cut -d. -f1)
else
# Multiply by 100 and then remove decimal. 10.7 -> 1070.0 -> 1070
MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo "$(MACOSX_VERSION_MIN) * 100" | bc | cut -d. -f1)
endif
LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
BASE_CFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) \
-DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED)
ifeq ($(ARCH),ppc) ifeq ($(ARCH),ppc)
BASE_CFLAGS += -arch ppc -faltivec BASE_CFLAGS += -arch ppc -faltivec
OPTIMIZEVM += -O3
endif endif
ifeq ($(ARCH),ppc64) ifeq ($(ARCH),ppc64)
BASE_CFLAGS += -arch ppc64 -faltivec BASE_CFLAGS += -arch ppc64 -faltivec
@ -447,7 +470,8 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -arch i386 -m32 -mstackrealign BASE_CFLAGS += -arch i386 -m32 -mstackrealign
endif endif
ifeq ($(ARCH),x86_64) ifeq ($(ARCH),x86_64)
OPTIMIZEVM += -arch x86_64 -mfpmath=sse OPTIMIZEVM += -mfpmath=sse
BASE_CFLAGS += -arch x86_64
endif endif
# When compiling on OSX for OSX, we're not cross compiling as far as the # When compiling on OSX for OSX, we're not cross compiling as far as the
@ -469,11 +493,9 @@ ifeq ($(PLATFORM),darwin)
$(error Architecture $(ARCH) is not supported when cross compiling) $(error Architecture $(ARCH) is not supported when cross compiling)
endif endif
endif endif
else
TOOLS_CFLAGS += -DMACOS_X
endif endif
BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1) ifneq ($(USE_OPENAL_DLOPEN),1)
@ -490,6 +512,9 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -D_THREAD_SAFE=1 BASE_CFLAGS += -D_THREAD_SAFE=1
# FIXME: It is not possible to build using system SDL2 framework
# 1. IF you try, this Makefile will still drop libSDL-2.0.0.dylib into the builddir
# 2. Debugger warns that you have 2- which one will be used is undefined
ifeq ($(USE_LOCAL_HEADERS),1) ifeq ($(USE_LOCAL_HEADERS),1)
BASE_CFLAGS += -I$(SDLHDIR)/include BASE_CFLAGS += -I$(SDLHDIR)/include
endif endif
@ -529,20 +554,20 @@ ifdef MINGW
# We need to figure out the correct gcc and windres # We need to figure out the correct gcc and windres
ifeq ($(ARCH),x86_64) ifeq ($(ARCH),x86_64)
MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32 MINGW_PREFIXES=x86_64-w64-mingw32 amd64-mingw32msvc
endif endif
ifeq ($(ARCH),x86) ifeq ($(ARCH),x86)
MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32 i686-pc-mingw32 MINGW_PREFIXES=i686-w64-mingw32 i586-mingw32msvc i686-pc-mingw32
endif endif
ifndef CC ifndef CC
CC=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \ CC=$(firstword $(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
$(call bin_path, $(MINGW_PREFIX)-gcc))) $(call bin_path, $(MINGW_PREFIX)-gcc))))
endif endif
ifndef WINDRES ifndef WINDRES
WINDRES=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \ WINDRES=$(firstword $(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
$(call bin_path, $(MINGW_PREFIX)-windres))) $(call bin_path, $(MINGW_PREFIX)-windres))))
endif endif
else else
# Some MinGW installations define CC to cc, but don't actually provide cc, # Some MinGW installations define CC to cc, but don't actually provide cc,
@ -551,9 +576,11 @@ ifdef MINGW
CC=gcc CC=gcc
endif endif
ifndef WINDRES endif
WINDRES=windres
endif # using generic windres if specific one is not present
ifndef WINDRES
WINDRES=windres
endif endif
ifeq ($(CC),) ifeq ($(CC),)
@ -602,12 +629,14 @@ ifdef MINGW
endif endif
LIBS= -lws2_32 -lwinmm -lpsapi LIBS= -lws2_32 -lwinmm -lpsapi
AUTOUPDATER_LIBS += -lwininet
# clang 3.4 doesn't support this # clang 3.4 doesn't support this
ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++")) ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
CLIENT_LDFLAGS += -mwindows CLIENT_LDFLAGS += -mwindows
endif endif
CLIENT_LIBS = -lgdi32 -lole32 CLIENT_LIBS = -lgdi32 -lole32
RENDERER_LIBS = -lgdi32 -lole32 -lopengl32 RENDERER_LIBS = -lgdi32 -lole32 -static-libgcc
ifeq ($(USE_FREETYPE),1) ifeq ($(USE_FREETYPE),1)
FREETYPE_CFLAGS = -Ifreetype2 FREETYPE_CFLAGS = -Ifreetype2
@ -619,9 +648,9 @@ ifdef MINGW
ifeq ($(USE_LOCAL_HEADERS),1) ifeq ($(USE_LOCAL_HEADERS),1)
CLIENT_CFLAGS += -DCURL_STATICLIB CLIENT_CFLAGS += -DCURL_STATICLIB
ifeq ($(ARCH),x86_64) ifeq ($(ARCH),x86_64)
CLIENT_LIBS += $(LIBSDIR)/win64/libcurl.a CLIENT_LIBS += $(LIBSDIR)/win64/libcurl.a -lcrypt32
else else
CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a CLIENT_LIBS += $(LIBSDIR)/win32/libcurl.a -lcrypt32
endif endif
else else
CLIENT_LIBS += $(CURL_LIBS) CLIENT_LIBS += $(CURL_LIBS)
@ -673,13 +702,13 @@ else # ifdef MINGW
ifeq ($(PLATFORM),freebsd) ifeq ($(PLATFORM),freebsd)
# flags # flags
BASE_CFLAGS = $(shell env MACHINE_ARCH=$(ARCH) make -f /dev/null -VCFLAGS) \ BASE_CFLAGS = \
-Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
CLIENT_CFLAGS += $(SDL_CFLAGS) CLIENT_CFLAGS += $(SDL_CFLAGS)
HAVE_VM_COMPILED = true HAVE_VM_COMPILED = true
OPTIMIZEVM = -O3 OPTIMIZEVM =
OPTIMIZE = $(OPTIMIZEVM) -ffast-math OPTIMIZE = $(OPTIMIZEVM) -ffast-math
SHLIBEXT=so SHLIBEXT=so
@ -693,7 +722,7 @@ ifeq ($(PLATFORM),freebsd)
CLIENT_LIBS = CLIENT_LIBS =
CLIENT_LIBS += $(SDL_LIBS) CLIENT_LIBS += $(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS) -lGL RENDERER_LIBS = $(SDL_LIBS)
# optional features/libraries # optional features/libraries
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
@ -784,7 +813,7 @@ ifeq ($(PLATFORM),openbsd)
CLIENT_LIBS = CLIENT_LIBS =
CLIENT_LIBS += $(SDL_LIBS) CLIENT_LIBS += $(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS) -lGL RENDERER_LIBS = $(SDL_LIBS)
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1) ifneq ($(USE_OPENAL_DLOPEN),1)
@ -830,7 +859,6 @@ ifeq ($(PLATFORM),irix64)
ARCH=mips ARCH=mips
CC = c99 CC = c99
MKDIR = mkdir -p
BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 \ BASE_CFLAGS=-Dstricmp=strcasecmp -Xcpluscomm -woff 1185 \
-I. -I$(ROOT)/usr/include -I. -I$(ROOT)/usr/include
@ -842,10 +870,12 @@ ifeq ($(PLATFORM),irix64)
SHLIBLDFLAGS=-shared SHLIBLDFLAGS=-shared
LIBS=-ldl -lm -lgen LIBS=-ldl -lm -lgen
AUTOUPDATER_LIBS += -ldl
# FIXME: The X libraries probably aren't necessary? # FIXME: The X libraries probably aren't necessary?
CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) \ CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) \
-lX11 -lXext -lm -lX11 -lXext -lm
RENDERER_LIBS = $(SDL_LIBS) -lGL RENDERER_LIBS = $(SDL_LIBS)
else # ifeq IRIX else # ifeq IRIX
@ -857,7 +887,7 @@ ifeq ($(PLATFORM),sunos)
CC=gcc CC=gcc
INSTALL=ginstall INSTALL=ginstall
MKDIR=gmkdir MKDIR=gmkdir -p
COPYDIR="/usr/local/share/games/quake3" COPYDIR="/usr/local/share/games/quake3"
ifneq ($(ARCH),x86) ifneq ($(ARCH),x86)
@ -896,11 +926,12 @@ ifeq ($(PLATFORM),sunos)
THREAD_LIBS=-lpthread THREAD_LIBS=-lpthread
LIBS=-lsocket -lnsl -ldl -lm LIBS=-lsocket -lnsl -ldl -lm
AUTOUPDATER_LIBS += -ldl
BOTCFLAGS=-O0 BOTCFLAGS=-O0
CLIENT_LIBS +=$(SDL_LIBS) -lX11 -lXext -liconv -lm CLIENT_LIBS +=$(SDL_LIBS) -lX11 -lXext -liconv -lm
RENDERER_LIBS = $(SDL_LIBS) -lGL RENDERER_LIBS = $(SDL_LIBS)
else # ifeq sunos else # ifeq sunos
@ -995,6 +1026,16 @@ ifneq ($(BUILD_GAME_QVM),0)
endif endif
endif endif
ifneq ($(BUILD_AUTOUPDATER),0)
# PLEASE NOTE that if you run an exe on Windows Vista or later
# with "setup", "install", "update" or other related terms, it
# will unconditionally trigger a UAC prompt, and in the case of
# ioq3 calling CreateProcess() on it, it'll just fail immediately.
# So don't call this thing "autoupdater" here!
AUTOUPDATER_BIN := autosyncerator$(FULLBINEXT)
TARGETS += $(B)/$(AUTOUPDATER_BIN)
endif
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
CLIENT_CFLAGS += -DUSE_OPENAL CLIENT_CFLAGS += -DUSE_OPENAL
ifeq ($(USE_OPENAL_DLOPEN),1) ifeq ($(USE_OPENAL_DLOPEN),1)
@ -1009,10 +1050,20 @@ ifeq ($(USE_CURL),1)
endif endif
endif endif
ifeq ($(USE_VOIP),1)
CLIENT_CFLAGS += -DUSE_VOIP
SERVER_CFLAGS += -DUSE_VOIP
NEED_OPUS=1
endif
ifeq ($(USE_CODEC_OPUS),1) ifeq ($(USE_CODEC_OPUS),1)
CLIENT_CFLAGS += -DUSE_CODEC_OPUS CLIENT_CFLAGS += -DUSE_CODEC_OPUS
NEED_OPUS=1
endif
ifeq ($(NEED_OPUS),1)
ifeq ($(USE_INTERNAL_OPUS),1) ifeq ($(USE_INTERNAL_OPUS),1)
OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \ OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DFLOAT_APPROX -DUSE_ALLOCA \
-I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \ -I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \
-I$(OPUSDIR)/silk/float -I$(OPUSFILEDIR)/include -I$(OPUSDIR)/silk/float -I$(OPUSFILEDIR)/include
else else
@ -1056,19 +1107,6 @@ ifeq ($(USE_MUMBLE),1)
CLIENT_CFLAGS += -DUSE_MUMBLE CLIENT_CFLAGS += -DUSE_MUMBLE
endif endif
ifeq ($(USE_VOIP),1)
CLIENT_CFLAGS += -DUSE_VOIP
SERVER_CFLAGS += -DUSE_VOIP
ifeq ($(USE_INTERNAL_SPEEX),1)
SPEEX_CFLAGS += -DFLOATING_POINT -DUSE_ALLOCA -I$(SPEEXDIR)/include
else
SPEEX_CFLAGS ?= $(shell pkg-config --silence-errors --cflags speex speexdsp || true)
SPEEX_LIBS ?= $(shell pkg-config --silence-errors --libs speex speexdsp || echo -lspeex -lspeexdsp)
endif
CLIENT_CFLAGS += $(SPEEX_CFLAGS)
CLIENT_LIBS += $(SPEEX_LIBS)
endif
ifeq ($(USE_INTERNAL_ZLIB),1) ifeq ($(USE_INTERNAL_ZLIB),1)
ZLIB_CFLAGS = -DNO_GZIP -I$(ZDIR) ZLIB_CFLAGS = -DNO_GZIP -I$(ZDIR)
else else
@ -1098,6 +1136,15 @@ ifeq ($(USE_FREETYPE),1)
RENDERER_LIBS += $(FREETYPE_LIBS) RENDERER_LIBS += $(FREETYPE_LIBS)
endif endif
ifeq ($(USE_AUTOUPDATER),1)
CLIENT_CFLAGS += -DUSE_AUTOUPDATER -DAUTOUPDATER_BIN=\\\"$(AUTOUPDATER_BIN)\\\"
SERVER_CFLAGS += -DUSE_AUTOUPDATER -DAUTOUPDATER_BIN=\\\"$(AUTOUPDATER_BIN)\\\"
endif
ifeq ($(BUILD_AUTOUPDATER),1)
AUTOUPDATER_LIBS += $(LIBTOMCRYPTSRCDIR)/libtomcrypt.a $(TOMSFASTMATHSRCDIR)/libtfm.a
endif
ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++")) ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))
BASE_CFLAGS += -Qunused-arguments BASE_CFLAGS += -Qunused-arguments
endif endif
@ -1126,6 +1173,11 @@ else
STRIP_FLAG = -s STRIP_FLAG = -s
endif endif
# https://reproducible-builds.org/specs/source-date-epoch/
ifdef SOURCE_DATE_EPOCH
BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell date --date="@$$SOURCE_DATE_EPOCH" "+%b %_d %Y" | sed -e 's/ /\\\ /'g)\\\"
endif
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\" BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
@ -1154,7 +1206,7 @@ define DO_REF_STR
$(echo_cmd) "REF_STR $<" $(echo_cmd) "REF_STR $<"
$(Q)rm -f $@ $(Q)rm -f $@
$(Q)echo "const char *fallbackShader_$(notdir $(basename $<)) =" >> $@ $(Q)echo "const char *fallbackShader_$(notdir $(basename $<)) =" >> $@
$(Q)cat $< | sed 's/^/\"/;s/$$/\\n\"/' >> $@ $(Q)cat $< | sed -e 's/^/\"/;s/$$/\\n\"/' | tr -d '\r' >> $@
$(Q)echo ";" >> $@ $(Q)echo ";" >> $@
endef endef
@ -1279,7 +1331,7 @@ endif
NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g") NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g")
print_list=@for i in $(1); \ print_list=-@for i in $(1); \
do \ do \
echo " $$i"; \ echo " $$i"; \
done done
@ -1300,6 +1352,7 @@ targets: makedirs
@echo " VERSION: $(VERSION)" @echo " VERSION: $(VERSION)"
@echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)" @echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)"
@echo " COMPILE_ARCH: $(COMPILE_ARCH)" @echo " COMPILE_ARCH: $(COMPILE_ARCH)"
@echo " HAVE_VM_COMPILED: $(HAVE_VM_COMPILED)"
@echo " CC: $(CC)" @echo " CC: $(CC)"
ifeq ($(PLATFORM),mingw32) ifeq ($(PLATFORM),mingw32)
@echo " WINDRES: $(WINDRES)" @echo " WINDRES: $(WINDRES)"
@ -1323,6 +1376,9 @@ endif
@echo " CLIENT_LIBS:" @echo " CLIENT_LIBS:"
$(call print_wrapped, $(CLIENT_LIBS)) $(call print_wrapped, $(CLIENT_LIBS))
@echo "" @echo ""
@echo " AUTOUPDATER_LIBS:"
$(call print_wrapped, $(AUTOUPDATER_LIBS))
@echo ""
@echo " Output:" @echo " Output:"
$(call print_list, $(NAKED_TARGETS)) $(call print_list, $(NAKED_TARGETS))
@echo "" @echo ""
@ -1346,33 +1402,28 @@ ifneq ($(PLATFORM),darwin)
endif endif
makedirs: makedirs:
@if [ ! -d $(BUILD_DIR) ];then $(MKDIR) $(BUILD_DIR);fi @$(MKDIR) $(B)/autoupdater
@if [ ! -d $(B) ];then $(MKDIR) $(B);fi @$(MKDIR) $(B)/client/opus
@if [ ! -d $(B)/client ];then $(MKDIR) $(B)/client;fi @$(MKDIR) $(B)/client/vorbis
@if [ ! -d $(B)/client/opus ];then $(MKDIR) $(B)/client/opus;fi @$(MKDIR) $(B)/renderergl1
@if [ ! -d $(B)/client/vorbis ];then $(MKDIR) $(B)/client/vorbis;fi @$(MKDIR) $(B)/renderergl2
@if [ ! -d $(B)/renderergl1 ];then $(MKDIR) $(B)/renderergl1;fi @$(MKDIR) $(B)/renderergl2/glsl
@if [ ! -d $(B)/renderergl2 ];then $(MKDIR) $(B)/renderergl2;fi @$(MKDIR) $(B)/ded
@if [ ! -d $(B)/renderergl2/glsl ];then $(MKDIR) $(B)/renderergl2/glsl;fi @$(MKDIR) $(B)/$(BASEGAME)/cgame
@if [ ! -d $(B)/ded ];then $(MKDIR) $(B)/ded;fi @$(MKDIR) $(B)/$(BASEGAME)/game
@if [ ! -d $(B)/$(BASEGAME) ];then $(MKDIR) $(B)/$(BASEGAME);fi @$(MKDIR) $(B)/$(BASEGAME)/ui
@if [ ! -d $(B)/$(BASEGAME)/cgame ];then $(MKDIR) $(B)/$(BASEGAME)/cgame;fi @$(MKDIR) $(B)/$(BASEGAME)/qcommon
@if [ ! -d $(B)/$(BASEGAME)/game ];then $(MKDIR) $(B)/$(BASEGAME)/game;fi @$(MKDIR) $(B)/$(BASEGAME)/vm
@if [ ! -d $(B)/$(BASEGAME)/ui ];then $(MKDIR) $(B)/$(BASEGAME)/ui;fi @$(MKDIR) $(B)/$(MISSIONPACK)/cgame
@if [ ! -d $(B)/$(BASEGAME)/qcommon ];then $(MKDIR) $(B)/$(BASEGAME)/qcommon;fi @$(MKDIR) $(B)/$(MISSIONPACK)/game
@if [ ! -d $(B)/$(BASEGAME)/vm ];then $(MKDIR) $(B)/$(BASEGAME)/vm;fi @$(MKDIR) $(B)/$(MISSIONPACK)/ui
@if [ ! -d $(B)/$(MISSIONPACK) ];then $(MKDIR) $(B)/$(MISSIONPACK);fi @$(MKDIR) $(B)/$(MISSIONPACK)/qcommon
@if [ ! -d $(B)/$(MISSIONPACK)/cgame ];then $(MKDIR) $(B)/$(MISSIONPACK)/cgame;fi @$(MKDIR) $(B)/$(MISSIONPACK)/vm
@if [ ! -d $(B)/$(MISSIONPACK)/game ];then $(MKDIR) $(B)/$(MISSIONPACK)/game;fi @$(MKDIR) $(B)/tools/asm
@if [ ! -d $(B)/$(MISSIONPACK)/ui ];then $(MKDIR) $(B)/$(MISSIONPACK)/ui;fi @$(MKDIR) $(B)/tools/etc
@if [ ! -d $(B)/$(MISSIONPACK)/qcommon ];then $(MKDIR) $(B)/$(MISSIONPACK)/qcommon;fi @$(MKDIR) $(B)/tools/rcc
@if [ ! -d $(B)/$(MISSIONPACK)/vm ];then $(MKDIR) $(B)/$(MISSIONPACK)/vm;fi @$(MKDIR) $(B)/tools/cpp
@if [ ! -d $(B)/tools ];then $(MKDIR) $(B)/tools;fi @$(MKDIR) $(B)/tools/lburg
@if [ ! -d $(B)/tools/asm ];then $(MKDIR) $(B)/tools/asm;fi
@if [ ! -d $(B)/tools/etc ];then $(MKDIR) $(B)/tools/etc;fi
@if [ ! -d $(B)/tools/rcc ];then $(MKDIR) $(B)/tools/rcc;fi
@if [ ! -d $(B)/tools/cpp ];then $(MKDIR) $(B)/tools/cpp;fi
@if [ ! -d $(B)/tools/lburg ];then $(MKDIR) $(B)/tools/lburg;fi
############################################################################# #############################################################################
# QVM BUILD TOOLS # QVM BUILD TOOLS
@ -1383,6 +1434,10 @@ ifndef TOOLS_CC
TOOLS_CC = gcc TOOLS_CC = gcc
endif endif
ifndef YACC
YACC = yacc
endif
TOOLS_OPTIMIZE = -g -Wall -fno-strict-aliasing TOOLS_OPTIMIZE = -g -Wall -fno-strict-aliasing
TOOLS_CFLAGS += $(TOOLS_OPTIMIZE) \ TOOLS_CFLAGS += $(TOOLS_OPTIMIZE) \
-DTEMPDIR=\"$(TEMPDIR)\" -DSYSTEM=\"\" \ -DTEMPDIR=\"$(TEMPDIR)\" -DSYSTEM=\"\" \
@ -1395,6 +1450,12 @@ ifeq ($(GENERATE_DEPENDENCIES),1)
TOOLS_CFLAGS += -MMD TOOLS_CFLAGS += -MMD
endif endif
define DO_YACC
$(echo_cmd) "YACC $<"
$(Q)$(YACC) $<
$(Q)mv -f y.tab.c $@
endef
define DO_TOOLS_CC define DO_TOOLS_CC
$(echo_cmd) "TOOLS_CC $<" $(echo_cmd) "TOOLS_CC $<"
$(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) -o $@ -c $< $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) -o $@ -c $<
@ -1416,6 +1477,12 @@ LBURGOBJ= \
$(B)/tools/lburg/lburg.o \ $(B)/tools/lburg/lburg.o \
$(B)/tools/lburg/gram.o $(B)/tools/lburg/gram.o
# override GNU Make built-in rule for converting gram.y to gram.c
%.c: %.y
ifeq ($(USE_YACC),1)
$(DO_YACC)
endif
$(B)/tools/lburg/%.o: $(LBURGDIR)/%.c $(B)/tools/lburg/%.o: $(LBURGDIR)/%.c
$(DO_TOOLS_CC) $(DO_TOOLS_CC)
@ -1551,6 +1618,26 @@ $(Q3ASM): $(Q3ASMOBJ)
$(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS) $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) $(TOOLS_LDFLAGS) -o $@ $^ $(TOOLS_LIBS)
#############################################################################
# AUTOUPDATER
#############################################################################
define DO_AUTOUPDATER_CC
$(echo_cmd) "AUTOUPDATER_CC $<"
$(Q)$(CC) $(CFLAGS) -I$(LIBTOMCRYPTSRCDIR)/src/headers -I$(TOMSFASTMATHSRCDIR)/src/headers $(CURL_CFLAGS) -o $@ -c $<
endef
Q3AUTOUPDATEROBJ = \
$(B)/autoupdater/autoupdater.o
$(B)/autoupdater/%.o: $(AUTOUPDATERSRCDIR)/%.c
$(DO_AUTOUPDATER_CC)
$(B)/$(AUTOUPDATER_BIN): $(Q3AUTOUPDATEROBJ)
$(echo_cmd) "AUTOUPDATER_LD $@"
$(Q)$(CC) $(LDFLAGS) -o $@ $(Q3AUTOUPDATEROBJ) $(AUTOUPDATER_LIBS)
############################################################################# #############################################################################
# CLIENT/SERVER # CLIENT/SERVER
############################################################################# #############################################################################
@ -1654,6 +1741,7 @@ Q3OBJ = \
$(B)/client/sdl_snd.o \ $(B)/client/sdl_snd.o \
\ \
$(B)/client/con_log.o \ $(B)/client/con_log.o \
$(B)/client/sys_autoupdater.o \
$(B)/client/sys_main.o $(B)/client/sys_main.o
ifdef MINGW ifdef MINGW
@ -1670,6 +1758,7 @@ Q3R2OBJ = \
$(B)/renderergl2/tr_bsp.o \ $(B)/renderergl2/tr_bsp.o \
$(B)/renderergl2/tr_cmds.o \ $(B)/renderergl2/tr_cmds.o \
$(B)/renderergl2/tr_curve.o \ $(B)/renderergl2/tr_curve.o \
$(B)/renderergl2/tr_dsa.o \
$(B)/renderergl2/tr_extramath.o \ $(B)/renderergl2/tr_extramath.o \
$(B)/renderergl2/tr_extensions.o \ $(B)/renderergl2/tr_extensions.o \
$(B)/renderergl2/tr_fbo.o \ $(B)/renderergl2/tr_fbo.o \
@ -1682,6 +1771,7 @@ Q3R2OBJ = \
$(B)/renderergl2/tr_image_pcx.o \ $(B)/renderergl2/tr_image_pcx.o \
$(B)/renderergl2/tr_image_png.o \ $(B)/renderergl2/tr_image_png.o \
$(B)/renderergl2/tr_image_tga.o \ $(B)/renderergl2/tr_image_tga.o \
$(B)/renderergl2/tr_image_dds.o \
$(B)/renderergl2/tr_init.o \ $(B)/renderergl2/tr_init.o \
$(B)/renderergl2/tr_light.o \ $(B)/renderergl2/tr_light.o \
$(B)/renderergl2/tr_main.o \ $(B)/renderergl2/tr_main.o \
@ -1845,53 +1935,7 @@ ifeq ($(ARCH),x86_64)
$(B)/client/ftola.o $(B)/client/ftola.o
endif endif
ifeq ($(USE_VOIP),1) ifeq ($(NEED_OPUS),1)
ifeq ($(USE_INTERNAL_SPEEX),1)
Q3OBJ += \
$(B)/client/bits.o \
$(B)/client/buffer.o \
$(B)/client/cb_search.o \
$(B)/client/exc_10_16_table.o \
$(B)/client/exc_10_32_table.o \
$(B)/client/exc_20_32_table.o \
$(B)/client/exc_5_256_table.o \
$(B)/client/exc_5_64_table.o \
$(B)/client/exc_8_128_table.o \
$(B)/client/fftwrap.o \
$(B)/client/filterbank.o \
$(B)/client/filters.o \
$(B)/client/gain_table.o \
$(B)/client/gain_table_lbr.o \
$(B)/client/hexc_10_32_table.o \
$(B)/client/hexc_table.o \
$(B)/client/high_lsp_tables.o \
$(B)/client/jitter.o \
$(B)/client/kiss_fft.o \
$(B)/client/kiss_fftr.o \
$(B)/client/lpc.o \
$(B)/client/lsp.o \
$(B)/client/lsp_tables_nb.o \
$(B)/client/ltp.o \
$(B)/client/mdf.o \
$(B)/client/modes.o \
$(B)/client/modes_wb.o \
$(B)/client/nb_celp.o \
$(B)/client/preprocess.o \
$(B)/client/quant_lsp.o \
$(B)/client/resample.o \
$(B)/client/sb_celp.o \
$(B)/client/smallft.o \
$(B)/client/speex.o \
$(B)/client/speex_callbacks.o \
$(B)/client/speex_header.o \
$(B)/client/stereo.o \
$(B)/client/vbr.o \
$(B)/client/vq.o \
$(B)/client/window.o
endif
endif
ifeq ($(USE_CODEC_OPUS),1)
ifeq ($(USE_INTERNAL_OPUS),1) ifeq ($(USE_INTERNAL_OPUS),1)
Q3OBJ += \ Q3OBJ += \
$(B)/client/opus/analysis.o \ $(B)/client/opus/analysis.o \
@ -2098,6 +2142,9 @@ ifeq ($(HAVE_VM_COMPILED),true)
ifeq ($(ARCH),sparc) ifeq ($(ARCH),sparc)
Q3OBJ += $(B)/client/vm_sparc.o Q3OBJ += $(B)/client/vm_sparc.o
endif endif
ifeq ($(ARCH),armv7l)
Q3OBJ += $(B)/client/vm_armv7l.o
endif
endif endif
ifdef MINGW ifdef MINGW
@ -2122,7 +2169,7 @@ endif
ifneq ($(USE_RENDERER_DLOPEN),0) ifneq ($(USE_RENDERER_DLOPEN),0)
$(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN) $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) \
-o $@ $(Q3OBJ) \ -o $@ $(Q3OBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(LIBS)
@ -2138,13 +2185,13 @@ $(B)/$(RENDERER_PREFIX)opengl2_$(SHLIBNAME): $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOB
else else
$(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(LIBSDLMAIN) $(B)/$(CLIENTBIN)$(FULLBINEXT): $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) \
-o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) \ -o $@ $(Q3OBJ) $(Q3ROBJ) $(JPGOBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
$(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(LIBSDLMAIN) $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT): $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) \ $(Q)$(CC) $(CLIENT_CFLAGS) $(CFLAGS) $(CLIENT_LDFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) \
-o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \ -o $@ $(Q3OBJ) $(Q3R2OBJ) $(Q3R2STRINGOBJ) $(JPGOBJ) \
$(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS) $(LIBSDLMAIN) $(CLIENT_LIBS) $(RENDERER_LIBS) $(LIBS)
endif endif
@ -2231,6 +2278,7 @@ Q3DOBJ = \
$(B)/ded/null_snddma.o \ $(B)/ded/null_snddma.o \
\ \
$(B)/ded/con_log.o \ $(B)/ded/con_log.o \
$(B)/ded/sys_autoupdater.o \
$(B)/ded/sys_main.o $(B)/ded/sys_main.o
ifeq ($(ARCH),x86) ifeq ($(ARCH),x86)
@ -2266,6 +2314,9 @@ ifeq ($(HAVE_VM_COMPILED),true)
ifeq ($(ARCH),sparc) ifeq ($(ARCH),sparc)
Q3DOBJ += $(B)/ded/vm_sparc.o Q3DOBJ += $(B)/ded/vm_sparc.o
endif endif
ifeq ($(ARCH),armv7l)
Q3DOBJ += $(B)/client/vm_armv7l.o
endif
endif endif
ifdef MINGW ifdef MINGW
@ -2286,7 +2337,7 @@ endif
$(B)/$(SERVERBIN)$(FULLBINEXT): $(Q3DOBJ) $(B)/$(SERVERBIN)$(FULLBINEXT): $(Q3DOBJ)
$(echo_cmd) "LD $@" $(echo_cmd) "LD $@"
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q3DOBJ) $(LIBS) $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(NOTSHLIBLDFLAGS) -o $@ $(Q3DOBJ) $(LIBS)
@ -2598,9 +2649,6 @@ $(B)/client/%.o: $(CMDIR)/%.c
$(B)/client/%.o: $(BLIBDIR)/%.c $(B)/client/%.o: $(BLIBDIR)/%.c
$(DO_BOT_CC) $(DO_BOT_CC)
$(B)/client/%.o: $(SPEEXDIR)/%.c
$(DO_CC)
$(B)/client/%.o: $(OGGDIR)/src/%.c $(B)/client/%.o: $(OGGDIR)/src/%.c
$(DO_CC) $(DO_CC)
@ -2634,7 +2682,7 @@ $(B)/client/%.o: $(SYSDIR)/%.c
$(B)/client/%.o: $(SYSDIR)/%.m $(B)/client/%.o: $(SYSDIR)/%.m
$(DO_CC) $(DO_CC)
$(B)/client/%.o: $(SYSDIR)/%.rc $(B)/client/win_resource.o: $(SYSDIR)/win_resource.rc $(SYSDIR)/win_manifest.xml
$(DO_WINDRES) $(DO_WINDRES)
@ -2691,7 +2739,7 @@ $(B)/ded/%.o: $(SYSDIR)/%.c
$(B)/ded/%.o: $(SYSDIR)/%.m $(B)/ded/%.o: $(SYSDIR)/%.m
$(DO_DED_CC) $(DO_DED_CC)
$(B)/ded/%.o: $(SYSDIR)/%.rc $(B)/ded/win_resource.o: $(SYSDIR)/win_resource.rc $(SYSDIR)/win_manifest.xml
$(DO_WINDRES) $(DO_WINDRES)
$(B)/ded/%.o: $(NDIR)/%.c $(B)/ded/%.o: $(NDIR)/%.c
@ -2699,9 +2747,9 @@ $(B)/ded/%.o: $(NDIR)/%.c
# Extra dependencies to ensure the git version is incorporated # Extra dependencies to ensure the git version is incorporated
ifeq ($(USE_GIT),1) ifeq ($(USE_GIT),1)
$(B)/client/cl_console.o : .git/index $(B)/client/cl_console.o : .git
$(B)/client/common.o : .git/index $(B)/client/common.o : .git
$(B)/ded/common.o : .git/index $(B)/ded/common.o : .git
endif endif
@ -2800,10 +2848,10 @@ copyfiles: release
@if [ ! -d $(COPYDIR)/$(BASEGAME) ]; then echo "You need to set COPYDIR to where your Quake3 data is!"; fi @if [ ! -d $(COPYDIR)/$(BASEGAME) ]; then echo "You need to set COPYDIR to where your Quake3 data is!"; fi
ifneq ($(BUILD_GAME_SO),0) ifneq ($(BUILD_GAME_SO),0)
ifneq ($(BUILD_BASEGAME),0) ifneq ($(BUILD_BASEGAME),0)
-$(MKDIR) -p -m 0755 $(COPYDIR)/$(BASEGAME) -$(MKDIR) -m 0755 $(COPYDIR)/$(BASEGAME)
endif endif
ifneq ($(BUILD_MISSIONPACK),0) ifneq ($(BUILD_MISSIONPACK),0)
-$(MKDIR) -p -m 0755 $(COPYDIR)/$(MISSIONPACK) -$(MKDIR) -m 0755 $(COPYDIR)/$(MISSIONPACK)
endif endif
endif endif
@ -2891,7 +2939,6 @@ ifdef MINGW
USE_OPENAL_DLOPEN=$(USE_OPENAL_DLOPEN) \ USE_OPENAL_DLOPEN=$(USE_OPENAL_DLOPEN) \
USE_CURL_DLOPEN=$(USE_CURL_DLOPEN) \ USE_CURL_DLOPEN=$(USE_CURL_DLOPEN) \
USE_INTERNAL_OPUS=$(USE_INTERNAL_OPUS) \ USE_INTERNAL_OPUS=$(USE_INTERNAL_OPUS) \
USE_INTERNAL_SPEEX=$(USE_INTERNAL_SPEEX) \
USE_INTERNAL_ZLIB=$(USE_INTERNAL_ZLIB) \ USE_INTERNAL_ZLIB=$(USE_INTERNAL_ZLIB) \
USE_INTERNAL_JPEG=$(USE_INTERNAL_JPEG) USE_INTERNAL_JPEG=$(USE_INTERNAL_JPEG)
else else

View file

@ -1 +0,0 @@
http://wiki.ioquake3.org/NotToDo

293
README.md
View file

@ -11,7 +11,7 @@ The intent of this project is to provide a baseline Quake 3 which may be used
for further development and baseq3 fun. for further development and baseq3 fun.
Some of the major features currently implemented are: Some of the major features currently implemented are:
* SDL backend * SDL 2 backend
* OpenAL sound API support (multiple speaker support and better sound * OpenAL sound API support (multiple speaker support and better sound
quality) quality)
* Full x86_64 support on Linux * Full x86_64 support on Linux
@ -36,8 +36,14 @@ use a modern copy from http://icculus.org/gtkradiant/.
The original id software readme that accompanied the Q3 source release has been The original id software readme that accompanied the Q3 source release has been
renamed to id-readme.txt so as to prevent confusion. Please refer to the renamed to id-readme.txt so as to prevent confusion. Please refer to the
web-site for updated status. website for updated status.
More documentation including a Player's Guide and Sysadmin Guide is on:
http://wiki.ioquake3.org/
If you've got issues that you aren't sure are worth filing as bugs, or just
want to chat, please visit our forums:
http://discourse.ioquake.org
# Compilation and installation # Compilation and installation
@ -88,6 +94,7 @@ Makefile.local:
CLIENTBIN - rename 'ioquake3' client binary CLIENTBIN - rename 'ioquake3' client binary
RENDERER_PREFIX - rename 'renderer_' renderer binaries RENDERER_PREFIX - rename 'renderer_' renderer binaries
USE_RENDERER_DLOPEN - build and use the renderer in a library USE_RENDERER_DLOPEN - build and use the renderer in a library
USE_YACC - use yacc to update code/tools/lcc/lburg/gram.c
BASEGAME - rename 'baseq3' BASEGAME - rename 'baseq3'
BASEGAME_CFLAGS - custom CFLAGS for basegame BASEGAME_CFLAGS - custom CFLAGS for basegame
MISSIONPACK - rename 'missionpack' MISSIONPACK - rename 'missionpack'
@ -100,13 +107,11 @@ Makefile.local:
USE_CODEC_OPUS - enable Ogg Opus support USE_CODEC_OPUS - enable Ogg Opus support
USE_MUMBLE - enable Mumble support USE_MUMBLE - enable Mumble support
USE_VOIP - enable built-in VoIP support USE_VOIP - enable built-in VoIP support
USE_FREETYPE - enable FreeType support for rendering fonts
USE_INTERNAL_LIBS - build internal libraries instead of dynamically USE_INTERNAL_LIBS - build internal libraries instead of dynamically
linking against system libraries; this just sets linking against system libraries; this just sets
the default for USE_INTERNAL_SPEEX etc. the default for USE_INTERNAL_ZLIB etc.
and USE_LOCAL_HEADERS and USE_LOCAL_HEADERS
USE_INTERNAL_SPEEX - build internal speex library instead of dynamically
linking against system libspeex
USE_FREETYPE - enable FreeType support for rendering fonts
USE_INTERNAL_ZLIB - build and link against internal zlib USE_INTERNAL_ZLIB - build and link against internal zlib
USE_INTERNAL_JPEG - build and link against internal JPEG library USE_INTERNAL_JPEG - build and link against internal JPEG library
USE_INTERNAL_OGG - build and link against internal ogg library USE_INTERNAL_OGG - build and link against internal ogg library
@ -136,6 +141,12 @@ The defaults for these variables differ depending on the target platform.
behaviour, 0 for standard q3 behaviour, 0 for standard q3
cl_mouseAccelOffset - Tuning the acceleration curve, see below cl_mouseAccelOffset - Tuning the acceleration curve, see below
con_autochat - Set to 0 to disable sending console input
text as chat when there is not a slash
at the beginning
con_autoclear - Set to 0 to disable clearing console
input text when console is closed
in_joystickUseAnalog - Do not translate joystick axis events in_joystickUseAnalog - Do not translate joystick axis events
to keyboard commands to keyboard commands
@ -243,7 +254,7 @@ The defaults for these variables differ depending on the target platform.
ipv6 servers on the local network ipv6 servers on the local network
net_mcastiface - outgoing interface to use for scan net_mcastiface - outgoing interface to use for scan
r_allowResize - make window resizable (SDL only) r_allowResize - make window resizable
r_ext_texture_filter_anisotropic - anisotropic texture filtering r_ext_texture_filter_anisotropic - anisotropic texture filtering
r_zProj - distance of observer camera to projection r_zProj - distance of observer camera to projection
plane in quake3 standard units plane in quake3 standard units
@ -323,207 +334,11 @@ The defaults for these variables differ depending on the target platform.
cvar_modified [filter] - list modified cvars, can filter results (such as "r*" cvar_modified [filter] - list modified cvars, can filter results (such as "r*"
for renderer cvars) like cvarlist which lists all cvars for renderer cvars) like cvarlist which lists all cvars
addbot random - the bot name "random" now selects a random bot
``` ```
# README for Users
## Using shared libraries instead of qvm
To force Q3 to use shared libraries instead of qvms run it with the following
parameters: `+set sv_pure 0 +set vm_cgame 0 +set vm_game 0 +set vm_ui 0`
## Using Demo Data Files
Copy demoq3/pak0.pk3 from the demo installer to your baseq3 directory. The
qvm files in this pak0.pk3 will not work, so you have to use the native
shared libraries or qvms from this project. To use the new qvms, they must be
put into a pk3 file. A pk3 file is just a zip file, so any compression tool
that can create such files will work. The shared libraries should already be
in the correct place. Use the instructions above to use them.
Please bear in mind that you will not be able to play online using the demo
data, nor is it something that we like to spend much time maintaining or
supporting.
## Help! Ioquake3 won't give me an fps of X anymore when setting com_maxfps!
Ioquake3 now uses the select() system call to wait for the rendering of the
next frame when com_maxfps was hit. This will improve your CPU load
considerably in these cases. However, not all systems may support a
granularity for its timing functions that is required to perform this waiting
correctly. For instance, ioquake3 tells select() to wait 2 milliseconds, but
really it can only wait for a multiple of 5ms, i.e. 5, 10, 15, 20... ms.
In this case you can always revert back to the old behaviour by setting the
cvar com_busyWait to 1.
## Using HTTP/FTP Download Support (Server)
You can enable redirected downloads on your server even if it's not
an ioquake3 server. You simply need to use the 'sets' command to put
the sv_dlURL cvar into your SERVERINFO string and ensure sv_allowDownloads
is set to 1
sv_dlURL is the base of the URL that contains your custom .pk3 files
the client will append both fs_game and the filename to the end of
this value. For example, if you have sv_dlURL set to
`"http://ioquake3.org"`, fs_game is `"baseq3"`, and the client is
missing `"test.pk3"`, it will attempt to download from the URL
`"http://ioquake3.org/baseq3/test.pk3"`
sv_allowDownload's value is now a bitmask made up of the following
flags:
* 1 - ENABLE
* 4 - do not use UDP downloads
* 8 - do not ask the client to disconnect when using HTTP/FTP
Server operators who are concerned about potential "leeching" from their
HTTP servers from other ioquake3 servers can make use of the HTTP_REFERER
that ioquake3 sets which is `"ioQ3://{SERVER_IP}:{SERVER_PORT}"`. For,
example, Apache's mod_rewrite can restrict access based on HTTP_REFERER.
On a sidenote, downloading via UDP has been improved and yields higher data
rates now. You can configure the maximum bandwidth for UDP downloads via the
cvar sv_dlRate. Due to system-specific limits the download rate is capped
at about 1 Mbyte/s per client, so curl downloading may still be faster.
## Using HTTP/FTP Download Support (Client)
Simply setting cl_allowDownload to 1 will enable HTTP/FTP downloads
assuming ioquake3 was compiled with USE_CURL=1 (the default).
like sv_allowDownload, cl_allowDownload also uses a bitmask value
supporting the following flags:
* 1 - ENABLE
* 2 - do not use HTTP/FTP downloads
* 4 - do not use UDP downloads
When ioquake3 is built with USE_CURL_DLOPEN=1 (default on some platforms),
it will use the value of the cvar cl_cURLLib as the filename of the cURL
library to dynamically load.
## Multiuser Support on Windows systems
On Windows, all user specific files such as autogenerated configuration,
demos, videos, screenshots, and autodownloaded pk3s are now saved in a
directory specific to the user who is running ioquake3.
On NT-based such as Windows XP, this is usually a directory named:
C:\Documents and Settings\%USERNAME%\Application Data\Quake3\
Windows 95, Windows 98, and Windows ME will use a directory like:
C:\Windows\Application Data\Quake3
in single-user mode, or:
C:\Windows\Profiles\%USERNAME%\Application Data\Quake3
if multiple logins have been enabled.
In order to access this directory more easily, the installer may create a
Shortcut which has its target set to:
%APPDATA%\Quake3\
This Shortcut would work for all users on the system regardless of the
locale settings. Unfortunately, this environment variable is only
present on Windows NT based systems.
You can revert to the old single-user behaviour by setting the fs_homepath
cvar to the directory where ioquake3 is installed. For example:
ioquake3.exe +set fs_homepath "c:\ioquake3"
Note that this cvar MUST be set as a command line parameter.
## SDL Keyboard Differences
ioquake3 clients have different keyboard behaviour compared to the original
Quake3 clients.
* SDL > 1.2.9 does not support disabling dead key recognition. In order to
send dead key characters (e.g. ~, ', `, and ^), you must key a Space (or
sometimes the same character again) after the character to send it on
many international keyboard layouts.
* The SDL client supports many more keys than the original Quake3 client.
For example the keys: "Windows", "SysReq", "ScrollLock", and "Break".
For non-US keyboards, all of the so called "World" keys are now supported
as well as F13, F14, F15, and the country-specific mode/meta keys.
On many international layouts the default console toggle keys are also dead
keys, meaning that dropping the console potentially results in
unintentionally initiating the keying of a dead key. Furthermore SDL 1.2's
dead key support is broken by design and Q3 doesn't support non-ASCII text
entry, so the chances are you won't get the correct character anyway.
If you use such a keyboard layout, you can set the cvar cl_consoleKeys. This
is a space delimited list of key names that will toggle the console. The key
names are the usual Q3 names e.g. "~", "`", "c", "BACKSPACE", "PAUSE",
"WINDOWS" etc. It's also possible to use ASCII characters, by hexadecimal
number. Some example values for cl_consoleKeys:
"~ ` 0x7e 0x60" Toggle on ~ or ` (the default)
"WINDOWS" Toggle on the Windows key
"c" Toggle on the c key
"0x43" Toggle on the C character (Shift-c)
"PAUSE F1 PGUP" Toggle on the Pause, F1 or Page Up keys
Note that when you elect a set of console keys or characters, they cannot
then be used for binding, nor will they generate characters when entering
text. Also, in addition to the nominated console keys, Shift-ESC is hard
coded to always toggle the console.
## QuakeLive mouse acceleration
(patch and this text written by TTimo from id)
I've been using an experimental mouse acceleration code for a while, and
decided to make it available to everyone. Don't be too worried if you don't
understand the explanations below, this is mostly intended for advanced
players:
To enable it, set cl_mouseAccelStyle 1 (0 is the default/legacy behavior)
New style is controlled with 3 cvars:
sensitivity
cl_mouseAccel
cl_mouseAccelOffset
The old code (cl_mouseAccelStyle 0) can be difficult to calibrate because if
you have a base sensitivity setup, as soon as you set a non zero acceleration
your base sensitivity at low speeds will change as well. The other problem
with style 0 is that you are stuck on a square (power of two) acceleration
curve.
The new code tries to solve both problems:
Once you setup your sensitivity to feel comfortable and accurate enough for
low mouse deltas with no acceleration (cl_mouseAccel 0), you can start
increasing cl_mouseAccel and tweaking cl_mouseAccelOffset to get the
amplification you want for high deltas with little effect on low mouse deltas.
cl_mouseAccel is a power value. Should be >= 1, 2 will be the same power curve
as style 0. The higher the value, the faster the amplification grows with the
mouse delta.
cl_mouseAccelOffset sets how much base mouse delta will be doubled by
acceleration. The closer to zero you bring it, the more acceleration will
happen at low speeds. This is also very useful if you are changing to a new
mouse with higher dpi, if you go from 500 to 1000 dpi, you can divide your
cl_mouseAccelOffset by two to keep the same overall 'feel' (you will likely
gain in precision when you do that, but that is not related to mouse
acceleration).
Mouse acceleration is tricky to configure, and when you do you'll have to
re-learn your aiming. But you will find that it's very much forth it in the
long run.
If you try the new acceleration code and start using it, I'd be very
interested by your feedback.
# README for Developers # README for Developers
## pk3dir ## pk3dir
@ -636,55 +451,6 @@ not prohibit commercial exploitation and all assets (e.g. textures, sounds,
maps) created by yourself are your property and can be sold like every other maps) created by yourself are your property and can be sold like every other
game you find in stores. game you find in stores.
## Network protocols
There are now two cvars that give you some degree of freedom over the reported
protocol versions between clients and servers: "com_protocol" and
"com_legacyprotocol".
The reason for this is that some standalone games increased the protocol
number even though nothing really changed in their protocol and the ioquake3
engine is still fully compatible.
In order to harden the network protocol against UDP spoofing attacks a new
network protocol was introduced that defends against such attacks.
Unfortunately, this protocol will be incompatible to the original quake3 1.32c
which is the latest official release from id.
Luckily, ioquake3 has backwards compatibility, on the client as well as on the
server. This means ioquake3 players can play on old servers just as ioquake3
servers are able to service old clients.
The cvar "com_protocol" denotes the protocol version for the new hardened
protocol, whereas the "com_legacyprotocol" cvar denotes the protocol version
for the legacy protocol.
If the value for "com_protocol" and "com_legacyprotocol" is identical, then
the legacy protocol is always used. If "com_legacyprotocol" is set to 0, then
support for the legacy protocol is disabled.
Mods that use a standalone engine obviously do not require dual protocol
support, and it is turned off if the engine is compiled with STANDALONE per
default. If you desire backwards compatibility to older versions of your
game you can still enable it in q_shared.h by defining
LEGACY_PROTOCOL.
## cl_guid Support
cl_guid is a cvar which is part of the client's USERINFO string. Its value
is a 32 character string made up of [a-f] and [0-9] characters. This
value is pseudo-unique for every player. Id's Quake 3 Arena client also
sets cl_guid, but only if Punkbuster is enabled on the client.
If cl_guidServerUniq is non-zero (the default), then this value is also
pseudo-unique for each server a client connects to (based on IP:PORT of
the server).
The purpose of cl_guid is to add an identifier for each player on
a server. This value can be reset by the client at any time so it's not
useful for blocking access. However, it can have at least two uses in
your mod's game code:
1. improve logging to allow statistical tools to index players by more
than just name
2. granting some weak admin rights to players without requiring passwords
## PNG support ## PNG support
@ -719,18 +485,14 @@ directory, this restriction is lifted.
# Contributing # Contributing
Please send all patches to bugzilla (https://bugzilla.icculus.org), or join the Please send all patches to bugzilla (https://bugzilla.icculus.org), or as a GitHub pull request and
mailing list (http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org) and submit your patch there.
submit your patch there. The best case scenario is that you submit your patch
to bugzilla, and then post the URL to the mailing list.
The focus for ioq3 is to develop a stable base suitable for further development The focus for ioq3 is to develop a stable base suitable for further development
and provide players with the same Quake 3 experience they've had for years. As and provide players with the same Quake 3 experience they've had for years.
such ioq3 does not have any significant graphical enhancements and none are
planned at this time. However, improved graphics and sound patches will be
accepted as long as they are entirely optional, do not require new media and
are off by default.
We do have graphical improvements with the new renderer, but they are off by default.
See opengl2-readme.md for more information.
# Building Official Installers # Building Official Installers
@ -753,13 +515,11 @@ but we have some general guidelines:
providing pak0.pk3 and the patch pk3s are not referred to or included in the providing pak0.pk3 and the patch pk3s are not referred to or included in the
installer. installer.
* Please include at least an SDL so/dylib/dll on every platform. * Please include at least a libSDL2 so/dylib/dll on every platform.
* Please include an OpenAL so/dylib/dll, since every platform should be using * Please include an OpenAL so/dylib/dll, since every platform should be using
it by now. it by now.
* Please contact the mailing list when you've made your installer.
* Please be prepared to alter your installer on the whim of the maintainers. * Please be prepared to alter your installer on the whim of the maintainers.
* Your installer will be mirrored to an "official" directory, thus making it * Your installer will be mirrored to an "official" directory, thus making it
@ -789,4 +549,3 @@ Significant contributions from
* Aaron Gyes <floam@aaron.gy> * Aaron Gyes <floam@aaron.gy>
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/6d196bd663b47049a25dcb8caef95949 "githalytics.com")](http://githalytics.com/ioquake/ioq3)

7
SECURITY.md Normal file
View file

@ -0,0 +1,7 @@
## ioquake3 Security
We take security very seriously at ioquake3. We welcome any peer review of our 100% free software source code to ensure nobody's ioquake3 clients or servers are ever compromised or hacked.
### Where should I report security issues?
In order to give the community time to respond and upgrade we strongly urge you report all security issues privately.
Please contact zachary@ioquake.org directly to provide details and repro steps and we will respond ASAP.

165
autoupdater-readme.txt Normal file
View file

@ -0,0 +1,165 @@
The updater program's code is public domain. The rest of ioquake3 is not.
The source code to the autoupdater is in the code/autoupdater directory.
There is a small piece of code in ioquake3 itself at startup, too; this is
in code/sys/sys_autoupdater.c ...
(This is all Unix terminology, but similar approaches on Windows apply.)
The updater is a separate program, written in C, with no dependencies on
the game. It (statically) links to libcurl and uses the C runtime, but
otherwise has no external dependencies. It has to be a single binary file
with no shared libraries.
The basic flow looks like this:
- The game launches as usual.
- Right after main() starts, the game creates a pipe, forks off a new process,
and execs the updater in that process. The game won't ever touch the pipe
again. It's just there to block the child app until the game terminates.
- The updater has no UI. It writes a log file.
- The updater downloads a manifest from a known URL over https://, using
libCurl. The base URL is platform-specific (it might be
https://example.com/mac/, or https://example.com/linux-x86/, whatever).
The url might have other features, like a updater version or a specific
product name, etc.
The manifest is at $BASEURL/manifest.txt
- The updater also downloads $BASEURL/manifest.txt.sig, which is a digital
signature for the manifest. It checks the manifest against this signature
and a known public RSA key; if the manifest doesn't match the signature,
the updater refuses to continue.
- The manifest looks like this: three lines per item...
Contents/MacOS/baseq3/uix86_64.dylib
332428
a49bbe77f8eb6c195265ea136f881f7830db58e4d8a883b27f59e1e23e396a20
- That's the file's path, its size in bytes, and an sha256 hash of the data.
- The file will be at this path under the base url on the webserver.
- The manifest only lists files that ever needed updating; it's not necessary
to list every file in the game's installation (unless you want to allow the
entire game to download).
- The updater will check each item in the manifest:
- Does the file not exist in the install? Needs downloading.
- Does the file have a different size? Needs downloading.
- Does the file have a different sha256sum? Needs downloading.
- Otherwise, file is up to date, leave it alone.
- If an item needs downloading, do these same checks against the file in the
download directory (if it's already there and matches, don't download again.)
- Download necessary files with libcurl, put it in a download directory.
- The downloaded file is also checked for size and sha256 vs the manifest, to
make sure there was no corruption or confusion. If a downloaded file doesn't
match what was expected, the updater aborts and will try again next time.
This could fail checksum due to i/o errors and compromised security, but
it might just be that a new version was being published and bad luck
happened, and a retry later could correct everything.
- If the updater itself needs upgrading, we deal with that first. It's
downloaded, then the updater relaunches from the downloaded binary with
a special command line. That relaunched process copies itself to the proper
location, and then relaunches _again_ to restart the normal updating
process with the new updater in its correct position.
- Once the downloads are complete and the updater itself doesn't need
upgrading, we are ready to start the normal upgrade. Since we can't replace
executables on some platforms while they are running, and swapping out a
game's data files at runtime isn't wise in general, the updater will now
block until the game terminates. It does this by reading on the pipe that
the game created when forking the updater; since the game never writes
anything to this pipe, it causes the updater to block until the pipe closes.
Since the game never deliberately closes the pipe either, it remains open
until the OS forcibly closes it as the game process terminates. Being an
unnamed pipe, it just vaporizes at this point, leaving no state that might
accidentally hang us up later, like a global semaphore or whatnot. This
technique also lets us localize the game's code changes to one small block
of C code, with no need to manage these resources elsewhere.
- As a sanity check, the updater will also kill(game_process_id, 0) until it
fails, sleeping for 100 milliseconds between each attempt, in case the
process is still being cleaned up by the OS after closing the pipe.
- Once the updater is confident the game process is gone, it will start
upgrading the appropriate files. It does this in two steps: it moves
the old file to a "rollback" directory so it's out of the way but still
available, then it moves the newly-downloaded file into place. Since these
are all simple renames and not copies, this can move fast. Any missing
parent directories are created, in case the update is adding a new file
in a directory that didn't previously exist.
- If something goes wrong at this point (file i/o error, etc), the updater
will roll back the changes by deleting the updated files, and moving the
files in the "rollback" directory back to their original locations. Then
the updater aborts.
- If nothing went wrong, the rollback files are deleted. And we are officially
up to date! The updater terminates.
The updater is designed to fail at any point. If a download fails, it'll
pick up and try again next time, etc. Completed downloads will remain, so it
will just need to download any missing/incomplete files.
The server side just needs to be able to serve static files over HTTPS from
any standard Apache/nginx/whatever process.
Failure points:
- If the updater fails when still downloading data, it just picks up on next
restart.
- If the updater fails when replacing files, it rolls back any changes it has
made.
- If the updater fails when rolling back, then running the updater again after
fixing the specific problem (disk error, etc?) will redownload and replace
any files that were left in an uncertain state. The only true point of
risk is crashing during a rollback and then having the updater bricked for
some reason, but that's an extremely small surface area, knock on wood.
- If the updater crashes or totally bricks, ioquake3 should just keep being
ioquake3. It will still launch and play, even if the updater is quietly
segfaulting in the background on startup.
- If an update bricks ioquake3 to the point where it can't run the updater,
running the updater directly should let it recover (assuming a future update
fixes the problem).
- If the download server is compromised, they would need the private key
(not stored on the download server) to alter the manifest to serve
compromised files to players. If they try to change a file or the manifest,
the updater will know to abort without updating anything.
- If the private key is compromised, we generate a new one, ship new
installers with an updated public key, and re-sign the manifest with the
new private key. Existing installations will never update again until they
do a fresh install, or at least update their copy of the public key.
How manifest signing works:
Some admin will generate a public/private key with the rsa_make_keys program,
keeping the private key secret. Using the private key and the rsa_sign
program, the admin will sign the manifest, generating manifest.txt.sig.
The public key ships with the game (adding 270 bytes to the download), the
.sig is downloaded with the manifest by the autoupdater (256 bytes extra
download), then the autoupdater checks the manifest against the signature
with the public key. if the signature isn't valid (the manifest was tampered
with or corrupt), the autoupdater refuses to continue.
If the manifest is to be trusted, it lists sha256 checksums for every file to
download, so there's no need to sign every file; if they can't tamper with the
manifest, they can't tamper with any other file to be updated since the file's
listed sha256 won't match.
If the private key is compromised, we generate new keys and ship new
installers, so new installations will be able to update but existing ones
will need to do a new install to keep getting updates. Don't let the private
key get compromised. The private key doesn't go on a public server. Maybe it
doesn't even live on the admin's laptop hard drive.
If the download server is compromised and serving malware, the autoupdater
will reject it outright if they haven't compromised the private key, generated
a new manifest, and signed it with the private key.
Items to consider for future revisions:
- Maybe put a limit on the number manifest downloads, so we only check once
every hour? Every day?
- Channels? Stable (what everyone gets by default), Nightly (once a day),
Experimental (some other work-in-progress branch), Bloody (literally the
latest commit).
- Let mods update, separate from the main game?
Questions? Ask Ryan: icculus@icculus.org
--ryan.

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -25,41 +25,6 @@
* Main include header for the SDL library * Main include header for the SDL library
*/ */
/**
* \mainpage Simple DirectMedia Layer (SDL)
*
* http://www.libsdl.org/
*
* \section intro_sec Introduction
*
* Simple DirectMedia Layer is a cross-platform development library designed
* to provide low level access to audio, keyboard, mouse, joystick, and
* graphics hardware via OpenGL and Direct3D. It is used by video playback
* software, emulators, and popular games including Valve's award winning
* catalog and many Humble Bundle games.
*
* SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
* Support for other platforms may be found in the source code.
*
* SDL is written in C, works natively with C++, and there are bindings
* available for several other languages, including C# and Python.
*
* This library is distributed under the zlib license, which can be found
* in the file "COPYING.txt".
*
* The best way to learn how to use SDL is to check out the header files in
* the "include" subdirectory and the programs in the "test" subdirectory.
* The header files and test programs are well commented and always up to date.
* More documentation and FAQs are available online at:
* http://wiki.libsdl.org/
*
* If you need help with the library, or just want to discuss SDL related
* issues, you can join the developers mailing list:
* http://www.libsdl.org/mailing-list.php
*
* Enjoy!
* Sam Lantinga (slouken@libsdl.org)
*/
#ifndef _SDL_H #ifndef _SDL_H
#define _SDL_H #define _SDL_H
@ -114,7 +79,7 @@ extern "C" {
#define SDL_INIT_HAPTIC 0x00001000 #define SDL_INIT_HAPTIC 0x00001000
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ #define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000 #define SDL_INIT_EVENTS 0x00004000
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ #define SDL_INIT_NOPARACHUTE 0x00100000 /**< compatibility; this flag is ignored. */
#define SDL_INIT_EVERYTHING ( \ #define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
@ -123,13 +88,17 @@ extern "C" {
/** /**
* This function initializes the subsystems specified by \c flags * This function initializes the subsystems specified by \c flags
* Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV).
*/ */
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
/** /**
* This function initializes specific SDL subsystems * This function initializes specific SDL subsystems
*
* Subsystem initialization is ref-counted, you must call
* SDL_QuitSubSystem for each SDL_InitSubSystem to correctly
* shutdown a subsystem manually (or call SDL_Quit to force shutdown).
* If a subsystem is already loaded then this call will
* increase the ref-count and return.
*/ */
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -51,7 +51,7 @@ assert can have unique static variables associated with it.
/* Don't include intrin.h here because it contains C++ code */ /* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void); extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak() #define SDL_TriggerBreakpoint() __debugbreak()
#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) #elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif defined(HAVE_SIGNAL_H) #elif defined(HAVE_SIGNAL_H)
#include <signal.h> #include <signal.h>
@ -86,8 +86,10 @@ This also solves the problem of...
disable assertions. disable assertions.
*/ */
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
this condition isn't constant. And looks like an owl's face! */
#ifdef _MSC_VER /* stupid /W4 warnings. */ #ifdef _MSC_VER /* stupid /W4 warnings. */
#define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__) #define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
#else #else
#define SDL_NULL_WHILE_LOOP_CONDITION (0) #define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif #endif
@ -102,9 +104,9 @@ typedef enum
SDL_ASSERTION_ABORT, /**< Terminate the program. */ SDL_ASSERTION_ABORT, /**< Terminate the program. */
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ 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; } SDL_AssertState;
typedef struct SDL_assert_data typedef struct SDL_AssertData
{ {
int always_ignore; int always_ignore;
unsigned int trigger_count; unsigned int trigger_count;
@ -112,13 +114,13 @@ typedef struct SDL_assert_data
const char *filename; const char *filename;
int linenum; int linenum;
const char *function; const char *function;
const struct SDL_assert_data *next; const struct SDL_AssertData *next;
} SDL_assert_data; } SDL_AssertData;
#if (SDL_ASSERT_LEVEL > 0) #if (SDL_ASSERT_LEVEL > 0)
/* Never call this directly. Use the SDL_assert* macros. */ /* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
const char *, const char *,
const char *, int) const char *, int)
#if defined(__clang__) #if defined(__clang__)
@ -141,16 +143,13 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
#define SDL_enabled_assert(condition) \ #define SDL_enabled_assert(condition) \
do { \ do { \
while ( !(condition) ) { \ while ( !(condition) ) { \
static struct SDL_assert_data assert_data = { \ static struct SDL_AssertData sdl_assert_data = { \
0, 0, #condition, 0, 0, 0, 0 \ 0, 0, #condition, 0, 0, 0, 0 \
}; \ }; \
const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
SDL_FUNCTION, \ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
SDL_FILE, \
SDL_LINE); \
if (state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \ continue; /* go again. */ \
} else if (state == SDL_ASSERTION_BREAK) { \ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
SDL_TriggerBreakpoint(); \ SDL_TriggerBreakpoint(); \
} \ } \
break; /* not retrying. */ \ break; /* not retrying. */ \
@ -184,8 +183,8 @@ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
#define SDL_assert_always(condition) SDL_enabled_assert(condition) #define SDL_assert_always(condition) SDL_enabled_assert(condition)
typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
const SDL_assert_data* data, void* userdata); const SDL_AssertData* data, void* userdata);
/** /**
* \brief Set an application-defined assertion handler. * \brief Set an application-defined assertion handler.
@ -202,7 +201,7 @@ typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
* *
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
* *
* \return SDL_assert_state value of how to handle the assertion failure. * \return SDL_AssertState value of how to handle the assertion failure.
* *
* \param handler Callback function, called when an assertion fails. * \param handler Callback function, called when an assertion fails.
* \param userdata A pointer passed to the callback as-is. * \param userdata A pointer passed to the callback as-is.
@ -249,7 +248,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
* The proper way to examine this data looks something like this: * The proper way to examine this data looks something like this:
* *
* <code> * <code>
* const SDL_assert_data *item = SDL_GetAssertionReport(); * const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) { * while (item) {
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
* item->condition, item->function, item->filename, * item->condition, item->function, item->filename,
@ -262,7 +261,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse
* \return List of all assertions. * \return List of all assertions.
* \sa SDL_ResetAssertionReport * \sa SDL_ResetAssertionReport
*/ */
extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void); extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
/** /**
* \brief Reset the list of all assertion failures. * \brief Reset the list of all assertion failures.
@ -273,6 +272,12 @@ extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
*/ */
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
/* these had wrong naming conventions until 2.0.4. Please update your app! */
#define SDL_assert_state SDL_AssertState
#define SDL_assert_data SDL_AssertData
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -122,7 +122,8 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
void _ReadWriteBarrier(void); void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier) #pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier() #define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif defined(__GNUC__) #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#else #else
#define SDL_CompilerBarrier() \ #define SDL_CompilerBarrier() \
@ -169,10 +170,17 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#endif /* __GNUC__ && __arm__ */ #endif /* __GNUC__ && __arm__ */
#else #else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
#include <mbarrier.h>
#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
#else
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ /* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() #define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() #define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
#endif #endif
#endif
/** /**
* \brief A type representing an atomic integer value. It is a struct * \brief A type representing an atomic integer value. It is a struct

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -155,6 +155,9 @@ typedef Uint16 SDL_AudioFormat;
* *
* Once the callback returns, the buffer will no longer be valid. * Once the callback returns, the buffer will no longer be valid.
* Stereo samples are stored in a LRLRLR ordering. * Stereo samples are stored in a LRLRLR ordering.
*
* You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
* you like. Just open your audio device with a NULL callback.
*/ */
typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
int len); int len);
@ -171,8 +174,8 @@ typedef struct SDL_AudioSpec
Uint16 samples; /**< Audio buffer size in samples (power of 2) */ Uint16 samples; /**< Audio buffer size in samples (power of 2) */
Uint16 padding; /**< Necessary for some compile environments */ Uint16 padding; /**< Necessary for some compile environments */
Uint32 size; /**< Audio buffer size in bytes (calculated) */ Uint32 size; /**< Audio buffer size in bytes (calculated) */
SDL_AudioCallback callback; SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
void *userdata; void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
} SDL_AudioSpec; } SDL_AudioSpec;
@ -273,9 +276,11 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
* to the audio buffer, and the length in bytes of the audio buffer. * to the audio buffer, and the length in bytes of the audio buffer.
* This function usually runs in a separate thread, and so you should * This function usually runs in a separate thread, and so you should
* protect data structures that it accesses by calling SDL_LockAudio() * protect data structures that it accesses by calling SDL_LockAudio()
* and SDL_UnlockAudio() in your code. * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL
* pointer here, and call SDL_QueueAudio() with some frequency, to queue
* more audio samples to be played.
* - \c desired->userdata is passed as the first parameter to your callback * - \c desired->userdata is passed as the first parameter to your callback
* function. * function. If you passed a NULL callback, this value is ignored.
* *
* The audio device starts out playing silence when it's opened, and should * The audio device starts out playing silence when it's opened, and should
* be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready
@ -474,6 +479,100 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
SDL_AudioFormat format, SDL_AudioFormat format,
Uint32 len, int volume); Uint32 len, int volume);
/**
* Queue more audio on non-callback devices.
*
* SDL offers two ways to feed audio to the device: you can either supply a
* callback that SDL triggers with some frequency to obtain more audio
* (pull method), or you can supply no callback, and then SDL will expect
* you to supply data at regular intervals (push method) with this function.
*
* There are no limits on the amount of data you can queue, short of
* exhaustion of address space. Queued data will drain to the device as
* necessary without further intervention from you. If the device needs
* audio but there is not enough queued, it will play silence to make up
* the difference. This means you will have skips in your audio playback
* if you aren't routinely queueing sufficient data.
*
* This function copies the supplied data, so you are safe to free it when
* the function returns. This function is thread-safe, but queueing to the
* same device from two threads at once does not promise which buffer will
* be queued first.
*
* You may not queue audio on a device that is using an application-supplied
* callback; doing so returns an error. You have to use the audio callback
* or queue audio with this function, but not both.
*
* You should not call SDL_LockAudio() on the device before queueing; SDL
* handles locking internally for this function.
*
* \param dev The device ID to which we will queue audio.
* \param data The data to queue to the device for later playback.
* \param len The number of bytes (not samples!) to which (data) points.
* \return zero on success, -1 on error.
*
* \sa SDL_GetQueuedAudioSize
* \sa SDL_ClearQueuedAudio
*/
extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len);
/**
* Get the number of bytes of still-queued audio.
*
* This is the number of bytes that have been queued for playback with
* SDL_QueueAudio(), but have not yet been sent to the hardware.
*
* Once we've sent it to the hardware, this function can not decide the exact
* byte boundary of what has been played. It's possible that we just gave the
* hardware several kilobytes right before you called this function, but it
* hasn't played any of it yet, or maybe half of it, etc.
*
* You may not queue audio on a device that is using an application-supplied
* callback; calling this function on such a device always returns 0.
* You have to use the audio callback or queue audio with SDL_QueueAudio(),
* but not both.
*
* You should not call SDL_LockAudio() on the device before querying; SDL
* handles locking internally for this function.
*
* \param dev The device ID of which we will query queued audio size.
* \return Number of bytes (not samples!) of queued audio.
*
* \sa SDL_QueueAudio
* \sa SDL_ClearQueuedAudio
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
/**
* Drop any queued audio data waiting to be sent to the hardware.
*
* Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and
* the hardware will start playing silence if more audio isn't queued.
*
* This will not prevent playback of queued audio that's already been sent
* to the hardware, as we can not undo that, so expect there to be some
* fraction of a second of audio that might still be heard. This can be
* useful if you want to, say, drop any pending music during a level change
* in your game.
*
* You may not queue audio on a device that is using an application-supplied
* callback; calling this function on such a device is always a no-op.
* You have to use the audio callback or queue audio with SDL_QueueAudio(),
* but not both.
*
* You should not call SDL_LockAudio() on the device before clearing the
* queue; SDL handles locking internally for this function.
*
* This function always succeeds and thus returns void.
*
* \param dev The device ID of which to clear the audio queue.
*
* \sa SDL_QueueAudio
* \sa SDL_GetQueuedAudioSize
*/
extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
/** /**
* \name Audio lock functions * \name Audio lock functions
* *

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -58,6 +58,6 @@ typedef enum
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* _SDL_video_h */ #endif /* _SDL_blendmode_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -46,7 +46,15 @@
#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@
#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@
#cmakedefine HAVE_PTHREAD_SPINLOCK @HAVE_PTHREAD_SPINLOCK@
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@
#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@
#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@
#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@
#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
/* Comment this if you want to build without any C library requirements */ /* Comment this if you want to build without any C library requirements */
#cmakedefine HAVE_LIBC 1 #cmakedefine HAVE_LIBC 1
@ -143,6 +151,9 @@
#cmakedefine HAVE_SIN 1 #cmakedefine HAVE_SIN 1
#cmakedefine HAVE_SINF 1 #cmakedefine HAVE_SINF 1
#cmakedefine HAVE_SQRT 1 #cmakedefine HAVE_SQRT 1
#cmakedefine HAVE_SQRTF 1
#cmakedefine HAVE_TAN 1
#cmakedefine HAVE_TANF 1
#cmakedefine HAVE_FSEEKO 1 #cmakedefine HAVE_FSEEKO 1
#cmakedefine HAVE_FSEEKO64 1 #cmakedefine HAVE_FSEEKO64 1
#cmakedefine HAVE_SIGACTION 1 #cmakedefine HAVE_SIGACTION 1
@ -186,6 +197,7 @@
#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
/* Enable various audio drivers */ /* Enable various audio drivers */
#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@
#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@
@ -213,23 +225,29 @@
#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ #cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@
#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@
/* Enable various input drivers */ /* Enable various input drivers */
#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@ #cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@ #cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@
#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@
#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ #cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@
#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@ #cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@ #cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@
#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ #cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@
#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@
#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
/* Enable various shared object loading systems */ /* Enable various shared object loading systems */
#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@ #cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@
@ -252,6 +270,7 @@
#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@ #cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
/* Enable various video drivers */ /* Enable various video drivers */
#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@ #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@
#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@ #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
@ -259,19 +278,20 @@
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@ #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@
#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
#if 0 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
/* !!! FIXME: in configure script version, missing here: */ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
#endif
#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@ #cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@ #cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@
#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@
#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@
@ -282,6 +302,7 @@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@
#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ #cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@
#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@
#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@
#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@
@ -290,7 +311,6 @@
#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32@
#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@ #cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
@ -314,18 +334,22 @@
#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
/* Enable system power support */ /* Enable system power support */
#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@ #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@ #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@ #cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
/* Enable system filesystem support */ /* Enable system filesystem support */
#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@ #cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@
#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@ #cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@
#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@ #cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@
#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ #cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@
#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ #cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@
#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@
/* Enable assembly routines */ /* Enable assembly routines */
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -49,7 +49,12 @@
#endif #endif
#undef HAVE_GCC_ATOMICS #undef HAVE_GCC_ATOMICS
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
#undef HAVE_PTHREAD_SPINLOCK
#undef HAVE_DDRAW_H
#undef HAVE_DINPUT_H
#undef HAVE_DSOUND_H
#undef HAVE_DXGI_H
#undef HAVE_XINPUT_H
/* Comment this if you want to build without any C library requirements */ /* Comment this if you want to build without any C library requirements */
#undef HAVE_LIBC #undef HAVE_LIBC
@ -76,6 +81,7 @@
#undef HAVE_PTHREAD_NP_H #undef HAVE_PTHREAD_NP_H
#undef HAVE_LIBUDEV_H #undef HAVE_LIBUDEV_H
#undef HAVE_DBUS_DBUS_H #undef HAVE_DBUS_DBUS_H
#undef HAVE_IBUS_IBUS_H
/* C library functions */ /* C library functions */
#undef HAVE_MALLOC #undef HAVE_MALLOC
@ -148,6 +154,9 @@
#undef HAVE_SIN #undef HAVE_SIN
#undef HAVE_SINF #undef HAVE_SINF
#undef HAVE_SQRT #undef HAVE_SQRT
#undef HAVE_SQRTF
#undef HAVE_TAN
#undef HAVE_TANF
#undef HAVE_FSEEKO #undef HAVE_FSEEKO
#undef HAVE_FSEEKO64 #undef HAVE_FSEEKO64
#undef HAVE_SIGACTION #undef HAVE_SIGACTION
@ -201,10 +210,12 @@
#undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DISK #undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY #undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_ANDROID
#undef SDL_AUDIO_DRIVER_XAUDIO2 #undef SDL_AUDIO_DRIVER_XAUDIO2
#undef SDL_AUDIO_DRIVER_DSOUND #undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_ESD #undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
#undef SDL_AUDIO_DRIVER_NACL
#undef SDL_AUDIO_DRIVER_NAS #undef SDL_AUDIO_DRIVER_NAS
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
#undef SDL_AUDIO_DRIVER_SNDIO #undef SDL_AUDIO_DRIVER_SNDIO
@ -217,6 +228,7 @@
#undef SDL_AUDIO_DRIVER_WINMM #undef SDL_AUDIO_DRIVER_WINMM
#undef SDL_AUDIO_DRIVER_FUSIONSOUND #undef SDL_AUDIO_DRIVER_FUSIONSOUND
#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
#undef SDL_AUDIO_DRIVER_EMSCRIPTEN
/* Enable various input drivers */ /* Enable various input drivers */
#undef SDL_INPUT_LINUXEV #undef SDL_INPUT_LINUXEV
@ -224,16 +236,20 @@
#undef SDL_INPUT_TSLIB #undef SDL_INPUT_TSLIB
#undef SDL_JOYSTICK_HAIKU #undef SDL_JOYSTICK_HAIKU
#undef SDL_JOYSTICK_DINPUT #undef SDL_JOYSTICK_DINPUT
#undef SDL_JOYSTICK_XINPUT
#undef SDL_JOYSTICK_DUMMY #undef SDL_JOYSTICK_DUMMY
#undef SDL_JOYSTICK_IOKIT #undef SDL_JOYSTICK_IOKIT
#undef SDL_JOYSTICK_LINUX #undef SDL_JOYSTICK_LINUX
#undef SDL_JOYSTICK_ANDROID
#undef SDL_JOYSTICK_WINMM #undef SDL_JOYSTICK_WINMM
#undef SDL_JOYSTICK_USBHID #undef SDL_JOYSTICK_USBHID
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
#undef SDL_JOYSTICK_EMSCRIPTEN
#undef SDL_HAPTIC_DUMMY #undef SDL_HAPTIC_DUMMY
#undef SDL_HAPTIC_LINUX #undef SDL_HAPTIC_LINUX
#undef SDL_HAPTIC_IOKIT #undef SDL_HAPTIC_IOKIT
#undef SDL_HAPTIC_DINPUT #undef SDL_HAPTIC_DINPUT
#undef SDL_HAPTIC_XINPUT
/* Enable various shared object loading systems */ /* Enable various shared object loading systems */
#undef SDL_LOADSO_HAIKU #undef SDL_LOADSO_HAIKU
@ -272,6 +288,8 @@
#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
#undef SDL_VIDEO_DRIVER_X11 #undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_RPI #undef SDL_VIDEO_DRIVER_RPI
#undef SDL_VIDEO_DRIVER_ANDROID
#undef SDL_VIDEO_DRIVER_EMSCRIPTEN
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
@ -281,6 +299,7 @@
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
#undef SDL_VIDEO_DRIVER_X11_XCURSOR #undef SDL_VIDEO_DRIVER_X11_XCURSOR
#undef SDL_VIDEO_DRIVER_X11_XDBE
#undef SDL_VIDEO_DRIVER_X11_XINERAMA #undef SDL_VIDEO_DRIVER_X11_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_XINPUT2 #undef SDL_VIDEO_DRIVER_X11_XINPUT2
#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
@ -289,9 +308,11 @@
#undef SDL_VIDEO_DRIVER_X11_XSHAPE #undef SDL_VIDEO_DRIVER_X11_XSHAPE
#undef SDL_VIDEO_DRIVER_X11_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_XVIDMODE
#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32
#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
#undef SDL_VIDEO_DRIVER_NACL
#undef SDL_VIDEO_DRIVER_VIVANTE
#undef SDL_VIDEO_DRIVER_VIVANTE_VDK
#undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D
#undef SDL_VIDEO_RENDER_D3D11 #undef SDL_VIDEO_RENDER_D3D11
@ -317,6 +338,8 @@
#undef SDL_POWER_WINDOWS #undef SDL_POWER_WINDOWS
#undef SDL_POWER_MACOSX #undef SDL_POWER_MACOSX
#undef SDL_POWER_HAIKU #undef SDL_POWER_HAIKU
#undef SDL_POWER_ANDROID
#undef SDL_POWER_EMSCRIPTEN
#undef SDL_POWER_HARDWIRED #undef SDL_POWER_HARDWIRED
/* Enable system filesystem support */ /* Enable system filesystem support */
@ -325,6 +348,9 @@
#undef SDL_FILESYSTEM_DUMMY #undef SDL_FILESYSTEM_DUMMY
#undef SDL_FILESYSTEM_UNIX #undef SDL_FILESYSTEM_UNIX
#undef SDL_FILESYSTEM_WINDOWS #undef SDL_FILESYSTEM_WINDOWS
#undef SDL_FILESYSTEM_NACL
#undef SDL_FILESYSTEM_ANDROID
#undef SDL_FILESYSTEM_EMSCRIPTEN
/* Enable assembly routines */ /* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES #undef SDL_ASSEMBLY_ROUTINES

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -43,7 +43,6 @@
#define HAVE_STDINT_H 1 #define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1 #define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1 #define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
/* C library functions */ /* C library functions */
#define HAVE_MALLOC 1 #define HAVE_MALLOC 1
@ -76,7 +75,6 @@
#define HAVE_STRTOULL 1 #define HAVE_STRTOULL 1
#define HAVE_STRTOD 1 #define HAVE_STRTOD 1
#define HAVE_ATOI 1 #define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1 #define HAVE_STRCMP 1
#define HAVE_STRNCMP 1 #define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1 #define HAVE_STRCASECMP 1
@ -100,10 +98,13 @@
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SIGACTION 1 #define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1 #define HAVE_SYSCONF 1
#define HAVE_CLOCK_GETTIME 1
#define SIZEOF_VOIDP 4 #define SIZEOF_VOIDP 4
@ -138,7 +139,7 @@
/* Enable system power support */ /* Enable system power support */
#define SDL_POWER_ANDROID 1 #define SDL_POWER_ANDROID 1
/* !!! FIXME: what does Android do for filesystem stuff? */ /* Enable the filesystem driver */
#define SDL_FILESYSTEM_DUMMY 1 #define SDL_FILESYSTEM_ANDROID 1
#endif /* _SDL_config_android_h */ #endif /* _SDL_config_android_h */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -98,6 +98,9 @@
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SIGACTION 1 #define HAVE_SIGACTION 1
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
@ -110,10 +113,13 @@
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1 #define SDL_HAPTIC_DUMMY 1
/* Enable MFi joystick support */
#define SDL_JOYSTICK_MFI 1
/* Enable Unix style SO loading */ /* Enable Unix style SO loading */
/* Technically this works, but it violates the iPhone developer agreement */ /* Technically this works, but violates the iOS dev agreement prior to iOS 8 */
/* #define SDL_LOADSO_DLOPEN 1 */ /* #define SDL_LOADSO_DLOPEN 1 */
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ /* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
@ -131,6 +137,7 @@
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
/* enable OpenGL ES */ /* enable OpenGL ES */
#define SDL_VIDEO_OPENGL_ES2 1
#define SDL_VIDEO_OPENGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES2 1 #define SDL_VIDEO_RENDER_OGL_ES2 1
@ -141,11 +148,11 @@
/* enable iPhone keyboard support */ /* enable iPhone keyboard support */
#define SDL_IPHONE_KEYBOARD 1 #define SDL_IPHONE_KEYBOARD 1
/* enable joystick subsystem */ /* enable iOS extended launch screen */
#define SDL_JOYSTICK_DISABLED 0 #define SDL_IPHONE_LAUNCHSCREEN 1
/* Set max recognized G-force from accelerometer /* Set max recognized G-force from accelerometer
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
*/ */
#define SDL_IPHONE_MAX_GFORCE 5.0 #define SDL_IPHONE_MAX_GFORCE 5.0

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -96,6 +96,9 @@
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SIGACTION 1 #define HAVE_SIGACTION 1
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
@ -136,6 +139,7 @@
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" #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_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_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
#define SDL_VIDEO_DRIVER_X11_XDBE 1
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -95,6 +95,9 @@
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SIGACTION 1 #define HAVE_SIGACTION 1
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -98,6 +98,9 @@
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
/* #define HAVE_SYSCONF 1 */ /* #define HAVE_SYSCONF 1 */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -76,6 +76,12 @@ typedef unsigned int uintptr_t;
# define SIZEOF_VOIDP 4 # define SIZEOF_VOIDP 4
#endif #endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC #ifdef HAVE_LIBC
/* Useful headers */ /* Useful headers */
@ -130,6 +136,9 @@ typedef unsigned int uintptr_t;
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#if _MSC_VER >= 1800 #if _MSC_VER >= 1800
#define HAVE_STRTOLL 1 #define HAVE_STRTOLL 1
#define HAVE_VSSCANF 1 #define HAVE_VSSCANF 1
@ -153,7 +162,9 @@ typedef unsigned int uintptr_t;
/* Enable various input drivers */ /* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1 #define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* Enable various shared object loading systems */ /* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1 #define SDL_LOADSO_WINDOWS 1

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -19,11 +19,26 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#ifndef _SDL_config_windows_h #ifndef _SDL_config_winrt_h
#define _SDL_config_windows_h #define _SDL_config_winrt_h
#include "SDL_platform.h" #include "SDL_platform.h"
/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used
by SDL to determine which version of the Windows SDK is being used.
*/
#include <sdkddkver.h>
/* Define possibly-undefined NTDDI values (used when compiling SDL against
older versions of the Windows SDK.
*/
#ifndef NTDDI_WINBLUE
#define NTDDI_WINBLUE 0x06030000
#endif
#ifndef NTDDI_WIN10
#define NTDDI_WIN10 0x0A000000
#endif
/* This is a set of defines to configure the SDL features */ /* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
@ -77,6 +92,10 @@ typedef unsigned int uintptr_t;
#endif #endif
/* Useful headers */ /* Useful headers */
#define HAVE_DXGI_H 1
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
#define HAVE_XINPUT_H 1
#endif
#define HAVE_LIBC 1 #define HAVE_LIBC 1
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
#define STDC_HEADERS 1 #define STDC_HEADERS 1
@ -136,6 +155,9 @@ typedef unsigned int uintptr_t;
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE__FSEEKI64 1 #define HAVE__FSEEKI64 1
/* Enable various audio drivers */ /* Enable various audio drivers */
@ -144,20 +166,24 @@ typedef unsigned int uintptr_t;
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */ /* Enable various input drivers */
// TODO, WinRT: Get haptic support working
#define SDL_HAPTIC_DISABLED 1
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#define SDL_JOYSTICK_DISABLED 1 #define SDL_JOYSTICK_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
#else #else
#define SDL_JOYSTICK_XINPUT 1 #define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_XINPUT 1
#endif #endif
/* Enable various shared object loading systems */ /* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1 #define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */ /* Enable various threading systems */
#if (NTDDI_VERSION >= NTDDI_WINBLUE)
#define SDL_THREAD_WINDOWS 1
#else
/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
#define SDL_THREAD_STDCPP 1 #define SDL_THREAD_STDCPP 1
#endif
/* Enable various timer systems */ /* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1 #define SDL_TIMER_WINDOWS 1
@ -167,10 +193,8 @@ typedef unsigned int uintptr_t;
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP /* TODO, WinRT: try adding OpenGL ES 2 support for Windows Phone 8 */
#define SDL_VIDEO_OPENGL_ES2 1 #define SDL_VIDEO_OPENGL_ES2 1
#define SDL_VIDEO_OPENGL_EGL 1 #define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable appropriate renderer(s) */ /* Enable appropriate renderer(s) */
#define SDL_VIDEO_RENDER_D3D11 1 #define SDL_VIDEO_RENDER_D3D11 1
@ -187,4 +211,4 @@ typedef unsigned int uintptr_t;
#define SDL_ASSEMBLY_ROUTINES 1 #define SDL_ASSEMBLY_ROUTINES 1
#endif #endif
#endif /* _SDL_config_windows_h */ #endif /* _SDL_config_winrt_h */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -89,12 +89,14 @@
#define HAVE_SIN 1 #define HAVE_SIN 1
#define HAVE_SINF 1 #define HAVE_SINF 1
#define HAVE_SQRT 1 #define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SIGACTION 1 #define HAVE_SIGACTION 1
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1 #define HAVE_NANOSLEEP 1
#define HAVE_POW 1 #define HAVE_POW 1
#define SDL_CDROM_DISABLED 1
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_OSS 1 #define SDL_AUDIO_DRIVER_OSS 1

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -139,6 +139,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
/**
* This function returns true if the CPU has AVX2 features.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
/** /**
* This function returns the amount of RAM configured in the system, in MB. * This function returns the amount of RAM configured in the system, in MB.
*/ */

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -42,7 +42,7 @@
#ifdef __linux__ #ifdef __linux__
#include <endian.h> #include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER #define SDL_BYTEORDER __BYTE_ORDER
#else /* __linux __ */ #else /* __linux__ */
#if defined(__hppa__) || \ #if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \ (defined(__MIPS__) && defined(__MISPEB__)) || \
@ -52,7 +52,7 @@
#else #else
#define SDL_BYTEORDER SDL_LIL_ENDIAN #define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif #endif
#endif /* __linux __ */ #endif /* __linux__ */
#endif /* !SDL_BYTEORDER */ #endif /* !SDL_BYTEORDER */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -38,7 +38,7 @@ extern "C" {
/* Public functions */ /* Public functions */
/* SDL_SetError() unconditionally returns -1. */ /* SDL_SetError() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...); extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
extern DECLSPEC const char *SDLCALL SDL_GetError(void); extern DECLSPEC const char *SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void); extern DECLSPEC void SDLCALL SDL_ClearError(void);

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -59,7 +59,7 @@ typedef enum
/* Application events */ /* Application events */
SDL_QUIT = 0x100, /**< User-requested quit */ SDL_QUIT = 0x100, /**< User-requested quit */
/* These application events have special meaning on iOS, see README-ios.txt for details */ /* These application events have special meaning on iOS, see README-ios.md for details */
SDL_APP_TERMINATING, /**< The application is being terminated by the OS SDL_APP_TERMINATING, /**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate() Called on iOS in applicationWillTerminate()
Called on Android in onDestroy() Called on Android in onDestroy()
@ -94,6 +94,9 @@ typedef enum
SDL_KEYUP, /**< Key released */ SDL_KEYUP, /**< Key released */
SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ SDL_TEXTEDITING, /**< Keyboard text editing (composition) */
SDL_TEXTINPUT, /**< Keyboard text input */ SDL_TEXTINPUT, /**< Keyboard text input */
SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
input language or keyboard layout change.
*/
/* Mouse events */ /* Mouse events */
SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
@ -134,8 +137,13 @@ typedef enum
/* Drag and drop events */ /* Drag and drop events */
SDL_DROPFILE = 0x1000, /**< The system requests a file open */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */
/* Audio hotplug events */
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */
/* Render events */ /* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents() * and should be allocated with SDL_RegisterEvents()
@ -259,6 +267,7 @@ typedef struct SDL_MouseWheelEvent
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
} SDL_MouseWheelEvent; } SDL_MouseWheelEvent;
/** /**
@ -380,6 +389,20 @@ typedef struct SDL_ControllerDeviceEvent
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent; } SDL_ControllerDeviceEvent;
/**
* \brief Audio device event structure (event.adevice.*)
*/
typedef struct SDL_AudioDeviceEvent
{
Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
Uint32 timestamp;
Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
} SDL_AudioDeviceEvent;
/** /**
* \brief Touch finger event structure (event.tfinger.*) * \brief Touch finger event structure (event.tfinger.*)
@ -392,8 +415,8 @@ typedef struct SDL_TouchFingerEvent
SDL_FingerID fingerId; SDL_FingerID fingerId;
float x; /**< Normalized in the range 0...1 */ float x; /**< Normalized in the range 0...1 */
float y; /**< Normalized in the range 0...1 */ float y; /**< Normalized in the range 0...1 */
float dx; /**< Normalized in the range 0...1 */ float dx; /**< Normalized in the range -1...1 */
float dy; /**< Normalized in the range 0...1 */ float dy; /**< Normalized in the range -1...1 */
float pressure; /**< Normalized in the range 0...1 */ float pressure; /**< Normalized in the range 0...1 */
} SDL_TouchFingerEvent; } SDL_TouchFingerEvent;
@ -420,7 +443,7 @@ typedef struct SDL_MultiGestureEvent
*/ */
typedef struct SDL_DollarGestureEvent typedef struct SDL_DollarGestureEvent
{ {
Uint32 type; /**< ::SDL_DOLLARGESTURE */ Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
Uint32 timestamp; Uint32 timestamp;
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId; SDL_GestureID gestureId;
@ -433,8 +456,8 @@ typedef struct SDL_DollarGestureEvent
/** /**
* \brief An event used to request a file open by the system (event.drop.*) * \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() * This event is enabled by default, you can disable it with SDL_EventState().
* \note If you enable this event, you must free the filename in the event. * \note If this event is enabled, you must free the filename in the event.
*/ */
typedef struct SDL_DropEvent typedef struct SDL_DropEvent
{ {
@ -514,6 +537,7 @@ typedef union SDL_Event
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
SDL_QuitEvent quit; /**< Quit request event data */ SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */ SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */
@ -583,6 +607,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
/** /**
* This function clears events from the event queue * This function clears events from the event queue
* This function only affects currently queued events. If you want to make
* sure that all pending OS events are flushed, you can call SDL_PumpEvents()
* on the main thread immediately before the flush call.
*/ */
extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* _SDL_system_h */ #endif /* _SDL_filesystem_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -43,7 +43,7 @@ extern "C" {
* \file SDL_gamecontroller.h * \file SDL_gamecontroller.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
* for game controllers, and load appropriate drivers. * for game controllers, and load appropriate drivers.
* *
* If you would like to receive controller updates while the application * If you would like to receive controller updates while the application
@ -163,13 +163,19 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
/** /**
* Open a game controller for use. * Open a game controller for use.
* The index passed as an argument refers to the N'th game controller on the system. * The index passed as an argument refers to the N'th game controller on the system.
* This index is the value which will identify this controller in future controller * This index is not the value which will identify this controller in future
* events. * controller events. The joystick's instance id (::SDL_JoystickID) will be
* used there instead.
* *
* \return A controller identifier, or NULL if an error occurred. * \return A controller identifier, or NULL if an error occurred.
*/ */
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index);
/**
* Return the SDL_GameController associated with an instance id.
*/
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
/** /**
* Return the name for this currently opened controller * Return the name for this currently opened controller
*/ */
@ -241,7 +247,8 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
/** /**
* Get the current state of an axis control on a game controller. * Get the current state of an axis control on a game controller.
* *
* The state is a value ranging from -32768 to 32767. * The state is a value ranging from -32768 to 32767 (except for the triggers,
* which range from 0 to 32767).
* *
* The axis indices start at index 0. * The axis indices start at index 0.
*/ */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -102,11 +102,6 @@
* return 0; // Success * return 0; // Success
* } * }
* \endcode * \endcode
*
* You can also find out more information on my blog:
* http://bobbens.dyndns.org/journal/2010/sdl_haptic/
*
* \author Edgar Simo Serra
*/ */
#ifndef _SDL_haptic_h #ifndef _SDL_haptic_h
@ -347,6 +342,9 @@ typedef struct _SDL_Haptic SDL_Haptic;
/** /**
* \brief Structure that represents a haptic direction. * \brief Structure that represents a haptic direction.
* *
* This is the direction where the force comes from,
* instead of the direction in which the force is exerted.
*
* Directions can be specified by: * Directions can be specified by:
* - ::SDL_HAPTIC_POLAR : Specified by polar coordinates. * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
* - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
@ -370,7 +368,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
^ ^
| |
| |
(1,0) West <----[ HAPTIC ]----> East (-1,0) (-1,0) West <----[ HAPTIC ]----> East (1,0)
| |
| |
v v
@ -395,9 +393,9 @@ typedef struct _SDL_Haptic SDL_Haptic;
* (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
* the first three \c dir parameters. The cardinal directions would be: * the first three \c dir parameters. The cardinal directions would be:
* - North: 0,-1, 0 * - North: 0,-1, 0
* - East: -1, 0, 0 * - East: 1, 0, 0
* - South: 0, 1, 0 * - South: 0, 1, 0
* - West: 1, 0, 0 * - West: -1, 0, 0
* *
* The Z axis represents the height of the effect if supported, otherwise * The Z axis represents the height of the effect if supported, otherwise
* it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
@ -492,7 +490,7 @@ typedef struct SDL_HapticConstant
* over time. The type determines the shape of the wave and the parameters * over time. The type determines the shape of the wave and the parameters
* determine the dimensions of the wave. * determine the dimensions of the wave.
* *
* Phase is given by hundredth of a cycle meaning that giving the phase a value * Phase is given by hundredth of a degree meaning that giving the phase a value
* of 9000 will displace it 25% of its period. Here are sample values: * of 9000 will displace it 25% of its period. Here are sample values:
* - 0: No phase displacement. * - 0: No phase displacement.
* - 9000: Displaced 25% of its period. * - 9000: Displaced 25% of its period.
@ -553,9 +551,9 @@ typedef struct SDL_HapticPeriodic
/* Periodic */ /* Periodic */
Uint16 period; /**< Period of the wave. */ Uint16 period; /**< Period of the wave. */
Sint16 magnitude; /**< Peak value. */ Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
Sint16 offset; /**< Mean value of the wave. */ Sint16 offset; /**< Mean value of the wave. */
Uint16 phase; /**< Horizontal shift given by hundredth of a cycle. */ Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */
/* Envelope */ /* Envelope */
Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_length; /**< Duration of the attack. */
@ -604,11 +602,11 @@ typedef struct SDL_HapticCondition
Uint16 interval; /**< How soon it can be triggered again after button. */ Uint16 interval; /**< How soon it can be triggered again after button. */
/* Condition */ /* Condition */
Uint16 right_sat[3]; /**< Level when joystick is to the positive side. */ Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */
Uint16 left_sat[3]; /**< Level when joystick is to the negative side. */ Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */
Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
Uint16 deadband[3]; /**< Size of the dead zone. */ Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
Sint16 center[3]; /**< Position of the dead zone. */ Sint16 center[3]; /**< Position of the dead zone. */
} SDL_HapticCondition; } SDL_HapticCondition;
@ -897,7 +895,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
/** /**
* \brief Opens a Haptic device for usage from a Joystick device. * \brief Opens a Haptic device for usage from a Joystick device.
* *
* You must still close the haptic device seperately. It will not be closed * You must still close the haptic device separately. It will not be closed
* with the joystick. * with the joystick.
* *
* When opening from a joystick you should first close the haptic device before * When opening from a joystick you should first close the haptic device before
@ -954,7 +952,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
/** /**
* \brief Gets the haptic devices supported features in bitwise matter. * \brief Gets the haptic device's supported features in bitwise manner.
* *
* Example: * Example:
* \code * \code
@ -1148,7 +1146,7 @@ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
* *
* Call to unpause after SDL_HapticPause(). * Call to unpause after SDL_HapticPause().
* *
* \param haptic Haptic device to pause. * \param haptic Haptic device to unpause.
* \return 0 on success or -1 on error. * \return 0 on success or -1 on error.
* *
* \sa SDL_HapticPause * \sa SDL_HapticPause

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -116,7 +116,7 @@ extern "C" {
* *
* By default, SDL does not use Direct3D Debug Layer. * By default, SDL does not use Direct3D Debug Layer.
*/ */
#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_HINT_RENDER_DIRECT3D11_DEBUG" #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG"
/** /**
* \brief A variable controlling the scaling quality * \brief A variable controlling the scaling quality
@ -185,6 +185,42 @@ extern "C" {
*/ */
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
/**
* \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
*
* This variable can be set to the following values:
* "0" - Disable _NET_WM_PING
* "1" - Enable _NET_WM_PING
*
* By default SDL will use _NET_WM_PING, but for applications that know they
* will not always be able to respond to ping requests in a timely manner they can
* turn it off to avoid the window manager thinking the app is hung.
* The hint is checked in CreateWindow.
*/
#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING"
/**
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
*
* This variable can be set to the following values:
* "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc)
* "1" - The window frame is interactive when the cursor is hidden
*
* By default SDL will allow interaction with the window frame when the cursor is hidden
*/
#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN"
/**
* \brief A variable controlling whether the windows message loop is processed by SDL
*
* This variable can be set to the following values:
* "0" - The window message loop is not run
* "1" - The window message loop is processed in SDL_PumpEvents()
*
* By default SDL will process the windows message loop
*/
#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP"
/** /**
* \brief A variable controlling whether grabbing input grabs the keyboard * \brief A variable controlling whether grabbing input grabs the keyboard
* *
@ -221,6 +257,9 @@ extern "C" {
* this is problematic. This functionality can be disabled by setting this * this is problematic. This functionality can be disabled by setting this
* hint. * hint.
* *
* As of SDL 2.0.4, SDL_EnableScreenSaver and SDL_DisableScreenSaver accomplish
* the same thing on iOS. They should be preferred over this hint.
*
* This variable can be set to the following values: * This variable can be set to the following values:
* "0" - Enable idle timer * "0" - Enable idle timer
* "1" - Disable idle timer * "1" - Disable idle timer
@ -239,8 +278,9 @@ extern "C" {
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
/** /**
* \brief A variable controlling whether an Android built-in accelerometer should be * \brief A variable controlling whether the Android / iOS built-in
* listed as a joystick device, rather than listing actual joysticks only. * accelerometer should be listed as a joystick device, rather than listing
* actual joysticks only.
* *
* This variable can be set to the following values: * This variable can be set to the following values:
* "0" - List only real joysticks and accept input from them * "0" - List only real joysticks and accept input from them
@ -259,6 +299,16 @@ extern "C" {
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
/**
* \brief A variable that causes SDL to use the old axis and button mapping for XInput devices.
*
* This hint is for backwards compatibility only and will be removed in SDL 2.1
*
* The default value is "0". This hint must be set before SDL_Init()
*/
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
/** /**
* \brief A variable that lets you manually hint extra gamecontroller db entries * \brief A variable that lets you manually hint extra gamecontroller db entries
* *
@ -285,7 +335,7 @@ extern "C" {
/** /**
* \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
* This is a debugging aid for developers and not expected to be used by end users. The default is "1" * This is a debugging aid for developers and not expected to be used by end users. The default is "1"
* *
* This variable can be set to the following values: * This variable can be set to the following values:
@ -312,14 +362,25 @@ extern "C" {
#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
/** /**
* \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac) * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size
*
* Use this hint in case you need to set SDL's threads stack size to other than the default.
* This is specially useful if you build SDL against a non glibc libc library (such as musl) which
* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses).
* Support for this hint is currently available only in the pthread backend.
*/
#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE"
/**
* \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
*/ */
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" #define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED"
/** /**
* \brief A variable that determines whether ctrl+click should generate a right-click event on Mac * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac
* *
* If present, holding ctrl while left clicking will generate a right click * If present, holding ctrl while left clicking will generate a right click
* event when on Mac. * event when on Mac.
*/ */
@ -360,7 +421,7 @@ extern "C" {
*/ */
#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
/* /**
* \brief A URL to a WinRT app's privacy policy * \brief A URL to a WinRT app's privacy policy
* *
* All network-enabled WinRT apps must make a privacy policy available to its * All network-enabled WinRT apps must make a privacy policy available to its
@ -384,13 +445,13 @@ extern "C" {
* will not get used on that platform. Network-enabled phone apps should display * will not get used on that platform. Network-enabled phone apps should display
* their privacy policy through some other, in-app means. * their privacy policy through some other, in-app means.
*/ */
#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_HINT_WINRT_PRIVACY_POLICY_URL" #define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL"
/** \brief Label text for a WinRT app's privacy policy link /** \brief Label text for a WinRT app's privacy policy link
* *
* Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT,
* Microsoft mandates that this policy be available via the Windows Settings charm. * Microsoft mandates that this policy be available via the Windows Settings charm.
* SDL provides code to add a link there, with it's label text being set via the * SDL provides code to add a link there, with its label text being set via the
* optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
* *
* Please note that a privacy policy's contents are not set via this hint. A separate * Please note that a privacy policy's contents are not set via this hint. A separate
@ -405,16 +466,59 @@ extern "C" {
* For additional information on linking to a privacy policy, see the documentation for * For additional information on linking to a privacy policy, see the documentation for
* SDL_HINT_WINRT_PRIVACY_POLICY_URL. * SDL_HINT_WINRT_PRIVACY_POLICY_URL.
*/ */
#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL" #define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL"
/** \brief If set to 1, back button press events on Windows Phone 8+ will be marked as handled. /** \brief Allows back-button-press events on Windows Phone to be marked as handled
* *
* TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use * Windows Phone devices typically feature a Back button. When pressed,
* For now, more details on why this is needed can be found at the * the OS will emit back-button-press events, which apps are expected to
* beginning of the following web page: * handle in an appropriate manner. If apps do not explicitly mark these
* events as 'Handled', then the OS will invoke its default behavior for
* unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to
* terminate the app (and attempt to switch to the previous app, or to the
* device's home screen).
*
* Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL
* to mark back-button-press events as Handled, if and when one is sent to
* the app.
*
* Internally, Windows Phone sends back button events as parameters to
* special back-button-press callback functions. Apps that need to respond
* to back-button-press events are expected to register one or more
* callback functions for such, shortly after being launched (during the
* app's initialization phase). After the back button is pressed, the OS
* will invoke these callbacks. If the app's callback(s) do not explicitly
* mark the event as handled by the time they return, or if the app never
* registers one of these callback, the OS will consider the event
* un-handled, and it will apply its default back button behavior (terminate
* the app).
*
* SDL registers its own back-button-press callback with the Windows Phone
* OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN
* and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which
* it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON.
* If the hint's value is set to "1", the back button event's Handled
* property will get set to 'true'. If the hint's value is set to something
* else, or if it is unset, SDL will leave the event's Handled property
* alone. (By default, the OS sets this property to 'false', to note.)
*
* SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a
* back button is pressed, or can set it in direct-response to a back button
* being pressed.
*
* In order to get notified when a back button is pressed, SDL apps should
* register a callback function with SDL_AddEventWatch(), and have it listen
* for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK.
* (Alternatively, SDL_KEYUP events can be listened-for. Listening for
* either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON
* set by such a callback, will be applied to the OS' current
* back-button-press event.
*
* More details on back button behavior in Windows Phone apps can be found
* at the following page, on Microsoft's developer site:
* http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
*/ */
#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_HINT_WINRT_HANDLE_BACK_BUTTON" #define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON"
/** /**
* \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X.
@ -427,7 +531,7 @@ extern "C" {
* button on their titlebars). * button on their titlebars).
* "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and
* SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
* button on their titlebars. * button on their titlebars).
* *
* The default value is "1". Spaces are disabled regardless of this hint if * The default value is "1". Spaces are disabled regardless of this hint if
* the OS isn't at least Mac OS X Lion (10.7). This hint must be set before * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
@ -435,6 +539,96 @@ extern "C" {
*/ */
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
/**
* \brief When set don't force the SDL app to become a foreground process
*
* This hint only applies to Mac OS X.
*
*/
#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP"
/**
* \brief Android APK expansion main file version. Should be a string number like "1", "2" etc.
*
* Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION.
*
* If both hints were set then SDL_RWFromFile() will look into expansion files
* after a given relative path was not found in the internal storage and assets.
*
* By default this hint is not set and the APK expansion files are not searched.
*/
#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"
/**
* \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc.
*
* Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION.
*
* If both hints were set then SDL_RWFromFile() will look into expansion files
* after a given relative path was not found in the internal storage and assets.
*
* By default this hint is not set and the APK expansion files are not searched.
*/
#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"
/**
* \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events.
*
* The variable can be set to the following values:
* "0" - SDL_TEXTEDITING events are sent, and it is the application's
* responsibility to render the text from these events and
* differentiate it somehow from committed text. (default)
* "1" - If supported by the IME then SDL_TEXTEDITING events are not sent,
* and text that is being composed will be rendered in its own UI.
*/
#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING"
/**
* \brief A variable to control whether mouse and touch events are to be treated together or separately
*
* The variable can be set to the following values:
* "0" - Mouse events will be handled as touch events, and touch will raise fake mouse
* events. This is the behaviour of SDL <= 2.0.3. (default)
* "1" - Mouse events will be handled separately from pure touch events.
*
* The value of this hint is used at runtime, so it can be changed at any time.
*/
#define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH"
/**
* \brief override the binding element for keyboard inputs for Emscripten builds
*
* This hint only applies to the emscripten platform
*
* The variable can be one of
* "#window" - The javascript window object (this is the default)
* "#document" - The javascript document object
* "#screen" - the javascript window.screen object
* "#canvas" - the WebGL canvas element
* any other string without a leading # sign applies to the element on the page with that ID.
*/
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
/**
* \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
*
* This hint only applies to Unix-like platforms.
*
* The variable can be set to the following values:
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
* catches a signal, convert it into an SDL_QUIT event.
* "1" - SDL will not install a signal handler at all.
*/
#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS"
/**
* \brief Tell SDL not to generate window-close events for Alt+F4 on Windows.
*
* The variable can be set to the following values:
* "0" - SDL will generate a window-close event when it sees Alt+F4.
* "1" - SDL will only do normal key handling for Alt+F4.
*/
#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
/** /**
* \brief An enumeration of hint priorities * \brief An enumeration of hint priorities

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -71,6 +71,16 @@ typedef struct {
typedef Sint32 SDL_JoystickID; typedef Sint32 SDL_JoystickID;
typedef enum
{
SDL_JOYSTICK_POWER_UNKNOWN = -1,
SDL_JOYSTICK_POWER_EMPTY,
SDL_JOYSTICK_POWER_LOW,
SDL_JOYSTICK_POWER_MEDIUM,
SDL_JOYSTICK_POWER_FULL,
SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
} SDL_JoystickPowerLevel;
/* Function prototypes */ /* Function prototypes */
/** /**
@ -87,14 +97,20 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
/** /**
* Open a joystick for use. * Open a joystick for use.
* The index passed as an argument refers tothe N'th joystick on the system. * The index passed as an argument refers to the N'th joystick on the system.
* This index is the value which will identify this joystick in future joystick * This index is not the value which will identify this joystick in future
* events. * joystick events. The joystick's instance id (::SDL_JoystickID) will be used
* there instead.
* *
* \return A joystick identifier, or NULL if an error occurred. * \return A joystick identifier, or NULL if an error occurred.
*/ */
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
/**
* Return the SDL_Joystick associated with an instance id.
*/
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
/** /**
* Return the name for this currently opened joystick. * Return the name for this currently opened joystick.
* If no name can be found, this function returns NULL. * If no name can be found, this function returns NULL.
@ -189,7 +205,7 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick,
*/ */
/* @{ */ /* @{ */
#define SDL_HAT_CENTERED 0x00 #define SDL_HAT_CENTERED 0x00
#define SDL_HAT_UP 0x01 #define SDL_HAT_UP 0x01
#define SDL_HAT_RIGHT 0x02 #define SDL_HAT_RIGHT 0x02
#define SDL_HAT_DOWN 0x04 #define SDL_HAT_DOWN 0x04
#define SDL_HAT_LEFT 0x08 #define SDL_HAT_LEFT 0x08
@ -241,6 +257,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
*/ */
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
/**
* Return the battery level of this joystick
*/
extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -137,44 +137,44 @@ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
/** /**
* \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
*/ */
extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/** /**
* \brief Log a message with SDL_LOG_PRIORITY_VERBOSE * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
*/ */
extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Log a message with SDL_LOG_PRIORITY_DEBUG * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
*/ */
extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Log a message with SDL_LOG_PRIORITY_INFO * \brief Log a message with SDL_LOG_PRIORITY_INFO
*/ */
extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Log a message with SDL_LOG_PRIORITY_WARN * \brief Log a message with SDL_LOG_PRIORITY_WARN
*/ */
extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Log a message with SDL_LOG_PRIORITY_ERROR * \brief Log a message with SDL_LOG_PRIORITY_ERROR
*/ */
extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Log a message with SDL_LOG_PRIORITY_CRITICAL * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
*/ */
extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...); extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Log a message with the specified category and priority. * \brief Log a message with the specified category and priority.
*/ */
extern DECLSPEC void SDLCALL SDL_LogMessage(int category, extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
SDL_LogPriority priority, SDL_LogPriority priority,
const char *fmt, ...); SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
/** /**
* \brief Log a message with the specified category and priority. * \brief Log a message with the specified category and priority.

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -67,6 +67,15 @@
*/ */
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
#elif defined(__NACL__)
/* On NACL we use ppapi_simple to set up the application helper code,
then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
starting the user main function.
All user code is run in a separate thread by ppapi_simple, thus
allowing for blocking io to take place via nacl_io
*/
#define SDL_MAIN_NEEDED
#endif #endif
#endif /* SDL_MAIN_HANDLED */ #endif /* SDL_MAIN_HANDLED */
@ -133,14 +142,11 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
* \brief Initializes and launches an SDL/WinRT application. * \brief Initializes and launches an SDL/WinRT application.
* *
* \param mainFunction The SDL app's C-style main(). * \param mainFunction The SDL app's C-style main().
* \param xamlBackgroundPanel An optional, XAML-based, background panel. * \param reserved Reserved for future use; should be NULL
* For Non-XAML apps, this value must be set to NULL. For XAML apps, * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
* pass in a pointer to a SwapChainBackgroundPanel, casted to an
* IInspectable (via reinterpret_cast).
* \ret 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more
* information on the failure. * information on the failure.
*/ */
extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel); extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved);
#endif /* __WINRT__ */ #endif /* __WINRT__ */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -60,6 +60,15 @@ typedef enum
SDL_NUM_SYSTEM_CURSORS SDL_NUM_SYSTEM_CURSORS
} SDL_SystemCursor; } SDL_SystemCursor;
/**
* \brief Scroll direction types for the Scroll event
*/
typedef enum
{
SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
} SDL_MouseWheelDirection;
/* Function prototypes */ /* Function prototypes */
/** /**
@ -77,6 +86,31 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
*/ */
extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
/**
* \brief Get the current state of the mouse, in relation to the desktop
*
* This works just like SDL_GetMouseState(), but the coordinates will be
* reported relative to the top-left of the desktop. This can be useful if
* you need to track the mouse outside of a specific window and
* SDL_CaptureMouse() doesn't fit your needs. For example, it could be
* useful if you need to track the mouse while dragging a window, where
* coordinates relative to a window might not be in sync at all times.
*
* \note SDL_GetMouseState() returns the mouse position as SDL understands
* it from the last pump of the event queue. This function, however,
* queries the OS for the current mouse position, and as such, might
* be a slightly less efficient function. Unless you know what you're
* doing and have a good reason to use this function, you probably want
* SDL_GetMouseState() instead.
*
* \param x Returns the current X coord, relative to the desktop. Can be NULL.
* \param y Returns the current Y coord, relative to the desktop. Can be NULL.
* \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
*
* \sa SDL_GetMouseState
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
/** /**
* \brief Retrieve the relative state of the mouse. * \brief Retrieve the relative state of the mouse.
* *
@ -98,6 +132,17 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
int x, int y); int x, int y);
/**
* \brief Moves the mouse to the given position in global screen space.
*
* \param x The x coordinate
* \param y The y coordinate
* \return 0 on success, -1 on error (usually: unsupported by a platform).
*
* \note This function generates a mouse motion event
*/
extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y);
/** /**
* \brief Set relative mouse mode. * \brief Set relative mouse mode.
* *
@ -116,6 +161,37 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
*/ */
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
/**
* \brief Capture the mouse, to track input outside an SDL window.
*
* \param enabled Whether or not to enable capturing
*
* Capturing enables your app to obtain mouse events globally, instead of
* just within your window. Not all video targets support this function.
* When capturing is enabled, the current window will get all mouse events,
* but unlike relative mode, no change is made to the cursor and it is
* not restrained to your window.
*
* This function may also deny mouse input to other windows--both those in
* your application and others on the system--so you should use this
* function sparingly, and in small bursts. For example, you might want to
* track the mouse while the user is dragging something, until the user
* releases a mouse button. It is not recommended that you capture the mouse
* for long periods of time, such as the entire time your app is running.
*
* While captured, mouse events still report coordinates relative to the
* current (foreground) window, but those coordinates may be outside the
* bounds of the window (including negative values). Capturing is only
* allowed for the foreground window. If the window loses focus while
* capturing, the capture will be disabled automatically.
*
* While capturing is enabled, the current window will have the
* SDL_WINDOW_MOUSE_CAPTURE flag set.
*
* \return 0 on success, or -1 if not supported.
*/
extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled);
/** /**
* \brief Query whether relative mouse mode is enabled. * \brief Query whether relative mouse mode is enabled.
* *

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,621 @@
#ifndef __gl2_h_
#define __gl2_h_
/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
/*#include <GLES2/gl2platform.h>*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/*-------------------------------------------------------------------------
* Data type definitions
*-----------------------------------------------------------------------*/
typedef void GLvoid;
typedef char GLchar;
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef khronos_int8_t GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef khronos_uint8_t GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef khronos_float_t GLfloat;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
/* GL types for handling large vertex buffer objects */
typedef khronos_intptr_t GLintptr;
typedef khronos_ssize_t GLsizeiptr;
/* OpenGL ES core versions */
#define GL_ES_VERSION_2_0 1
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GL_FALSE 0
#define GL_TRUE 1
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* AlphaFunction (not supported in ES20) */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* BlendEquationSeparate */
#define GL_FUNC_ADD 0x8006
#define GL_BLEND_EQUATION 0x8009
#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
#define GL_BLEND_EQUATION_ALPHA 0x883D
/* BlendSubtract */
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
/* Separate Blend Functions */
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_COLOR 0x8005
/* Buffer Objects */
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_STREAM_DRAW 0x88E0
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
/* CullFaceMode */
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_BLEND 0x0BE2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
#define GL_SCISSOR_TEST 0x0C11
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_OUT_OF_MEMORY 0x0505
/* FrontFaceDirection */
#define GL_CW 0x0900
#define GL_CCW 0x0901
/* GetPName */
#define GL_LINE_WIDTH 0x0B21
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_CULL_FACE_MODE 0x0B45
#define GL_FRONT_FACE 0x0B46
#define GL_DEPTH_RANGE 0x0B70
#define GL_DEPTH_WRITEMASK 0x0B72
#define GL_DEPTH_CLEAR_VALUE 0x0B73
#define GL_DEPTH_FUNC 0x0B74
#define GL_STENCIL_CLEAR_VALUE 0x0B91
#define GL_STENCIL_FUNC 0x0B92
#define GL_STENCIL_FAIL 0x0B94
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GL_STENCIL_REF 0x0B97
#define GL_STENCIL_VALUE_MASK 0x0B93
#define GL_STENCIL_WRITEMASK 0x0B98
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
#define GL_STENCIL_BACK_REF 0x8CA3
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#define GL_VIEWPORT 0x0BA2
#define GL_SCISSOR_BOX 0x0C10
/* GL_SCISSOR_TEST */
#define GL_COLOR_CLEAR_VALUE 0x0C22
#define GL_COLOR_WRITEMASK 0x0C23
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
#define GL_BLUE_BITS 0x0D54
#define GL_ALPHA_BITS 0x0D55
#define GL_DEPTH_BITS 0x0D56
#define GL_STENCIL_BITS 0x0D57
#define GL_POLYGON_OFFSET_UNITS 0x2A00
/* GL_POLYGON_OFFSET_FILL */
#define GL_POLYGON_OFFSET_FACTOR 0x8038
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_GENERATE_MIPMAP_HINT 0x8192
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* PixelFormat */
#define GL_DEPTH_COMPONENT 0x1902
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190A
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
/* Shaders */
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define GL_MAX_VARYING_VECTORS 0x8DFC
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#define GL_SHADER_TYPE 0x8B4F
#define GL_DELETE_STATUS 0x8B80
#define GL_LINK_STATUS 0x8B82
#define GL_VALIDATE_STATUS 0x8B83
#define GL_ATTACHED_SHADERS 0x8B85
#define GL_ACTIVE_UNIFORMS 0x8B86
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#define GL_ACTIVE_ATTRIBUTES 0x8B89
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GL_CURRENT_PROGRAM 0x8B8D
/* StencilFunction */
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
/* StencilOp */
/* GL_ZERO */
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
#define GL_INVERT 0x150A
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
/* TextureTarget */
/* GL_TEXTURE_2D */
#define GL_TEXTURE 0x1702
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
/* TextureUnit */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
/* TextureWrapMode */
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
#define GL_MIRRORED_REPEAT 0x8370
/* Uniform Types */
#define GL_FLOAT_VEC2 0x8B50
#define GL_FLOAT_VEC3 0x8B51
#define GL_FLOAT_VEC4 0x8B52
#define GL_INT_VEC2 0x8B53
#define GL_INT_VEC3 0x8B54
#define GL_INT_VEC4 0x8B55
#define GL_BOOL 0x8B56
#define GL_BOOL_VEC2 0x8B57
#define GL_BOOL_VEC3 0x8B58
#define GL_BOOL_VEC4 0x8B59
#define GL_FLOAT_MAT2 0x8B5A
#define GL_FLOAT_MAT3 0x8B5B
#define GL_FLOAT_MAT4 0x8B5C
#define GL_SAMPLER_2D 0x8B5E
#define GL_SAMPLER_CUBE 0x8B60
/* Vertex Arrays */
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
/* Read Format */
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
/* Shader Source */
#define GL_COMPILE_STATUS 0x8B81
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_SHADER_SOURCE_LENGTH 0x8B88
#define GL_SHADER_COMPILER 0x8DFA
/* Shader Binary */
#define GL_SHADER_BINARY_FORMATS 0x8DF8
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
/* Shader Precision-Specified Types */
#define GL_LOW_FLOAT 0x8DF0
#define GL_MEDIUM_FLOAT 0x8DF1
#define GL_HIGH_FLOAT 0x8DF2
#define GL_LOW_INT 0x8DF3
#define GL_MEDIUM_INT 0x8DF4
#define GL_HIGH_INT 0x8DF5
/* Framebuffer Object. */
#define GL_FRAMEBUFFER 0x8D40
#define GL_RENDERBUFFER 0x8D41
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#define GL_RGB565 0x8D62
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_STENCIL_INDEX8 0x8D48
#define GL_RENDERBUFFER_WIDTH 0x8D42
#define GL_RENDERBUFFER_HEIGHT 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_DEPTH_ATTACHMENT 0x8D00
#define GL_STENCIL_ATTACHMENT 0x8D20
#define GL_NONE 0
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
#define GL_FRAMEBUFFER_BINDING 0x8CA6
#define GL_RENDERBUFFER_BINDING 0x8CA7
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
/*-------------------------------------------------------------------------
* GL core functions.
*-----------------------------------------------------------------------*/
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glFinish (void);
GL_APICALL void GL_APIENTRY glFlush (void);
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
#ifdef __cplusplus
}
#endif
#endif /* __gl2_h_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
#ifndef __gl2platform_h_
#define __gl2platform_h_
/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
/*#include <KHR/khrplatform.h>*/
#ifndef GL_APICALL
#define GL_APICALL KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __gl2platform_h_ */

View file

@ -0,0 +1,282 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by sending them to the public Khronos Bugzilla
* (http://khronos.org/bugzilla) by filing a bug against product
* "Khronos (general)" component "Registry".
*
* A predefined template which fills in some of the bug fields can be
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
* must create a Bugzilla login first.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -86,6 +86,8 @@ enum
}; };
/** Array component order, low byte -> high byte. */ /** Array component order, low byte -> high byte. */
/* !!! FIXME: in 2.1, make these not overlap differently with
!!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */
enum enum
{ {
SDL_ARRAYORDER_NONE, SDL_ARRAYORDER_NONE,
@ -134,12 +136,31 @@ enum
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
#define SDL_ISPIXELFORMAT_ALPHA(format) \ #define SDL_ISPIXELFORMAT_PACKED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
#define SDL_ISPIXELFORMAT_ARRAY(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
#define SDL_ISPIXELFORMAT_ALPHA(format) \
((SDL_ISPIXELFORMAT_PACKED(format) && \
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
(SDL_ISPIXELFORMAT_ARRAY(format) && \
((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
/* The flag is set to 1 because 0x1? is not in the printable ASCII range */ /* The flag is set to 1 because 0x1? is not in the printable ASCII range */
#define SDL_ISPIXELFORMAT_FOURCC(format) \ #define SDL_ISPIXELFORMAT_FOURCC(format) \
@ -248,7 +269,11 @@ enum
SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U') SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1')
}; };
typedef struct SDL_Color typedef struct SDL_Color

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -56,7 +56,7 @@
#undef __IRIX__ #undef __IRIX__
#define __IRIX__ 1 #define __IRIX__ 1
#endif #endif
#if defined(linux) || defined(__linux) || defined(__linux__) #if (defined(linux) || defined(__linux) || defined(__linux__))
#undef __LINUX__ #undef __LINUX__
#define __LINUX__ 1 #define __LINUX__ 1
#endif #endif
@ -109,15 +109,15 @@
#undef __RISCOS__ #undef __RISCOS__
#define __RISCOS__ 1 #define __RISCOS__ 1
#endif #endif
#if defined(__SVR4) #if defined(__sun) && defined(__SVR4)
#undef __SOLARIS__ #undef __SOLARIS__
#define __SOLARIS__ 1 #define __SOLARIS__ 1
#endif #endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT or non-WinRT */ /* Try to find out if we're compiling for WinRT or non-WinRT */
/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ /* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */
#if defined(_MSC_VER) && (_MSC_VER >= 1700) && !(_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ #if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */
#include <winapifamily.h> #include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#undef __WINDOWS__ #undef __WINDOWS__
@ -142,6 +142,23 @@
#define __PSP__ 1 #define __PSP__ 1
#endif #endif
/* The NACL compiler defines __native_client__ and __pnacl__
* Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
*/
#if defined(__native_client__)
#undef __LINUX__
#undef __NACL__
#define __NACL__ 1
#endif
#if defined(__pnacl__)
#undef __LINUX__
#undef __PNACL__
#define __PNACL__ 1
/* PNACL with newlib supports static linking only */
#define __SDL_NOGETPROCADDR__
#endif
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -43,6 +43,7 @@ extern "C" {
* \brief The structure that defines a point * \brief The structure that defines a point
* *
* \sa SDL_EnclosePoints * \sa SDL_EnclosePoints
* \sa SDL_PointInRect
*/ */
typedef struct SDL_Point typedef struct SDL_Point
{ {
@ -66,6 +67,15 @@ typedef struct SDL_Rect
int w, h; int w, h;
} SDL_Rect; } SDL_Rect;
/**
* \brief Returns true if point resides inside a rectangle.
*/
SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r)
{
return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
(p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
}
/** /**
* \brief Returns true if the rectangle has no area. * \brief Returns true if the rectangle has no area.
*/ */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -81,8 +81,8 @@ typedef struct SDL_RendererInfo
Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 flags; /**< Supported ::SDL_RendererFlags */
Uint32 num_texture_formats; /**< The number of available texture formats */ Uint32 num_texture_formats; /**< The number of available texture formats */
Uint32 texture_formats[16]; /**< The available texture formats */ Uint32 texture_formats[16]; /**< The available texture formats */
int max_texture_width; /**< The maximimum texture width */ int max_texture_width; /**< The maximum texture width */
int max_texture_height; /**< The maximimum texture height */ int max_texture_height; /**< The maximum texture height */
} SDL_RendererInfo; } SDL_RendererInfo;
/** /**
@ -215,7 +215,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
SDL_RendererInfo * info); SDL_RendererInfo * info);
/** /**
* \brief Get the output size of a rendering context. * \brief Get the output size in pixels of a rendering context.
*/ */
extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
int *w, int *h); int *w, int *h);
@ -229,7 +229,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
* \param w The width of the texture in pixels. * \param w The width of the texture in pixels.
* \param h The height 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 * \return The created texture is returned, or NULL if no rendering context was
* active, the format was unsupported, or the width or height were out * active, the format was unsupported, or the width or height were out
* of range. * of range.
* *
@ -248,7 +248,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
* \param renderer The renderer. * \param renderer The renderer.
* \param surface The surface containing pixel data used to fill the texture. * \param surface The surface containing pixel data used to fill the texture.
* *
* \return The created texture is returned, or 0 on error. * \return The created texture is returned, or NULL on error.
* *
* \note The surface is not modified or freed by this function. * \note The surface is not modified or freed by this function.
* *
@ -371,7 +371,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
* \param rect A pointer to the rectangle of pixels to update, or NULL to * \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture. * update the entire texture.
* \param pixels The raw pixel data. * \param pixels The raw pixel data.
* \param pitch The number of bytes between rows of pixel data. * \param pitch The number of bytes in a row of pixel data, including padding between lines.
* *
* \return 0 on success, or -1 if the texture is not valid. * \return 0 on success, or -1 if the texture is not valid.
* *
@ -551,6 +551,16 @@ extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
SDL_Rect * rect); SDL_Rect * rect);
/**
* \brief Get whether clipping is enabled on the given renderer.
*
* \param renderer The renderer from which clip state should be queried.
*
* \sa SDL_RenderGetClipRect()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer);
/** /**
* \brief Set the drawing scale for rendering on the current target. * \brief Set the drawing scale for rendering on the current target.
* *
@ -782,7 +792,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
* \param dstrect A pointer to the destination rectangle, or NULL for the * \param dstrect A pointer to the destination rectangle, or NULL for the
* entire rendering target. * entire rendering target.
* \param angle An angle in degrees that indicates the rotation that will be applied to dstrect * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect
* \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2).
* \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
* *
* \return 0 on success, or -1 on error * \return 0 on success, or -1 on error

View file

@ -1,2 +1,2 @@
#define SDL_REVISION "hg-8628:b558f99d48f0" #define SDL_REVISION "hg-10001:e12c38730512"
#define SDL_REVISION_NUMBER 8628 #define SDL_REVISION_NUMBER 10001

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -93,7 +93,7 @@ typedef struct SDL_RWops
Uint32 type; Uint32 type;
union union
{ {
#if defined(ANDROID) #if defined(__ANDROID__)
struct struct
{ {
void *fileNameRef; void *fileNameRef;
@ -220,7 +220,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
/* @} *//* Write endian functions */ /* @} *//* Write endian functions */
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -165,6 +165,97 @@ typedef uint64_t Uint64;
/* @} *//* Basic data types */ /* @} *//* Basic data types */
/* Make sure we have macros for printing 64 bit values.
* <stdint.h> should define these but this is not true all platforms.
* (for example win32) */
#ifndef SDL_PRIs64
#ifdef PRIs64
#define SDL_PRIs64 PRIs64
#elif defined(__WIN32__)
#define SDL_PRIs64 "I64d"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIs64 "ld"
#else
#define SDL_PRIs64 "lld"
#endif
#endif
#ifndef SDL_PRIu64
#ifdef PRIu64
#define SDL_PRIu64 PRIu64
#elif defined(__WIN32__)
#define SDL_PRIu64 "I64u"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIu64 "lu"
#else
#define SDL_PRIu64 "llu"
#endif
#endif
#ifndef SDL_PRIx64
#ifdef PRIx64
#define SDL_PRIx64 PRIx64
#elif defined(__WIN32__)
#define SDL_PRIx64 "I64x"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIx64 "lx"
#else
#define SDL_PRIx64 "llx"
#endif
#endif
#ifndef SDL_PRIX64
#ifdef PRIX64
#define SDL_PRIX64 PRIX64
#elif defined(__WIN32__)
#define SDL_PRIX64 "I64X"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIX64 "lX"
#else
#define SDL_PRIX64 "llX"
#endif
#endif
/* Annotations to help code analysis tools */
#ifdef SDL_DISABLE_ANALYZE_MACROS
#define SDL_IN_BYTECAP(x)
#define SDL_INOUT_Z_CAP(x)
#define SDL_OUT_Z_CAP(x)
#define SDL_OUT_CAP(x)
#define SDL_OUT_BYTECAP(x)
#define SDL_OUT_Z_BYTECAP(x)
#define SDL_PRINTF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
#else
#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
#include <sal.h>
#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
#define SDL_OUT_CAP(x) _Out_cap_(x)
#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
#else
#define SDL_IN_BYTECAP(x)
#define SDL_INOUT_Z_CAP(x)
#define SDL_OUT_Z_CAP(x)
#define SDL_OUT_CAP(x)
#define SDL_OUT_BYTECAP(x)
#define SDL_OUT_Z_BYTECAP(x)
#define SDL_PRINTF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING
#endif
#if defined(__GNUC__)
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
#else
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
#endif
#endif /* SDL_DISABLE_ANALYZE_MACROS */
#define SDL_COMPILE_TIME_ASSERT(name, x) \ #define SDL_COMPILE_TIME_ASSERT(name, x) \
typedef int SDL_dummy_ ## name[(x) * 2 - 1] typedef int SDL_dummy_ ## name[(x) * 2 - 1]
@ -259,7 +350,7 @@ extern DECLSPEC int SDLCALL SDL_isspace(int x);
extern DECLSPEC int SDLCALL SDL_toupper(int x); extern DECLSPEC int SDLCALL SDL_toupper(int x);
extern DECLSPEC int SDLCALL SDL_tolower(int x); extern DECLSPEC int SDLCALL SDL_tolower(int x);
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
@ -294,24 +385,19 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
} }
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords) extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
{
return SDL_memcpy(dst, src, dwords * 4);
}
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len);
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes); extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
extern DECLSPEC char *SDLCALL SDL_strrev(char *str); extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
extern DECLSPEC char *SDLCALL SDL_strupr(char *str); extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
@ -340,10 +426,10 @@ extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
#ifndef HAVE_M_PI #ifndef HAVE_M_PI
#ifndef M_PI #ifndef M_PI
@ -367,6 +453,9 @@ extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC double SDLCALL SDL_sin(double x);
extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC float SDLCALL SDL_sinf(float x);
extern DECLSPEC double SDLCALL SDL_sqrt(double x); extern DECLSPEC double SDLCALL SDL_sqrt(double x);
extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
extern DECLSPEC double SDLCALL SDL_tan(double x);
extern DECLSPEC float SDLCALL SDL_tanf(float x);
/* The SDL implementation of iconv() returns these error codes */ /* The SDL implementation of iconv() returns these error codes */
#define SDL_ICONV_ERROR (size_t)-1 #define SDL_ICONV_ERROR (size_t)-1
@ -394,6 +483,39 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
/* force builds using Clang's static analysis tools to use literal C runtime
here, since there are possibly tests that are ineffective otherwise. */
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
#define SDL_malloc malloc
#define SDL_calloc calloc
#define SDL_realloc realloc
#define SDL_free free
#define SDL_memset memset
#define SDL_memcpy memcpy
#define SDL_memmove memmove
#define SDL_memcmp memcmp
#define SDL_strlen strlen
#define SDL_strlcpy strlcpy
#define SDL_strlcat strlcat
#define SDL_strdup strdup
#define SDL_strchr strchr
#define SDL_strrchr strrchr
#define SDL_strstr strstr
#define SDL_strcmp strcmp
#define SDL_strncmp strncmp
#define SDL_strcasecmp strcasecmp
#define SDL_strncasecmp strncasecmp
#define SDL_sscanf sscanf
#define SDL_vsscanf vsscanf
#define SDL_snprintf snprintf
#define SDL_vsnprintf vsnprintf
#endif
SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
{
return SDL_memcpy(dst, src, dwords * 4);
}
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -42,24 +42,36 @@ extern "C" {
/* Platform specific functions for Windows */ /* Platform specific functions for Windows */
#ifdef __WIN32__ #ifdef __WIN32__
/**
\brief Set a function that is called for every windows message, before TranslateMessage()
*/
typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
/**
\brief Returns the D3D9 adapter index that matches the specified display index.
/* Returns the D3D9 adapter index that matches the specified display index.
This adapter index can be passed to IDirect3D9::CreateDevice and controls This adapter index can be passed to IDirect3D9::CreateDevice and controls
on which monitor a full screen application will appear. on which monitor a full screen application will appear.
*/ */
extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
/* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. typedef struct IDirect3DDevice9 IDirect3DDevice9;
/**
\brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer.
Once you are done using the device, you should release it to avoid a resource leak. Once you are done using the device, you should release it to avoid a resource leak.
*/ */
typedef struct IDirect3DDevice9 IDirect3DDevice9;
extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer);
/* Returns the DXGI Adapter and Output indices for the specified display index. /**
\brief Returns the DXGI Adapter and Output indices for the specified display index.
These can be passed to EnumAdapters and EnumOutputs respectively to get the objects These can be passed to EnumAdapters and EnumOutputs respectively to get the objects
required to create a DX10 or DX11 device and swap chain. required to create a DX10 or DX11 device and swap chain.
*/ */
extern DECLSPEC void SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex );
#endif /* __WIN32__ */ #endif /* __WIN32__ */
@ -67,7 +79,10 @@ extern DECLSPEC void SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapt
/* Platform specific functions for iOS */ /* Platform specific functions for iOS */
#if defined(__IPHONEOS__) && __IPHONEOS__ #if defined(__IPHONEOS__) && __IPHONEOS__
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
#endif /* __IPHONEOS__ */ #endif /* __IPHONEOS__ */
@ -76,12 +91,16 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
/* Platform specific functions for Android */ /* Platform specific functions for Android */
#if defined(__ANDROID__) && __ANDROID__ #if defined(__ANDROID__) && __ANDROID__
/* Get the JNI environment for the current thread /**
\brief Get the JNI environment for the current thread
This returns JNIEnv*, but the prototype is void* so we don't need jni.h This returns JNIEnv*, but the prototype is void* so we don't need jni.h
*/ */
extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
/* Get the SDL Activity object for the application /**
\brief Get the SDL Activity object for the application
This returns jobject, but the prototype is void* so we don't need jni.h This returns jobject, but the prototype is void* so we don't need jni.h
The jobject returned by SDL_AndroidGetActivity is a local reference. The jobject returned by SDL_AndroidGetActivity is a local reference.
It is the caller's responsibility to properly release it It is the caller's responsibility to properly release it
@ -89,26 +108,33 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
*/ */
extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
/* See the official Android developer guide for more information: /**
See the official Android developer guide for more information:
http://developer.android.com/guide/topics/data/data-storage.html http://developer.android.com/guide/topics/data/data-storage.html
*/ */
#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
/* Get the path used for internal storage for this application. /**
\brief Get the path used for internal storage for this application.
This path is unique to your application and cannot be written to This path is unique to your application and cannot be written to
by other applications. by other applications.
*/ */
extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath();
/* Get the current state of external storage, a bitmask of these values: /**
\brief Get the current state of external storage, a bitmask of these values:
SDL_ANDROID_EXTERNAL_STORAGE_READ SDL_ANDROID_EXTERNAL_STORAGE_READ
SDL_ANDROID_EXTERNAL_STORAGE_WRITE SDL_ANDROID_EXTERNAL_STORAGE_WRITE
If external storage is currently unavailable, this will return 0. If external storage is currently unavailable, this will return 0.
*/ */
extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState();
/* Get the path used for external storage for this application. /**
\brief Get the path used for external storage for this application.
This path is unique to your application, but is public and can be This path is unique to your application, but is public and can be
written to by other applications. written to by other applications.
*/ */
@ -151,7 +177,7 @@ typedef enum
* http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
* *
* \param pathType The type of path to retrieve. * \param pathType The type of path to retrieve.
* \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL
* if the path is not available for any reason. Not all paths are * if the path is not available for any reason. Not all paths are
* available on all versions of Windows. This is especially true on * available on all versions of Windows. This is especially true on
* Windows Phone. Check the documentation for the given * Windows Phone. Check the documentation for the given
@ -168,7 +194,7 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path
* http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
* *
* \param pathType The type of path to retrieve. * \param pathType The type of path to retrieve.
* \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
* if the path is not available for any reason. Not all paths are * if the path is not available for any reason. Not all paths are
* available on all versions of Windows. This is especially true on * available on all versions of Windows. This is especially true on
* Windows Phone. Check the documentation for the given * Windows Phone. Check the documentation for the given
@ -179,7 +205,6 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
#endif /* __WINRT__ */ #endif /* __WINRT__ */
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -52,7 +52,9 @@ struct SDL_SysWMinfo;
#else #else
#if defined(SDL_VIDEO_DRIVER_WINDOWS) #if defined(SDL_VIDEO_DRIVER_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> #include <windows.h>
#endif #endif
@ -83,7 +85,7 @@ struct SDL_SysWMinfo;
#if defined(SDL_VIDEO_DRIVER_COCOA) #if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef __OBJC__ #ifdef __OBJC__
#include <Cocoa/Cocoa.h> @class NSWindow;
#else #else
typedef struct _NSWindow NSWindow; typedef struct _NSWindow NSWindow;
#endif #endif
@ -96,13 +98,14 @@ typedef struct _NSWindow NSWindow;
typedef struct _UIWindow UIWindow; typedef struct _UIWindow UIWindow;
typedef struct _UIViewController UIViewController; typedef struct _UIViewController UIViewController;
#endif #endif
typedef Uint32 GLuint;
#endif #endif
#if defined(SDL_VIDEO_DRIVER_MIR) #if defined(SDL_VIDEO_DRIVER_ANDROID)
#include <mir_toolkit/mir_client_library.h> typedef struct ANativeWindow ANativeWindow;
typedef void *EGLSurface;
#endif #endif
/** /**
* These are the various supported windowing subsystems * These are the various supported windowing subsystems
*/ */
@ -117,6 +120,7 @@ typedef enum
SDL_SYSWM_WAYLAND, SDL_SYSWM_WAYLAND,
SDL_SYSWM_MIR, SDL_SYSWM_MIR,
SDL_SYSWM_WINRT, SDL_SYSWM_WINRT,
SDL_SYSWM_ANDROID
} SDL_SYSWM_TYPE; } SDL_SYSWM_TYPE;
/** /**
@ -149,12 +153,17 @@ struct SDL_SysWMmsg
#if defined(SDL_VIDEO_DRIVER_COCOA) #if defined(SDL_VIDEO_DRIVER_COCOA)
struct struct
{ {
/* Latest version of Xcode clang complains about empty structs in C v. C++:
error: empty struct has size 0 in C, size 1 in C++
*/
int dummy;
/* No Cocoa window events yet */ /* No Cocoa window events yet */
} cocoa; } cocoa;
#endif #endif
#if defined(SDL_VIDEO_DRIVER_UIKIT) #if defined(SDL_VIDEO_DRIVER_UIKIT)
struct struct
{ {
int dummy;
/* No UIKit window events yet */ /* No UIKit window events yet */
} uikit; } uikit;
#endif #endif
@ -179,6 +188,7 @@ struct SDL_SysWMinfo
struct struct
{ {
HWND window; /**< The window handle */ HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
} win; } win;
#endif #endif
#if defined(SDL_VIDEO_DRIVER_WINRT) #if defined(SDL_VIDEO_DRIVER_WINRT)
@ -205,13 +215,24 @@ struct SDL_SysWMinfo
#if defined(SDL_VIDEO_DRIVER_COCOA) #if defined(SDL_VIDEO_DRIVER_COCOA)
struct struct
{ {
NSWindow *window; /* The Cocoa window */ #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
NSWindow __unsafe_unretained *window; /* The Cocoa window */
#else
NSWindow *window; /* The Cocoa window */
#endif
} cocoa; } cocoa;
#endif #endif
#if defined(SDL_VIDEO_DRIVER_UIKIT) #if defined(SDL_VIDEO_DRIVER_UIKIT)
struct struct
{ {
UIWindow *window; /* The UIKit window */ #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
UIWindow __unsafe_unretained *window; /* The UIKit window */
#else
UIWindow *window; /* The UIKit window */
#endif
GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit; } uikit;
#endif #endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND) #if defined(SDL_VIDEO_DRIVER_WAYLAND)
@ -225,11 +246,19 @@ struct SDL_SysWMinfo
#if defined(SDL_VIDEO_DRIVER_MIR) #if defined(SDL_VIDEO_DRIVER_MIR)
struct struct
{ {
MirConnection *connection; /**< Mir display server connection */ struct MirConnection *connection; /**< Mir display server connection */
MirSurface *surface; /**< Mir surface */ struct MirSurface *surface; /**< Mir surface */
} mir; } mir;
#endif #endif
#if defined(SDL_VIDEO_DRIVER_ANDROID)
struct
{
ANativeWindow *window;
EGLSurface surface;
} android;
#endif
/* Can't have an empty union */ /* Can't have an empty union */
int dummy; int dummy;
} info; } info;

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -52,7 +52,7 @@ extern "C" {
/* Global definitions */ /* Global definitions */
/* /*
* Note: Maximum size of SDLTest log message is less than SDLs limit * Note: Maximum size of SDLTest log message is less than SDL's limit
* to ensure we can fit additional information such as the timestamp. * to ensure we can fit additional information such as the timestamp.
*/ */
#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -58,7 +58,7 @@ extern "C" {
* \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
* \param assertDescription Message to log with the assert describing it. * \param assertDescription Message to log with the assert describing it.
*/ */
void SDLTest_Assert(int assertCondition, const char *assertDescription, ...); void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
@ -68,14 +68,14 @@ void SDLTest_Assert(int assertCondition, const char *assertDescription, ...);
* *
* \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired.
*/ */
int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...); int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
/** /**
* \brief Explicitely pass without checking an assertion condition. Updates assertion counter. * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
* *
* \param assertDescription Message to log with the assert describing it. * \param assertDescription Message to log with the assert describing it.
*/ */
void SDLTest_AssertPass(const char *assertDescription, ...); void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
/** /**
* \brief Resets the assert summary counters to zero. * \brief Resets the assert summary counters to zero.

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -51,9 +51,9 @@ extern "C" {
* *
* \param surface Surface used in comparison * \param surface Surface used in comparison
* \param referenceSurface Test Surface used in comparison * \param referenceSurface Test Surface used in comparison
* \param allowable_error Allowable difference (squared) in blending accuracy. * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy.
* *
* \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ.
*/ */
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error);

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -70,27 +70,27 @@ extern "C" {
/* ---------- Function Prototypes ------------- */ /* ---------- Function Prototypes ------------- */
/** /**
* /brief Initialize the CRC context * \brief Initialize the CRC context
* *
* Note: The function initializes the crc table required for all crc calculations. * Note: The function initializes the crc table required for all crc calculations.
* *
* /param crcContext pointer to context variable * \param crcContext pointer to context variable
* *
* /returns 0 for OK, -1 on error * \returns 0 for OK, -1 on error
* *
*/ */
int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
/** /**
* /brief calculate a crc32 from a data block * \brief calculate a crc32 from a data block
* *
* /param crcContext pointer to context variable * \param crcContext pointer to context variable
* /param inBuf input buffer to checksum * \param inBuf input buffer to checksum
* /param inLen length of input buffer * \param inLen length of input buffer
* /param crc32 pointer to Uint32 to store the final CRC into * \param crc32 pointer to Uint32 to store the final CRC into
* *
* /returns 0 for OK, -1 on error * \returns 0 for OK, -1 on error
* *
*/ */
int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
@ -102,11 +102,11 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf,
/** /**
* /brief clean up CRC context * \brief clean up CRC context
* *
* /param crcContext pointer to context variable * \param crcContext pointer to context variable
* *
* /returns 0 for OK, -1 on error * \returns 0 for OK, -1 on error
* *
*/ */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -57,7 +57,7 @@ extern "C" {
/** /**
* Initializes the fuzzer for a test * Initializes the fuzzer for a test
* *
* /param execKey Execution "Key" that initializes the random number generator uniquely for the test. * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
* *
*/ */
void SDLTest_FuzzerInit(Uint64 execKey); void SDLTest_FuzzerInit(Uint64 execKey);
@ -318,7 +318,7 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL
/** /**
* Returns integer in range [min, max] (inclusive). * Returns integer in range [min, max] (inclusive).
* Min and max values can be negative values. * Min and max values can be negative values.
* If Max in smaller tham min, then the values are swapped. * If Max in smaller than min, then the values are swapped.
* Min and max are the same value, that value will be returned. * Min and max are the same value, that value will be returned.
* *
* \param min Minimum inclusive value of returned random number * \param min Minimum inclusive value of returned random number

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -47,14 +47,14 @@ extern "C" {
* *
* \param fmt Message to be logged * \param fmt Message to be logged
*/ */
void SDLTest_Log(const char *fmt, ...); void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/** /**
* \brief Prints given message with a timestamp in the TEST category and the ERROR priority. * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
* *
* \param fmt Message to be logged * \param fmt Message to be logged
*/ */
void SDLTest_LogError(const char *fmt, ...); void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -78,9 +78,9 @@ extern "C" {
/* ---------- Function Prototypes ------------- */ /* ---------- Function Prototypes ------------- */
/** /**
* /brief initialize the context * \brief initialize the context
* *
* /param mdContext pointer to context variable * \param mdContext pointer to context variable
* *
* Note: The function initializes the message-digest context * Note: The function initializes the message-digest context
* mdContext. Call before each new use of the context - * mdContext. Call before each new use of the context -
@ -90,11 +90,11 @@ extern "C" {
/** /**
* /brief update digest from variable length data * \brief update digest from variable length data
* *
* /param mdContext pointer to context variable * \param mdContext pointer to context variable
* /param inBuf pointer to data array/string * \param inBuf pointer to data array/string
* /param inLen length of data array/string * \param inLen length of data array/string
* *
* Note: The function updates the message-digest context to account * Note: The function updates the message-digest context to account
* for the presence of each of the characters inBuf[0..inLen-1] * for the presence of each of the characters inBuf[0..inLen-1]
@ -105,10 +105,10 @@ extern "C" {
unsigned int inLen); unsigned int inLen);
/* /**
* /brief complete digest computation * \brief complete digest computation
* *
* /param mdContext pointer to context variable * \param mdContext pointer to context variable
* *
* Note: The function terminates the message-digest computation and * Note: The function terminates the message-digest computation and
* ends with the desired message digest in mdContext.digest[0..15]. * ends with the desired message digest in mdContext.digest[0..15].

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -233,9 +233,9 @@ extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread);
* if (!thread_local_storage) { * if (!thread_local_storage) {
* thread_local_storage = SDL_TLSCreate(); * thread_local_storage = SDL_TLSCreate();
* } * }
* SDL_AtomicUnLock(&tls_lock); * SDL_AtomicUnlock(&tls_lock);
* } * }
* SDL_TLSSet(thread_local_storage, value); * SDL_TLSSet(thread_local_storage, value, 0);
* } * }
* *
* void *GetMyThreadData(void) * void *GetMyThreadData(void)

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -88,7 +88,7 @@ typedef int SDL_TimerID;
/** /**
* \brief Add a new timer to the pool of timers already running. * \brief Add a new timer to the pool of timers already running.
* *
* \return A timer ID, or NULL when an error occurs. * \return A timer ID, or 0 when an error occurs.
*/ */
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
SDL_TimerCallback callback, SDL_TimerCallback callback,

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -59,7 +59,7 @@ typedef struct SDL_version
*/ */
#define SDL_MAJOR_VERSION 2 #define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 0 #define SDL_MINOR_VERSION 0
#define SDL_PATCHLEVEL 3 #define SDL_PATCHLEVEL 4
/** /**
* \brief Macro to determine SDL version program was compiled against. * \brief Macro to determine SDL version program was compiled against.

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -53,8 +53,8 @@ extern "C" {
typedef struct typedef struct
{ {
Uint32 format; /**< pixel format */ Uint32 format; /**< pixel format */
int w; /**< width */ int w; /**< width, in screen coordinates */
int h; /**< height */ int h; /**< height, in screen coordinates */
int refresh_rate; /**< refresh rate (or zero for unspecified) */ int refresh_rate; /**< refresh rate (or zero for unspecified) */
void *driverdata; /**< driver-specific data, initialize to 0 */ void *driverdata; /**< driver-specific data, initialize to 0 */
} SDL_DisplayMode; } SDL_DisplayMode;
@ -108,7 +108,8 @@ typedef enum
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /**< window should be created in high-DPI mode if supported */ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000 /**< window has mouse captured (unrelated to INPUT_GRABBED) */
} SDL_WindowFlags; } SDL_WindowFlags;
/** /**
@ -142,7 +143,9 @@ typedef enum
SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2
*/ */
SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */
SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as
a result of an API call or through the
system or user changing the window size. */
SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */
SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */
SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size
@ -188,7 +191,8 @@ typedef enum
SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FLAGS,
SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
SDL_GL_CONTEXT_RELEASE_BEHAVIOR
} SDL_GLattr; } SDL_GLattr;
typedef enum typedef enum
@ -206,6 +210,12 @@ typedef enum
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008
} SDL_GLcontextFlag; } SDL_GLcontextFlag;
typedef enum
{
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000,
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001
} SDL_GLcontextReleaseFlag;
/* Function prototypes */ /* Function prototypes */
@ -288,6 +298,18 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex);
*/ */
extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect);
/**
* \brief Get the dots/pixels-per-inch for a display
*
* \note Diagonal, horizontal and vertical DPI can all be optionally
* returned if the parameter is non-NULL.
*
* \return 0 on success, or -1 if no DPI information is available or the index is out of range.
*
* \sa SDL_GetNumVideoDisplays()
*/
extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi);
/** /**
* \brief Returns the number of available display modes. * \brief Returns the number of available display modes.
* *
@ -392,8 +414,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
* ::SDL_WINDOWPOS_UNDEFINED. * ::SDL_WINDOWPOS_UNDEFINED.
* \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
* ::SDL_WINDOWPOS_UNDEFINED. * ::SDL_WINDOWPOS_UNDEFINED.
* \param w The width of the window. * \param w The width of the window, in screen coordinates.
* \param h The height of the window. * \param h The height of the window, in screen coordinates.
* \param flags The flags for the window, a mask of any of the following: * \param flags The flags for the window, a mask of any of the following:
* ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
* ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
@ -403,6 +425,12 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
* *
* \return The id of the window created, or zero if window creation failed. * \return The id of the window created, or zero if window creation failed.
* *
* If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size
* in pixels may differ from its size in screen coordinates on platforms with
* high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query
* the client area's size in screen coordinates, and SDL_GL_GetDrawableSize()
* or SDL_GetRendererOutputSize() to query the drawable size in pixels.
*
* \sa SDL_DestroyWindow() * \sa SDL_DestroyWindow()
*/ */
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title,
@ -493,10 +521,10 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window,
* \brief Set the position of a window. * \brief Set the position of a window.
* *
* \param window The window to reposition. * \param window The window to reposition.
* \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or * \param x The x coordinate of the window in screen coordinates, or
::SDL_WINDOWPOS_UNDEFINED. * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
* \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or * \param y The y coordinate of the window in screen coordinates, or
::SDL_WINDOWPOS_UNDEFINED. * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED.
* *
* \note The window coordinate origin is the upper left of the display. * \note The window coordinate origin is the upper left of the display.
* *
@ -509,8 +537,10 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
* \brief Get the position of a window. * \brief Get the position of a window.
* *
* \param window The window to query. * \param window The window to query.
* \param x Pointer to variable for storing the x position, may be NULL * \param x Pointer to variable for storing the x position, in screen
* \param y Pointer to variable for storing the y position, may be NULL * coordinates. May be NULL.
* \param y Pointer to variable for storing the y position, in screen
* coordinates. May be NULL.
* *
* \sa SDL_SetWindowPosition() * \sa SDL_SetWindowPosition()
*/ */
@ -521,12 +551,17 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
* \brief Set the size of a window's client area. * \brief Set the size of a window's client area.
* *
* \param window The window to resize. * \param window The window to resize.
* \param w The width of the window, must be >0 * \param w The width of the window, in screen coordinates. Must be >0.
* \param h The height of the window, must be >0 * \param h The height of the window, in screen coordinates. Must be >0.
* *
* \note You can't change the size of a fullscreen window, it automatically * \note You can't change the size of a fullscreen window, it automatically
* matches the size of the display mode. * matches the size of the display mode.
* *
* The window size in screen coordinates may differ from the size in pixels, if
* the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
* high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
*
* \sa SDL_GetWindowSize() * \sa SDL_GetWindowSize()
*/ */
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
@ -536,8 +571,15 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
* \brief Get the size of a window's client area. * \brief Get the size of a window's client area.
* *
* \param window The window to query. * \param window The window to query.
* \param w Pointer to variable for storing the width, may be NULL * \param w Pointer to variable for storing the width, in screen
* \param h Pointer to variable for storing the height, may be NULL * coordinates. May be NULL.
* \param h Pointer to variable for storing the height, in screen
* coordinates. May be NULL.
*
* The window size in screen coordinates may differ from the size in pixels, if
* the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with
* high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or
* SDL_GetRendererOutputSize() to get the real client area size in pixels.
* *
* \sa SDL_SetWindowSize() * \sa SDL_SetWindowSize()
*/ */
@ -714,6 +756,9 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
* \param window The window for which the input grab mode should be set. * \param window The window for which the input grab mode should be set.
* \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
* *
* If the caller enables a grab while another window is currently grabbed,
* the other window loses its grab in favor of the caller's window.
*
* \sa SDL_GetWindowGrab() * \sa SDL_GetWindowGrab()
*/ */
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
@ -728,6 +773,15 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
/**
* \brief Get the window that currently has an input grab enabled.
*
* \return This returns the window if input is grabbed, and NULL otherwise.
*
* \sa SDL_SetWindowGrab()
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void);
/** /**
* \brief Set the brightness (gamma correction) for a window. * \brief Set the brightness (gamma correction) for a window.
* *
@ -790,6 +844,75 @@ extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window,
Uint16 * green, Uint16 * green,
Uint16 * blue); Uint16 * blue);
/**
* \brief Possible return values from the SDL_HitTest callback.
*
* \sa SDL_HitTest
*/
typedef enum
{
SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */
SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */
SDL_HITTEST_RESIZE_TOPLEFT,
SDL_HITTEST_RESIZE_TOP,
SDL_HITTEST_RESIZE_TOPRIGHT,
SDL_HITTEST_RESIZE_RIGHT,
SDL_HITTEST_RESIZE_BOTTOMRIGHT,
SDL_HITTEST_RESIZE_BOTTOM,
SDL_HITTEST_RESIZE_BOTTOMLEFT,
SDL_HITTEST_RESIZE_LEFT
} SDL_HitTestResult;
/**
* \brief Callback used for hit-testing.
*
* \sa SDL_SetWindowHitTest
*/
typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win,
const SDL_Point *area,
void *data);
/**
* \brief Provide a callback that decides if a window region has special properties.
*
* Normally windows are dragged and resized by decorations provided by the
* system window manager (a title bar, borders, etc), but for some apps, it
* makes sense to drag them from somewhere else inside the window itself; for
* example, one might have a borderless window that wants to be draggable
* from any part, or simulate its own title bar, etc.
*
* This function lets the app provide a callback that designates pieces of
* a given window as special. This callback is run during event processing
* if we need to tell the OS to treat a region of the window specially; the
* use of this callback is known as "hit testing."
*
* Mouse input may not be delivered to your application if it is within
* a special area; the OS will often apply that input to moving the window or
* resizing the window and not deliver it to the application.
*
* Specifying NULL for a callback disables hit-testing. Hit-testing is
* disabled by default.
*
* Platforms that don't support this functionality will return -1
* unconditionally, even if you're attempting to disable hit-testing.
*
* Your callback may fire at any time, and its firing does not indicate any
* specific behavior (for example, on Windows, this certainly might fire
* when the OS is deciding whether to drag your window, but it fires for lots
* of other reasons, too, some unrelated to anything you probably care about
* _and when the mouse isn't actually at the location it is testing_).
* Since this can fire at any time, you should try to keep your callback
* efficient, devoid of allocations, etc.
*
* \param window The window to set hit-testing on.
* \param callback The callback to call when doing a hit-test.
* \param callback_data An app-defined void pointer passed to the callback.
* \return 0 on success, -1 on error (including unsupported).
*/
extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window,
SDL_HitTest callback,
void *callback_data);
/** /**
* \brief Destroy a window. * \brief Destroy a window.
*/ */
@ -908,13 +1031,14 @@ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
/** /**
* \brief Get the size of a window's underlying drawable (for use with glViewport). * \brief Get the size of a window's underlying drawable in pixels (for use
* with glViewport).
* *
* \param window Window from which the drawable size should be queried * \param window Window from which the drawable size should be queried
* \param w Pointer to variable for storing the width, may be NULL * \param w Pointer to variable for storing the width in pixels, may be NULL
* \param h Pointer to variable for storing the height, may be NULL * \param h Pointer to variable for storing the height in pixels, may be NULL
* *
* This may differ from SDL_GetWindowSize if we're rendering to a high-DPI * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
* drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a
* platform with high-DPI support (Apple calls this "Retina"), and not disabled * platform with high-DPI support (Apple calls this "Retina"), and not disabled
* by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -41,6 +41,14 @@
# endif # endif
#endif #endif
#ifndef SDL_UNUSED
# ifdef __GNUC__
# define SDL_UNUSED __attribute__((unused))
# else
# define SDL_UNUSED
# endif
#endif
/* Some compilers use a special export keyword */ /* Some compilers use a special export keyword */
#ifndef DECLSPEC #ifndef DECLSPEC
# if defined(__WIN32__) || defined(__WINRT__) # if defined(__WIN32__) || defined(__WINRT__)
@ -56,8 +64,6 @@
# else # else
# if defined(__GNUC__) && __GNUC__ >= 4 # if defined(__GNUC__) && __GNUC__ >= 4
# define DECLSPEC __attribute__ ((visibility("default"))) # define DECLSPEC __attribute__ ((visibility("default")))
# elif defined(__GNUC__) && __GNUC__ >= 2
# define DECLSPEC __declspec(dllexport)
# else # else
# define DECLSPEC # define DECLSPEC
# endif # endif

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

8
code/autoupdater/rsa_tools/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
crypt-*.tar.bz2
tfm-*.tar.xz
libtomcrypt-*
tomsfastmath-*
rsa_make_keys
rsa_sign
rsa_verify
*.exe

View file

@ -0,0 +1,79 @@
#!/bin/bash
TFMVER=0.13.1
LTCVER=1.17
set -e
OSTYPE=`uname -s`
if [ "$OSTYPE" = "Linux" ]; then
NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
let NCPU=$NCPU+1
elif [ "$OSTYPE" = "Darwin" ]; then
NCPU=`sysctl -n hw.ncpu`
export CFLAGS="$CFLAGS -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070"
export LDFLAGS="$LDFLAGS -mmacosx-version-min=10.7"
elif [ "$OSTYPE" = "SunOS" ]; then
NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
else
NCPU=1
fi
if [ -z "$NCPU" ]; then
NCPU=1
elif [ "$NCPU" = "0" ]; then
NCPU=1
fi
if [ ! -f tfm-$TFMVER.tar.xz ]; then
echo "Downloading TomsFastMath $TFMVER sources..."
curl -L -o tfm-$TFMVER.tar.xz https://github.com/libtom/tomsfastmath/releases/download/v$TFMVER/tfm-$TFMVER.tar.xz || exit 1
fi
if [ ! -f ./crypt-$LTCVER.tar.bz2 ]; then
echo "Downloading LibTomCrypt $LTCVER sources..."
curl -L -o crypt-$LTCVER.tar.bz2 https://github.com/libtom/libtomcrypt/releases/download/$LTCVER/crypt-$LTCVER.tar.bz2 || exit 1
fi
if [ ! -d tomsfastmath-$TFMVER ]; then
echo "Checking TomsFastMath archive hash..."
if [ "`shasum -a 256 tfm-$TFMVER.tar.xz |awk '{print $1;}'`" != "47c97a1ada3ccc9fcbd2a8a922d5859a84b4ba53778c84c1d509c1a955ac1738" ]; then
echo "Uhoh, tfm-$TFMVER.tar.xz does not have the sha256sum we expected!"
exit 1
fi
echo "Unpacking TomsFastMath $TFMVER sources..."
tar -xJvvf ./tfm-$TFMVER.tar.xz
fi
if [ ! -d libtomcrypt-$LTCVER ]; then
if [ "`shasum -a 256 crypt-$LTCVER.tar.bz2 |awk '{print $1;}'`" != "e33b47d77a495091c8703175a25c8228aff043140b2554c08a3c3cd71f79d116" ]; then
echo "Uhoh, crypt-$LTCVER.tar.bz2 does not have the sha256sum we expected!"
exit 1
fi
echo "Unpacking LibTomCrypt $LTCVER sources..."
tar -xjvvf ./crypt-$LTCVER.tar.bz2
fi
echo
echo
echo "Will use make -j$NCPU. If this is wrong, check NCPU at top of script."
echo
echo
set -e
set -x
# Some compilers can't handle the ROLC inline asm; just turn it off.
cd tomsfastmath-$TFMVER
make -j$NCPU
cd ..
export CFLAGS="$CFLAGS -DTFM_DESC -DLTC_NO_ROLC -I ../tomsfastmath-$TFMVER/src/headers"
cd libtomcrypt-$LTCVER
make -j$NCPU
cd ..
set +x
echo "All done."
# end of build-libtom-unix.sh ...

View file

@ -0,0 +1,33 @@
#!/bin/bash
export TFMDIR="tomsfastmath-0.13.1"
export LTCDIR="libtomcrypt-1.17"
OSTYPE=`uname -s`
if [ -z "$CC" ]; then
if [ "`uname -o`" = "Cygwin" ]; then
export CC=/usr/bin/i686-w64-mingw32-gcc
else
export CC=cc
fi
fi
function build {
if [ "$OSTYPE" = "Darwin" ]; then
$CC -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070 -I $TFMDIR/src/headers -I $LTCDIR/src/headers -o "$1" -Wall -O3 "$1.c" rsa_common.c $LTCDIR/libtomcrypt.a $TFMDIR/libtfm.a
else
$CC -I $TFMDIR/src/headers -I $LTCDIR/src/headers -o "$1" -Wall -O3 "$1.c" rsa_common.c $LTCDIR/libtomcrypt.a $TFMDIR/libtfm.a
fi
}
set -e
set -x
./build-libtom-unix.sh
build rsa_make_keys
build rsa_sign
build rsa_verify
set +x
echo "rsa_tools are compiled!"

View file

@ -0,0 +1,61 @@
#include "rsa_common.h"
void fail(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
fputs("\n", stderr);
fflush(stderr);
exit(1);
}
void write_file(const char *fname, const void *buf, const unsigned long len)
{
FILE *io = fopen(fname, "wb");
if (!io) {
fail("Can't open '%s' for writing: %s", fname, strerror(errno));
}
if (fwrite(buf, len, 1, io) != 1) {
fail("Couldn't write '%s': %s", fname, strerror(errno));
}
if (fclose(io) != 0) {
fail("Couldn't flush '%s' to disk: %s", fname, strerror(errno));
}
}
void read_file(const char *fname, void *buf, unsigned long *len)
{
ssize_t br;
FILE *io = fopen(fname, "rb");
if (!io) {
fail("Can't open '%s' for reading: %s", fname, strerror(errno));
}
br = fread(buf, 1, *len, io);
if (ferror(io)) {
fail("Couldn't read '%s': %s", fname, strerror(errno));
} else if (!feof(io)) {
fail("Buffer too small to read '%s'", fname);
}
fclose(io);
*len = (unsigned long) br;
}
void read_rsakey(rsa_key *key, const char *fname)
{
unsigned char buf[4096];
unsigned long len = sizeof (buf);
int rc;
read_file(fname, buf, &len);
if ((rc = rsa_import(buf, len, key)) != CRYPT_OK) {
fail("rsa_import for '%s' failed: %s", fname, error_to_string(rc));
}
}

View file

@ -0,0 +1,30 @@
#ifndef _INCL_RSA_COMMON_H_
#define _INCL_RSA_COMMON_H_ 1
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#define TFM_DESC
#define LTC_NO_ROLC
#include "tomcrypt.h"
#define SALT_LEN 8
#if defined(__GNUC__) || defined(__clang__)
#define NEVER_RETURNS __attribute__((noreturn))
#define PRINTF_FUNC(fmtargnum, dotargnum) __attribute__ (( format( __printf__, fmtargnum, dotargnum )))
#else
#define NEVER_RETURNS
#define PRINTF_FUNC(fmtargnum, dotargnum)
#endif
void fail(const char *fmt, ...) NEVER_RETURNS PRINTF_FUNC(1, 2);
void write_file(const char *fname, const void *buf, const unsigned long len);
void read_file(const char *fname, void *buf, unsigned long *len);
void read_rsakey(rsa_key *key, const char *fname);
#endif
/* end of rsa_common.h ... */

View file

@ -0,0 +1,45 @@
#include "rsa_common.h"
static void write_rsakey(rsa_key *key, const int type, const char *fname)
{
unsigned char buf[4096];
unsigned long len = sizeof (buf);
int rc;
if ((rc = rsa_export(buf, &len, type, key)) != CRYPT_OK) {
fail("rsa_export for '%s' failed: %s", fname, error_to_string(rc));
}
write_file(fname, buf, len);
}
int main(int argc, char **argv)
{
int rc = 0;
prng_state prng;
int prng_index;
rsa_key key;
ltc_mp = tfm_desc;
prng_index = register_prng(&sprng_desc); /* (fortuna_desc is a good choice if your platform's PRNG sucks.) */
if (prng_index == -1) {
fail("Failed to register a RNG");
}
if ((rc = rng_make_prng(128, prng_index, &prng, NULL)) != CRYPT_OK) {
fail("rng_make_prng failed: %s", error_to_string(rc));
}
if ((rc = rsa_make_key(&prng, prng_index, 256, 65537, &key)) != CRYPT_OK) {
fail("rng_make_key failed: %s", error_to_string(rc));
}
write_rsakey(&key, PK_PRIVATE, "privatekey.bin");
write_rsakey(&key, PK_PUBLIC, "publickey.bin");
rsa_free(&key);
return 0;
}
/* end of rsa_make_keys.c ... */

View file

@ -0,0 +1,75 @@
#include "rsa_common.h"
static void sign_file(const char *fname, rsa_key *key, prng_state *prng, const int prng_index, const int hash_index)
{
const size_t sigfnamelen = strlen(fname) + 5;
char *sigfname = (char *) malloc(sigfnamelen);
unsigned char hash[256];
unsigned long hashlen = sizeof (hash);
unsigned char sig[1024];
unsigned long siglen = sizeof (sig);
int rc = 0;
int status = 0;
if (!sigfname) {
fail("out of memory");
}
if ((rc = hash_file(hash_index, fname, hash, &hashlen)) != CRYPT_OK) {
fail("hash_file for '%s' failed: %s", fname, error_to_string(rc));
}
if ((rc = rsa_sign_hash(hash, hashlen, sig, &siglen, prng, prng_index, hash_index, SALT_LEN, key)) != CRYPT_OK) {
fail("rsa_sign_hash for '%s' failed: %s", fname, error_to_string(rc));
}
if ((rc = rsa_verify_hash(sig, siglen, hash, hashlen, hash_index, SALT_LEN, &status, key)) != CRYPT_OK) {
fail("rsa_verify_hash for '%s' failed: %s", fname, error_to_string(rc));
}
if (!status) {
fail("Generated signature isn't valid! Bug in the program!");
}
snprintf(sigfname, sigfnamelen, "%s.sig", fname);
write_file(sigfname, sig, siglen);
free(sigfname);
}
int main(int argc, char **argv)
{
int rc = 0;
prng_state prng;
int prng_index, hash_index;
rsa_key key;
int i;
ltc_mp = tfm_desc;
prng_index = register_prng(&sprng_desc); /* (fortuna_desc is a good choice if your platform's PRNG sucks.) */
if (prng_index == -1) {
fail("Failed to register a RNG");
}
hash_index = register_hash(&sha256_desc);
if (hash_index == -1) {
fail("Failed to register sha256 hasher");
}
if ((rc = rng_make_prng(128, prng_index, &prng, NULL)) != CRYPT_OK) {
fail("rng_make_prng failed: %s", error_to_string(rc));
}
read_rsakey(&key, "privatekey.bin");
for (i = 1; i < argc; i++) {
sign_file(argv[i], &key, &prng, prng_index, hash_index);
}
rsa_free(&key);
return 0;
}
/* end of rsa_sign.c ... */

Some files were not shown because too many files have changed in this diff Show more