WinRT: merged with latest, official, SDL 2.x sources (at rev. bea100d73d13)

This commit is contained in:
David Ludwig 2013-04-14 11:42:55 -04:00
commit 41ce3814e2
289 changed files with 10187 additions and 10275 deletions

View file

@ -41,10 +41,9 @@
* Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
* Pike, Pliant, Python, Ruby, and Smalltalk.
*
* This library is distributed under GNU LGPL version 2, which can be
* This library is distributed under the zlib license, which can be
* found in the file "COPYING". This license allows you to use SDL
* freely in commercial programs as long as you link with the dynamic
* library.
* freely for any purpose as long as you retain the copyright notice.
*
* The best way to learn how to use SDL is to check out the header files in
* the "include" subdirectory and the programs in the "test" subdirectory.
@ -73,7 +72,9 @@
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_joystick.h"
#include "SDL_gamecontroller.h"
#include "SDL_haptic.h"
#include "SDL_hints.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
@ -112,7 +113,10 @@ extern "C" {
#define SDL_INIT_HAPTIC 0x00001000
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
#define SDL_INIT_EVERYTHING 0x0000FFFF
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
)
/*@}*/
/**

View file

@ -126,7 +126,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
* The compiler barrier prevents the compiler from reordering
* reads and writes to globally visible variables across the call.
*/
#ifdef _MSC_VER
#if defined(_MSC_VER) && (_MSC_VER > 1200)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
@ -134,7 +134,7 @@ void _ReadWriteBarrier(void);
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#else
#define SDL_CompilerBarrier() \
({ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); })
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
#endif
/* Platform specific optimized versions of the atomic functions,
@ -196,9 +196,8 @@ typedef struct { int value; } SDL_atomic_t;
* \note If you don't know what this function is for, you shouldn't use it!
*/
#ifndef SDL_AtomicCAS
#define SDL_AtomicCAS SDL_AtomicCAS_
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
#endif
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval);
/**
* \brief Set an atomic variable to a value.
@ -206,7 +205,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int
* \return The previous value of the atomic variable.
*/
#ifndef SDL_AtomicSet
static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
{
int value;
do {
@ -220,7 +219,7 @@ static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
* \brief Get the value of an atomic variable
*/
#ifndef SDL_AtomicGet
static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
{
int value = a->value;
SDL_CompilerBarrier();
@ -236,7 +235,7 @@ static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
* \note This same style can be used for any number operation
*/
#ifndef SDL_AtomicAdd
static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
{
int value;
do {
@ -271,9 +270,8 @@ static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
* \note If you don't know what this function is for, you shouldn't use it!
*/
#ifndef SDL_AtomicCASPtr
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
#endif
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval);
/**
* \brief Set a pointer to a value atomically.
@ -281,7 +279,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void
* \return The previous value of the pointer.
*/
#ifndef SDL_AtomicSetPtr
static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
{
void* value;
do {
@ -295,7 +293,7 @@ static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
* \brief Get the value of a pointer atomically.
*/
#ifndef SDL_AtomicGetPtr
static __inline__ void* SDL_AtomicGetPtr(void* *a)
SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
{
void* value = *a;
SDL_CompilerBarrier();

View file

@ -40,11 +40,6 @@ extern "C" {
/**
* \file SDL_bits.h
*
* Uses inline functions for compilers that support them, and static
* functions for those that do not. Because these functions become
* static for compilers that do not support inline functions, this
* header should only be included in files that actually use them.
*/
/**
@ -54,10 +49,10 @@ extern "C" {
*
* \return Index of the most significant bit.
*/
static __inline__ Sint8
SDL_FORCE_INLINE Sint8
SDL_MostSignificantBitIndex32(Uint32 x)
{
#if defined(__GNUC__)
#if defined(__GNUC__) && __GNUC__ >= 4
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/

View file

@ -39,8 +39,8 @@
#include "SDL_config_iphoneos.h"
#elif defined(__ANDROID__)
#include "SDL_config_android.h"
#elif defined(__NINTENDODS__)
#include "SDL_config_nintendods.h"
#elif defined(__PSP__)
#include "SDL_config_psp.h"
#else
/* This is a minimal configuration just to get SDL running on new platforms */
#include "SDL_config_minimal.h"

View file

@ -195,7 +195,6 @@
#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@
#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@
#cmakedefine SDL_AUDIO_DRIVER_NDS @SDL_AUDIO_DRIVER_NDS@
#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@
#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@
#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@
@ -213,7 +212,6 @@
#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@
#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@
#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@
#cmakedefine SDL_JOYSTICK_NDS @SDL_JOYSTICK_NDS@
#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@
#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@
#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@
@ -231,7 +229,6 @@
/* Enable various threading systems */
#cmakedefine SDL_THREAD_BEOS @SDL_THREAD_BEOS@
#cmakedefine SDL_THREAD_NDS @SDL_THREAD_NDS@
#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
@ -240,7 +237,6 @@
/* Enable various timer systems */
#cmakedefine SDL_TIMER_BEOS @SDL_TIMER_BEOS@
#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@
#cmakedefine SDL_TIMER_NDS @SDL_TIMER_NDS@
#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@
@ -251,7 +247,6 @@
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@
#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@
#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@
#cmakedefine SDL_VIDEO_DRIVER_NDS @SDL_VIDEO_DRIVER_NDS@
#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@
#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@
#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@
@ -295,7 +290,6 @@
#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@
#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@
#cmakedefine SDL_POWER_BEOS @SDL_POWER_BEOS@
#cmakedefine SDL_POWER_NINTENDODS @SDL_POWER_NINTENDODS@
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
/* Enable assembly routines */

View file

@ -198,7 +198,6 @@
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
#undef SDL_AUDIO_DRIVER_NAS
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
#undef SDL_AUDIO_DRIVER_NDS
#undef SDL_AUDIO_DRIVER_OSS
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
#undef SDL_AUDIO_DRIVER_PAUDIO
@ -216,7 +215,6 @@
#undef SDL_JOYSTICK_DUMMY
#undef SDL_JOYSTICK_IOKIT
#undef SDL_JOYSTICK_LINUX
#undef SDL_JOYSTICK_NDS
#undef SDL_JOYSTICK_WINMM
#undef SDL_JOYSTICK_USBHID
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
@ -234,7 +232,6 @@
/* Enable various threading systems */
#undef SDL_THREAD_BEOS
#undef SDL_THREAD_NDS
#undef SDL_THREAD_PTHREAD
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
@ -243,7 +240,6 @@
/* Enable various timer systems */
#undef SDL_TIMER_BEOS
#undef SDL_TIMER_DUMMY
#undef SDL_TIMER_NDS
#undef SDL_TIMER_UNIX
#undef SDL_TIMER_WINDOWS
@ -253,7 +249,6 @@
#undef SDL_VIDEO_DRIVER_DIRECTFB
#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_NDS
#undef SDL_VIDEO_DRIVER_WINDOWS
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
@ -297,7 +292,6 @@
#undef SDL_POWER_WINDOWS
#undef SDL_POWER_MACOSX
#undef SDL_POWER_BEOS
#undef SDL_POWER_NINTENDODS
#undef SDL_POWER_HARDWIRED
/* Enable assembly routines */

View file

@ -19,40 +19,29 @@
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_config_nintendods_h
#define _SDL_config_nintendods_h
#ifndef _SDL_config_psp_h
#define _SDL_config_psp_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
/* LiF: __PTRDIFF_TYPE__ was causing errors of conflicting typedefs with the
<stdint.h> shipping with devkitARM. copied a similar ifdef from it. */
#ifndef __PTRDIFF_TYPE__
typedef unsigned long uintptr_t;
#else
typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
#ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#define SIZEOF_VOIDP 4
#define HAVE_GCC_ATOMICS 1
/* Useful headers */
#define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
/* C library functions */
#define HAVE_MALLOC 1
@ -63,6 +52,8 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
@ -71,59 +62,75 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE_INDEX 1
#define HAVE_RINDEX 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_LOG 1
#define HAVE_POW 1
#define HAVE_SCALBN 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
//#define HAVE_SYSCONF 1
//#define HAVE_SIGACTION 1
/* DS isn't that sophisticated */
/* PSP isn't that sophisticated */
#define LACKS_SYS_MMAN_H 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_NDS 1
/*#define SDL_AUDIO_DRIVER_DUMMY 1 TODO: uncomment this later*/
/* Enable the stub thread support (src/thread/psp/\*.c) */
#define SDL_THREAD_PSP 1
/* Enable various input drivers */
#define SDL_JOYSTICK_NDS 1
/*#define SDL_JOYSTICK_DUMMY 1 TODO: uncomment this later*/
/* Enable the stub timer support (src/timer/psp/\*.c) */
#define SDL_TIMERS_PSP 1
/* DS has no dynamic linking afaik */
#define SDL_LOADSO_DISABLED 1
/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
#define SDL_JOYSTICK_PSP 1
/* Enable various threading systems */
/*#define SDL_THREAD_NDS 1*/
#define SDL_THREADS_DISABLED 1
/* Enable the stub audio driver (src/audio/psp/\*.c) */
#define SDL_AUDIO_DRIVER_PSP 1
/* Enable various timer systems */
#define SDL_TIMER_NDS 1
/* PSP video dirver */
#define SDL_VIDEO_DRIVER_PSP 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_NDS 1
#ifdef USE_HW_RENDERER
#define SDL_VIDEO_RENDER_NDS 1
#else
#define SDL_VIDEO_RENDER_NDS 0
#endif
/* PSP render dirver */
#define SDL_VIDEO_RENDER_PSP 1
/* Enable system power support */
#define SDL_POWER_NINTENDODS 1
#define SDL_POWER_PSP 1
/* Enable haptic support */
#define SDL_HAPTIC_NDS 1
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
#define SDL_BYTEORDER SDL_LIL_ENDIAN
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
#endif /* _SDL_config_nintendods_h */
#endif /* _SDL_config_minimal_h */

View file

@ -109,7 +109,7 @@ typedef unsigned int uintptr_t;
//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
//#define HAVE_STRTOLL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
@ -123,14 +123,14 @@ typedef unsigned int uintptr_t;
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
//#define HAVE_COPYSIGN 1 // TODO, WinRT: consider using _copysign instead
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_LOG 1
#define HAVE_POW 1
#define HAVE_SCALBN 1
//#define HAVE_SCALBN 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1

View file

@ -66,29 +66,24 @@ extern "C" {
/**
* \file SDL_endian.h
*
* Uses inline functions for compilers that support them, and static
* functions for those that do not. Because these functions become
* static for compilers that do not support inline functions, this
* header should only be included in files that actually use them.
*/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
int result;
@ -97,14 +92,14 @@ SDL_Swap16(Uint16 x)
return (Uint16)result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#else
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
@ -112,21 +107,21 @@ SDL_Swap16(Uint16 x)
#endif
#if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswap %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswapl %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
Uint32 result;
@ -137,14 +132,14 @@ SDL_Swap32(Uint32 x)
return result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#else
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
@ -153,7 +148,7 @@ SDL_Swap32(Uint32 x)
#endif
#if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint64
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
union
@ -171,14 +166,14 @@ SDL_Swap64(Uint64 x)
return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint64
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
__asm__("bswapq %0": "=r"(x):"0"(x));
return x;
}
#else
static __inline__ Uint64
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
Uint32 hi, lo;
@ -195,7 +190,7 @@ SDL_Swap64(Uint64 x)
#endif
static __inline__ float
SDL_FORCE_INLINE float
SDL_SwapFloat(float x)
{
union

View file

@ -39,7 +39,8 @@ extern "C" {
#endif
/* Public functions */
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
/* SDL_SetError() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void);
@ -62,7 +63,8 @@ typedef enum
SDL_UNSUPPORTED,
SDL_LASTERROR
} SDL_errorcode;
extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
/* SDL_Error() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
/*@}*//*Internal error functions*/
/* Ends C function definitions when using C++ */

View file

@ -77,14 +77,6 @@ typedef enum
SDL_MOUSEBUTTONUP, /**< Mouse button released */
SDL_MOUSEWHEEL, /**< Mouse wheel motion */
/* Tablet or multiple mice input device events */
SDL_INPUTMOTION = 0x500, /**< Input moved */
SDL_INPUTBUTTONDOWN, /**< Input button pressed */
SDL_INPUTBUTTONUP, /**< Input button released */
SDL_INPUTWHEEL, /**< Input wheel motion */
SDL_INPUTPROXIMITYIN, /**< Input pen entered proximity */
SDL_INPUTPROXIMITYOUT, /**< Input pen left proximity */
/* Joystick events */
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
SDL_JOYBALLMOTION, /**< Joystick trackball motion */
@ -100,13 +92,12 @@ typedef enum
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
/* Touch events */
SDL_FINGERDOWN = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,
SDL_TOUCHBUTTONDOWN,
SDL_TOUCHBUTTONUP,
/* Gesture events */
SDL_DOLLARGESTURE = 0x800,
@ -130,6 +121,15 @@ typedef enum
SDL_LASTEVENT = 0xFFFF
} SDL_EventType;
/**
* \brief Fields shared by every event
*/
typedef struct SDL_GenericEvent
{
Uint32 type;
Uint32 timestamp;
} SDL_GenericEvent;
/**
* \brief Window state change event data (event.window.*)
*/
@ -142,8 +142,8 @@ typedef struct SDL_WindowEvent
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
int data1; /**< event dependent data */
int data2; /**< event dependent data */
Sint32 data1; /**< event dependent data */
Sint32 data2; /**< event dependent data */
} SDL_WindowEvent;
/**
@ -171,8 +171,8 @@ typedef struct SDL_TextEditingEvent
Uint32 timestamp;
Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
int start; /**< The start cursor of selected editing text */
int length; /**< The length of selected editing text */
Sint32 start; /**< The start cursor of selected editing text */
Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingEvent;
@ -196,14 +196,15 @@ typedef struct SDL_MouseMotionEvent
Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 state; /**< The current button state */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
int x; /**< X coordinate, relative to window */
int y; /**< Y coordinate, relative to window */
int xrel; /**< The relative motion in the X direction */
int yrel; /**< The relative motion in the Y direction */
Sint32 x; /**< X coordinate, relative to window */
Sint32 y; /**< Y coordinate, relative to window */
Sint32 xrel; /**< The relative motion in the X direction */
Sint32 yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
/**
@ -214,12 +215,13 @@ typedef struct SDL_MouseButtonEvent
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
int x; /**< X coordinate, relative to window */
int y; /**< Y coordinate, relative to window */
Sint32 x; /**< X coordinate, relative to window */
Sint32 y; /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent;
/**
@ -230,8 +232,9 @@ typedef struct SDL_MouseWheelEvent
Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
int x; /**< The amount scrolled horizontally */
int y; /**< The amount scrolled vertically */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Sint32 x; /**< The amount scrolled horizontally */
Sint32 y; /**< The amount scrolled vertically */
} SDL_MouseWheelEvent;
/**
@ -241,11 +244,13 @@ typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 timestamp;
Uint8 which; /**< The joystick instance id */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
Uint8 padding2;
int value; /**< The axis value (range: -32768 to 32767) */
Uint8 padding3;
Sint16 value; /**< The axis value (range: -32768 to 32767) */
Uint16 padding4;
} SDL_JoyAxisEvent;
/**
@ -254,13 +259,14 @@ typedef struct SDL_JoyAxisEvent
typedef struct SDL_JoyBallEvent
{
Uint32 type; /**< ::SDL_JOYBALLMOTION */
Uint32 timestamp;
Uint8 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */
Uint8 padding1;
Uint8 padding2;
int xrel; /**< The relative motion in the X direction */
int yrel; /**< The relative motion in the Y direction */
Uint8 padding3;
Sint16 xrel; /**< The relative motion in the X direction */
Sint16 yrel; /**< The relative motion in the Y direction */
} SDL_JoyBallEvent;
/**
@ -269,8 +275,8 @@ typedef struct SDL_JoyBallEvent
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 timestamp;
Uint8 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value.
* \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
@ -280,6 +286,7 @@ typedef struct SDL_JoyHatEvent
* Note that zero means the POV is centered.
*/
Uint8 padding1;
Uint8 padding2;
} SDL_JoyHatEvent;
/**
@ -288,11 +295,12 @@ typedef struct SDL_JoyHatEvent
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 timestamp;
Uint8 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
} SDL_JoyButtonEvent;
/**
@ -302,7 +310,7 @@ typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp;
Uint32 which; /**< The joystick device index for ADD, instance_id for REMOVE*/
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;
@ -312,10 +320,14 @@ typedef struct SDL_JoyDeviceEvent
typedef struct SDL_ControllerAxisEvent
{
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
Uint32 timestamp;
Uint8 which; /**< The joystick instance id */
SDL_CONTROLLER_AXIS axis; /**< The joystick axis index */
int value; /**< The axis value (range: -32768 to 32767) */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint16 value; /**< The axis value (range: -32768 to 32767) */
Uint16 padding4;
} SDL_ControllerAxisEvent;
@ -325,10 +337,12 @@ typedef struct SDL_ControllerAxisEvent
typedef struct SDL_ControllerButtonEvent
{
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
Uint32 timestamp;
Uint8 which; /**< The joystick instance id */
SDL_CONTROLLER_BUTTON button; /**< The joystick button index */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
} SDL_ControllerButtonEvent;
@ -337,51 +351,29 @@ typedef struct SDL_ControllerButtonEvent
*/
typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED or ::SDL_CONTROLLERDEVICEREMOVED */
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
Uint32 timestamp;
Uint32 which; /**< The joystick device index for ADD, instance_id for REMOVE*/
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;
/**
* \brief Touch finger motion/finger event structure (event.tfinger.*)
* \brief Touch finger event structure (event.tfinger.*)
*/
typedef struct SDL_TouchFingerEvent
{
Uint32 type; /**< ::SDL_FINGERMOTION OR
SDL_FINGERDOWN OR SDL_FINGERUP*/
Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
SDL_TouchID touchId; /**< The touch device id */
SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
Uint8 state; /**< The current button state */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Uint16 x;
Uint16 y;
Sint16 dx;
Sint16 dy;
Uint16 pressure;
float x; /**< Normalized in the range 0...1 */
float y; /**< Normalized in the range 0...1 */
float dx; /**< Normalized in the range 0...1 */
float dy; /**< Normalized in the range 0...1 */
float pressure; /**< Normalized in the range 0...1 */
} SDL_TouchFingerEvent;
/**
* \brief Touch finger motion/finger event structure (event.tbutton.*)
*/
typedef struct SDL_TouchButtonEvent
{
Uint32 type; /**< ::SDL_TOUCHBUTTONUP OR SDL_TOUCHBUTTONDOWN */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
SDL_TouchID touchId; /**< The touch device index */
Uint8 state; /**< The current button state */
Uint8 button; /**< The button changing state */
Uint8 padding1;
Uint8 padding2;
} SDL_TouchButtonEvent;
/**
* \brief Multiple Finger Gesture Event (event.mgesture.*)
*/
@ -389,31 +381,27 @@ typedef struct SDL_MultiGestureEvent
{
Uint32 type; /**< ::SDL_MULTIGESTURE */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
SDL_TouchID touchId; /**< The touch device index */
SDL_TouchID touchId; /**< The touch device index */
float dTheta;
float dDist;
float x; /* currently 0...1. Change to screen coords? */
float x;
float y;
Uint16 numFingers;
Uint16 padding;
} SDL_MultiGestureEvent;
/* (event.dgesture.*) */
typedef struct SDL_DollarGestureEvent
{
Uint32 type; /**< ::SDL_DOLLARGESTURE */
Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
SDL_TouchID touchId; /**< The touch device index */
SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId;
Uint32 numFingers;
float error;
/*
//TODO: Enable to give location?
float x; //currently 0...1. Change to screen coords?
float y;
*/
float x; /**< Normalized center of gesture */
float y; /**< Normalized center of gesture */
} SDL_DollarGestureEvent;
@ -448,7 +436,7 @@ typedef struct SDL_UserEvent
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
Uint32 timestamp;
Uint32 windowID; /**< The associated window if any */
int code; /**< User defined event code */
Sint32 code; /**< User defined event code */
void *data1; /**< User defined data pointer */
void *data2; /**< User defined data pointer */
} SDL_UserEvent;
@ -476,6 +464,7 @@ typedef struct SDL_SysWMEvent
typedef union SDL_Event
{
Uint32 type; /**< Event type, shared with all events */
SDL_GenericEvent generic; /**< Generic event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
@ -488,16 +477,15 @@ typedef union SDL_Event
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
SDL_ControllerAxisEvent caxis; /**< Game Controller button event data */
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_TouchButtonEvent tbutton; /**< Touch button event data */
SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */
SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */
SDL_MultiGestureEvent mgesture; /**< Gesture event data */
SDL_DollarGestureEvent dgesture; /**< Gesture event data */
SDL_DropEvent drop; /**< Drag and drop event data */
/* This is necessary for ABI compatibility between Visual C++ and GCC

View file

@ -59,25 +59,23 @@ typedef enum
SDL_CONTROLLER_BINDTYPE_BUTTON,
SDL_CONTROLLER_BINDTYPE_AXIS,
SDL_CONTROLLER_BINDTYPE_HAT
} SDL_CONTROLLER_BINDTYPE;
/**
* get the sdl joystick layer binding for this controller button/axis mapping
*/
struct _SDL_GameControllerHatBind
{
int hat;
int hat_mask;
};
} SDL_GameControllerBindType;
typedef struct _SDL_GameControllerButtonBind
/**
* Get the SDL joystick layer binding for this controller button/axis mapping
*/
typedef struct SDL_GameControllerButtonBind
{
SDL_CONTROLLER_BINDTYPE m_eBindType;
SDL_GameControllerBindType bindType;
union
{
int button;
int axis;
struct _SDL_GameControllerHatBind hat;
};
struct {
int hat;
int hat_mask;
} hat;
} value;
} SDL_GameControllerButtonBind;
@ -92,7 +90,7 @@ typedef struct _SDL_GameControllerButtonBind
* }
* }
*
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
* guid,name,mappings
*
* Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
@ -108,6 +106,26 @@ typedef struct _SDL_GameControllerButtonBind
*
*/
/**
* Add or update an existing mapping configuration
*
* \return 1 if mapping is added, 0 if updated, -1 on error
*/
extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString );
/**
* Get a mapping string for a GUID
*
* \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
*/
extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid );
/**
* Get a mapping string for an open GameController
*
* \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
*/
extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller );
/**
* Is the joystick on this index supported by the game controller interface?
@ -159,6 +177,15 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont
*/
extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
/**
* Update the current state of the open game controllers.
*
* This is called automatically by the event loop if any game controller
* events are enabled.
*/
extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
/**
* The list of axii available from a controller
*/
@ -172,19 +199,24 @@ typedef enum
SDL_CONTROLLER_AXIS_TRIGGERLEFT,
SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
SDL_CONTROLLER_AXIS_MAX
} SDL_CONTROLLER_AXIS;
} SDL_GameControllerAxis;
/**
* turn this string into a axis mapping
*/
extern DECLSPEC SDL_CONTROLLER_AXIS SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
/**
* get the sdl joystick layer binding for this controller button mapping
* turn this axis enum into a string mapping
*/
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
/**
* Get the SDL joystick layer binding for this controller button mapping
*/
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
SDL_CONTROLLER_AXIS button);
SDL_GameControllerAxis axis);
/**
* Get the current state of an axis control on a game controller.
@ -195,7 +227,7 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
*/
extern DECLSPEC Sint16 SDLCALL
SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
SDL_CONTROLLER_AXIS axis);
SDL_GameControllerAxis axis);
/**
* The list of buttons available from a controller
@ -219,20 +251,24 @@ typedef enum
SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
SDL_CONTROLLER_BUTTON_MAX
} SDL_CONTROLLER_BUTTON;
} SDL_GameControllerButton;
/**
* turn this string into a button mapping
*/
extern DECLSPEC SDL_CONTROLLER_BUTTON SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
/**
* get the sdl joystick layer binding for this controller button mapping
* turn this button enum into a string mapping
*/
extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
/**
* Get the SDL joystick layer binding for this controller button mapping
*/
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
SDL_CONTROLLER_BUTTON button);
SDL_GameControllerButton button);
/**
@ -241,7 +277,7 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
* The button indices start at index 0.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
SDL_CONTROLLER_BUTTON button);
SDL_GameControllerButton button);
/**
* Close a controller previously opened with SDL_GameControllerOpen().

View file

@ -197,9 +197,22 @@ extern "C" {
/**
* \brief A variable that lets you manually hint extra gamecontroller db entries
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
*
* The variable expected newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
* The variable can be set to the following values:
* "0" - Disable XInput timer (only uses direct input)
* "1" - Enable XInput timer (the default)
*/
#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED"
/**
* \brief A variable that lets you manually hint extra gamecontroller db entries
*
* The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h
*
* This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
* You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping()
*/
#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"

View file

@ -67,7 +67,7 @@ typedef struct {
Uint8 data[16];
} SDL_JoystickGUID;
typedef int SDL_JoystickID;
typedef Sint32 SDL_JoystickID;
/* Function prototypes */
@ -126,7 +126,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);
/**
* Get the instance ID of an opened joystick.
* Get the instance ID of an opened joystick or -1 if the joystick is invalid.
*/
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);

View file

@ -70,8 +70,15 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
*
* \return 0, or -1 on error.
*/
#define SDL_LockMutex(m) SDL_mutexP(m)
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex);
#define SDL_mutexP(m) SDL_LockMutex(m)
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
/**
* Try to lock the mutex
*
* \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error
*/
extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
/**
* Unlock the mutex.
@ -81,8 +88,8 @@ extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex);
* \warning It is an error to unlock a mutex that has not been locked by
* the current thread, and doing so results in undefined behavior.
*/
#define SDL_UnlockMutex(m) SDL_mutexV(m)
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex * mutex);
#define SDL_mutexV(m) SDL_UnlockMutex(m)
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
/**
* Destroy a mutex.

View file

@ -44,10 +44,6 @@
#define NO_SDL_GLEXT 1
#endif
#ifdef __FreeBSD__ /* !!! FIXME: temp compiler warning fix... */
#define NO_SDL_GLEXT 1
#endif
#ifdef __glext_h_
/* Someone has already included glext.h */
#define NO_SDL_GLEXT

View file

@ -256,7 +256,7 @@ typedef struct SDL_Color
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 unused;
Uint8 a;
} SDL_Color;
#define SDL_Colour SDL_Color

View file

@ -138,12 +138,10 @@
#endif /* if ! defined(WINAPI_FAMILY_PARTITION) ; else */
#endif /* if defined(WIN32) || defined(_WIN32) */
#if defined(__NDS__)
#undef __NINTENDODS__
#define __NINTENDODS__ 1
#if defined(__PSP__)
#define __PSP__ 1
#endif
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus

View file

@ -40,6 +40,14 @@ extern "C" {
/* *INDENT-ON* */
#endif
/* RWops Types */
#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */
#define SDL_RWOPS_WINFILE 1 /* Win32 file */
#define SDL_RWOPS_STDFILE 2 /* Stdio file */
#define SDL_RWOPS_JNIFILE 3 /* Android asset */
#define SDL_RWOPS_MEMORY 4 /* Memory stream */
#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */
/**
* This is the read/write operation structure -- very basic.
*/
@ -54,7 +62,7 @@ typedef struct SDL_RWops
* Seek to \c offset relative to \c whence, one of stdio's whence values:
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
*
* \return the final offset in the data stream.
* \return the final offset in the data stream, or -1 on error.
*/
Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
int whence);
@ -130,6 +138,7 @@ typedef struct SDL_RWops
struct
{
void *data1;
int data2;
} unknown;
} hidden;

View file

@ -38,7 +38,7 @@
* SDL_Event structure.
*
* The values in this enumeration are based on the USB usage page standard:
* http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
* http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
*/
typedef enum
{
@ -385,6 +385,9 @@ typedef enum
SDL_SCANCODE_EJECT = 281,
SDL_SCANCODE_SLEEP = 282,
SDL_SCANCODE_APP1 = 283,
SDL_SCANCODE_APP2 = 284,
/*@}*//*Walther keys*/
/* Add any other keys here. */

View file

@ -30,7 +30,6 @@
#include "SDL_config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@ -182,14 +181,10 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
enums having the size of an int must be enabled.
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
*/
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
#ifdef __MWERKS__
#pragma enumsalwaysint on
#endif
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if !defined(__NINTENDODS__) && !defined(__ANDROID__)
#if !defined(__ANDROID__)
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum
{
@ -209,30 +204,6 @@ extern "C" {
/* *INDENT-ON* */
#endif
#ifdef HAVE_MALLOC
#define SDL_malloc malloc
#else
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
#endif
#ifdef HAVE_CALLOC
#define SDL_calloc calloc
#else
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
#endif
#ifdef HAVE_REALLOC
#define SDL_realloc realloc
#else
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
#endif
#ifdef HAVE_FREE
#define SDL_free free
#else
extern DECLSPEC void SDLCALL SDL_free(void *mem);
#endif
#if defined(HAVE_ALLOCA) && !defined(alloca)
# if defined(HAVE_ALLOCA_H)
# include <alloca.h>
@ -263,380 +234,460 @@ char *alloca();
#define SDL_stack_free(data) SDL_free(data)
#endif
#ifdef HAVE_GETENV
#define SDL_getenv getenv
#else
/* SDL stdinc inline functions:
The theory here is that by default we forcibly inline what we can, and your
app will use the inline version by default. However we expose a non-inline
version too, so the symbol is always available in the library even if your app
bypassed the inline version. The SDL_*_inline versions aren't guaranteed to
exist, so never call them directly; use SDL_* instead, and trust the system
to give you the right thing.
The benefit here is that you can dlsym() these functions, which you
couldn't if you had macros, you can link against a foreign build of SDL
even if you configured differently, and you can drop the unconfigured SDL
headers into a project without #defining HAVE_MALLOC (etc) and still link.
*/
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
#ifdef HAVE_MALLOC
SDL_FORCE_INLINE void *SDL_malloc_inline(size_t size) { return malloc(size); }
#define SDL_malloc SDL_malloc_inline
#endif
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
#ifdef HAVE_CALLOC
SDL_FORCE_INLINE void *SDL_calloc_inline(size_t nmemb, size_t size) { return calloc(nmemb, size); }
#define SDL_calloc SDL_calloc_inline
#endif
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
#ifdef HAVE_REALLOC
SDL_FORCE_INLINE void *SDL_realloc_inline(void *mem, size_t size) { return realloc(mem, size); }
#define SDL_realloc SDL_realloc_inline
#endif
extern DECLSPEC void SDLCALL SDL_free(void *mem);
#ifdef HAVE_FREE
SDL_FORCE_INLINE void SDL_free_inline(void *mem) { free(mem); }
#define SDL_free SDL_free_inline
#endif
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
#ifdef HAVE_GETENV
SDL_FORCE_INLINE char *SDL_getenv_inline(const char *name) { return getenv(name); }
#define SDL_getenv SDL_getenv_inline
#endif
/* SDL_putenv() has moved to SDL_compat. */
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
#ifdef HAVE_SETENV
#define SDL_setenv setenv
#else
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value,
int overwrite);
SDL_FORCE_INLINE int SDL_setenv_inline(const char *name, const char *value, int overwrite) { return setenv(name, value, overwrite); }
#define SDL_setenv SDL_setenv_inline
#endif
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
#ifdef HAVE_QSORT
#define SDL_qsort qsort
#else
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
int (*compare) (const void *,
const void *));
SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { qsort(base, nmemb, size, compare); }
#define SDL_qsort SDL_qsort_inline
#endif
extern DECLSPEC int SDLCALL SDL_abs(int x);
#ifdef HAVE_ABS
#define SDL_abs abs
SDL_FORCE_INLINE int SDL_abs_inline(int x) { return abs(x); }
#else
#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
SDL_FORCE_INLINE int SDL_abs_inline(int x) { return ((x) < 0 ? -(x) : (x)); }
#endif
#define SDL_abs SDL_abs_inline
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
/* !!! FIXME: these have side effects. You probably shouldn't use them. */
/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
extern DECLSPEC int SDLCALL SDL_isspace(int x);
extern DECLSPEC int SDLCALL SDL_toupper(int x);
extern DECLSPEC int SDLCALL SDL_tolower(int x);
#ifdef HAVE_CTYPE_H
#define SDL_isdigit(X) isdigit(X)
#define SDL_isspace(X) isspace(X)
#define SDL_toupper(X) toupper(X)
#define SDL_tolower(X) tolower(X)
SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return isdigit(x); }
SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return isspace(x); }
SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return toupper(x); }
SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return tolower(x); }
#else
#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
SDL_FORCE_INLINE int SDL_isdigit_inline(int x) { return ((x) >= '0') && ((x) <= '9'); }
SDL_FORCE_INLINE int SDL_isspace_inline(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n'); }
SDL_FORCE_INLINE int SDL_toupper_inline(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
SDL_FORCE_INLINE int SDL_tolower_inline(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
#endif
#define SDL_isdigit SDL_isdigit_inline
#define SDL_isspace SDL_isspace_inline
#define SDL_toupper SDL_toupper_inline
#define SDL_tolower SDL_tolower_inline
#ifdef HAVE_MEMSET
#define SDL_memset memset
#else
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
#ifdef HAVE_MEMSET
SDL_FORCE_INLINE void *SDL_memset_inline(void *dst, int c, size_t len) { return memset(dst, c, len); }
#define SDL_memset SDL_memset_inline
#endif
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
#define SDL_zerop(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)))
/* !!! FIXME: does this _really_ beat memset() on any modern platform? */
SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t len)
{
#if defined(__GNUC__) && defined(i386)
#define SDL_memset4(dst, val, len) \
do { \
int u0, u1, u2; \
__asm__ __volatile__ ( \
"cld\n\t" \
"rep ; stosl\n\t" \
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \
: "memory" ); \
} while(0)
#endif
#ifndef SDL_memset4
#define SDL_memset4(dst, val, len) \
do { \
unsigned _count = (len); \
unsigned _n = (_count + 3) / 4; \
Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
Uint32 _val = (val); \
if (len == 0) break; \
switch (_count % 4) { \
case 0: do { *_p++ = _val; \
case 3: *_p++ = _val; \
case 2: *_p++ = _val; \
case 1: *_p++ = _val; \
} while ( --_n ); \
} \
} while(0)
int u0, u1, u2;
__asm__ __volatile__ (
"cld \n\t"
"rep ; stosl \n\t"
: "=&D" (u0), "=&a" (u1), "=&c" (u2)
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len))
: "memory"
);
/* !!! FIXME: amd64? */
#else
size_t _n = (len + 3) / 4;
Uint32 *_p = SDL_static_cast(Uint32 *, dst);
Uint32 _val = (val);
if (len == 0)
return;
switch (len % 4)
{
case 0: do { *_p++ = _val;
case 3: *_p++ = _val;
case 2: *_p++ = _val;
case 1: *_p++ = _val;
} while ( --_n );
}
#endif
}
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
#if defined(__MACOSX__)
#define SDL_memcpy memcpy
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
{
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
return memcpy(dst, src, len);
}
#define SDL_memcpy SDL_memcpy_inline
#elif defined(__GNUC__) && defined(i386) && !defined(__WIN32__)
#define SDL_memcpy(dst, src, len) \
do { \
int u0, u1, u2; \
__asm__ __volatile__ ( \
"cld\n\t" \
"rep ; movsl\n\t" \
"testb $2,%b4\n\t" \
"je 1f\n\t" \
"movsw\n" \
"1:\ttestb $1,%b4\n\t" \
"je 2f\n\t" \
"movsb\n" \
"2:" \
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \
: "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
: "memory" ); \
} while(0)
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
{
/* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
/* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
/* !!! FIXME: amd64? */
int u0, u1, u2;
__asm__ __volatile__ (
"cld \n\t"
"rep ; movsl \n\t"
"testb $2,%b4 \n\t"
"je 1f \n\t"
"movsw \n"
"1:\ttestb $1,%b4 \n\t"
"je 2f \n\t"
"movsb \n"
"2:"
: "=&c" (u0), "=&D" (u1), "=&S" (u2)
: "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst), "2" (src)
: "memory"
);
return dst;
}
#define SDL_memcpy SDL_memcpy_inline
#elif defined(HAVE_MEMCPY)
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
{
return memcpy(dst, src, len);
}
#define SDL_memcpy SDL_memcpy_inline
#elif defined(HAVE_BCOPY) /* !!! FIXME: is there _really_ ever a time where you have bcopy and not memcpy? */
SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
{
bcopy(src, dst, len);
return dst;
}
#define SDL_memcpy SDL_memcpy_inline
#endif
#ifndef SDL_memcpy
#ifdef HAVE_MEMCPY
#define SDL_memcpy memcpy
#elif defined(HAVE_BCOPY)
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
{
#if defined(__GNUC__) && defined(i386)
/* !!! FIXME: does this _really_ beat memcpy() on any modern platform? */
/* !!! FIXME: shouldn't we just force the inputs to ecx/edi/esi instead of this tapdance with outputs? */
int ecx, edi, esi;
__asm__ __volatile__ (
"cld \n\t"
"rep ; movsl \n\t"
: "=&c" (ecx), "=&D" (edi), "=&S" (esi)
: "0" (SDL_static_cast(unsigned, dwords)), "1" (dst), "2" (src)
: "memory"
);
return dst;
#else
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
size_t len);
#endif
#endif
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACOSX__)
#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2)
#elif defined(__GNUC__) && defined(i386)
#define SDL_memcpy4(dst, src, len) \
do { \
int ecx, edi, esi; \
__asm__ __volatile__ ( \
"cld\n\t" \
"rep ; movsl" \
: "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
: "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \
: "memory" ); \
} while(0)
#endif
#ifndef SDL_memcpy4
#define SDL_memcpy4(dst, src, len) SDL_memcpy((dst), (src), (len) << 2)
return SDL_memcpy(dst, src, dwords * 4);
#endif
}
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len);
#ifdef HAVE_MEMMOVE
#define SDL_memmove memmove
#else
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src,
size_t len);
SDL_FORCE_INLINE void *SDL_memmove_inline(void *dst, const void *src, size_t len) { return memmove(dst, src, len); }
#define SDL_memmove SDL_memmove_inline
#endif
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
#ifdef HAVE_MEMCMP
#define SDL_memcmp memcmp
#else
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
size_t len);
SDL_FORCE_INLINE int SDL_memcmp_inline(const void *s1, const void *s2, size_t len) { return memcmp(s1, s2, len); }
#define SDL_memcmp SDL_memcmp_inline
#endif
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
#ifdef HAVE_STRLEN
#define SDL_strlen strlen
#else
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
SDL_FORCE_INLINE size_t SDL_strlen_inline(const char *str) { return strlen(str); }
#define SDL_strlen SDL_strlen_inline
#endif
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
#ifdef HAVE_WCSLEN
#define SDL_wcslen wcslen
#else
#if !defined(wchar_t) && defined(__NINTENDODS__)
#define wchar_t short /* TODO: figure out why libnds doesn't have this */
#endif
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
SDL_FORCE_INLINE size_t SDL_wcslen_inline(const wchar_t *wstr) { return wcslen(wstr); }
#define SDL_wcslen SDL_wcslen_inline
#endif
#ifdef HAVE_WCSLCPY
#define SDL_wcslcpy wcslcpy
#else
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
#ifdef HAVE_WCSLCPY
SDL_FORCE_INLINE size_t SDL_wcslcpy_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcpy(dst, src, maxlen); }
#define SDL_wcslcpy SDL_wcslcpy_inline
#endif
#ifdef HAVE_WCSLCAT
#define SDL_wcslcat wcslcat
#else
extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);
#ifdef HAVE_WCSLCAT
SDL_FORCE_INLINE size_t SDL_wcslcat_inline(wchar_t *dst, const wchar_t *src, size_t maxlen) { return wcslcat(dst, src, maxlen); }
#define SDL_wcslcat SDL_wcslcat_inline
#endif
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
#ifdef HAVE_STRLCPY
#define SDL_strlcpy strlcpy
SDL_FORCE_INLINE size_t SDL_strlcpy_inline(char *dst, const char *src, size_t maxlen) { return strlcpy(dst, src, maxlen); }
#define SDL_strlcpy SDL_strlcpy_inline
#else
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
size_t maxlen);
#endif
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src,
size_t dst_bytes);
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes);
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
#ifdef HAVE_STRLCAT
#define SDL_strlcat strlcat
#else
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
size_t maxlen);
SDL_FORCE_INLINE size_t SDL_strlcat_inline(char *dst, const char *src, size_t maxlen) { return strlcat(dst, src, maxlen); }
#define SDL_strlcat SDL_strlcat_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
#ifdef HAVE_STRDUP
#define SDL_strdup strdup
#else
extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
SDL_FORCE_INLINE char *SDL_strdup_inline(const char *str) { return strdup(str); }
#define SDL_strdup SDL_strdup_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
#ifdef HAVE__STRREV
#define SDL_strrev _strrev
#else
extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
SDL_FORCE_INLINE char *SDL_strrev_inline(char *str) { return _strrev(str); }
#define SDL_strrev SDL_strrev_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
#ifdef HAVE__STRUPR
#define SDL_strupr _strupr
#else
extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
SDL_FORCE_INLINE char *SDL_strupr_inline(char *str) { return _strupr(str); }
#define SDL_strupr SDL_strupr_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
#ifdef HAVE__STRLWR
#define SDL_strlwr _strlwr
#else
extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); }
#define SDL_strlwr SDL_strlwr_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
#ifdef HAVE_STRCHR
#define SDL_strchr strchr
#elif defined(HAVE_INDEX)
#define SDL_strchr index
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) {
#ifdef __cplusplus
return const_cast<char*>(strchr(str, c));
#else
extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
return (char*)strchr(str, c);
#endif
}
#define SDL_strchr SDL_strchr_inline
#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
#define SDL_strchr SDL_strchr_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
#ifdef HAVE_STRRCHR
#define SDL_strrchr strrchr
#elif defined(HAVE_RINDEX)
#define SDL_strrchr rindex
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
#ifdef __cplusplus
return const_cast<char*>(strrchr(str, c));
#else
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
return (char*)strrchr(str, c);
#endif
}
#define SDL_strrchr SDL_strrchr_inline
#elif defined(HAVE_RINDEX) /* !!! FIXME: is there anywhere that has this but not strrchr? */
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
#ifdef __cplusplus
return const_cast<char*>(rindex(str, c));
#else
return (char*)rindex(str, c);
#endif
}
#define SDL_strrchr SDL_strrchr_inline
#endif
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
#ifdef HAVE_STRSTR
#define SDL_strstr strstr
SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) {
#ifdef __cplusplus
return const_cast<char*>(strstr(haystack, needle));
#else
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
const char *needle);
#endif
#ifdef HAVE_ITOA
#define SDL_itoa itoa
#else
#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
return (char*)strstr(haystack, needle);
#endif
}
#define SDL_strstr SDL_strstr_inline
#endif
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
#ifdef HAVE__LTOA
#define SDL_ltoa _ltoa
#else
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
SDL_FORCE_INLINE char *SDL_ltoa_inline(long value, char *str, int radix) { return _ltoa(value, str, radix); }
#define SDL_ltoa SDL_ltoa_inline
#endif
#ifdef HAVE__UITOA
#define SDL_uitoa _uitoa
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
#ifdef HAVE_ITOA
SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return itoa(value, str, radix); }
#else
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
SDL_FORCE_INLINE char *SDL_itoa_inline(int value, char *str, int radix) { return SDL_ltoa((long)value, str, radix); }
#endif
#define SDL_itoa SDL_itoa_inline
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
#ifdef HAVE__ULTOA
#define SDL_ultoa _ultoa
#else
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
int radix);
SDL_FORCE_INLINE char *SDL_ultoa_inline(unsigned long value, char *str, int radix) { return _ultoa(value, str, radix); }
#define SDL_ultoa SDL_ultoa_inline
#endif
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
#ifdef HAVE__UITOA
SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return _uitoa(value, str, radix); }
#else
SDL_FORCE_INLINE char *SDL_uitoa_inline(unsigned int value, char *str, int radix) { return SDL_ultoa((unsigned long)value, str, radix); }
#endif
#define SDL_uitoa SDL_uitoa_inline
extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
#ifdef HAVE_STRTOL
#define SDL_strtol strtol
#else
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
int base);
SDL_FORCE_INLINE long SDL_strtol_inline(const char *str, char **endp, int base) { return strtol(str, endp, base); }
#define SDL_strtol SDL_strtol_inline
#endif
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
#ifdef HAVE_STRTOUL
#define SDL_strtoul strtoul
#else
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
char **endp, int base);
SDL_FORCE_INLINE unsigned long SDLCALL SDL_strtoul_inline(const char *str, char **endp, int base) { return strtoul(str, endp, base); }
#define SDL_strtoul SDL_strtoul_inline
#endif
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
#ifdef HAVE__I64TOA
#define SDL_lltoa _i64toa
#else
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
int radix);
SDL_FORCE_INLINE char *SDL_lltoa_inline(Sint64 value, char *str, int radix) { return _i64toa(value, str, radix); }
#define SDL_lltoa SDL_lltoa_inline
#endif
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
#ifdef HAVE__UI64TOA
#define SDL_ulltoa _ui64toa
#else
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
int radix);
SDL_FORCE_INLINE char *SDL_ulltoa_inline(Uint64 value, char *str, int radix) { return _ui64toa(value, str, radix); }
#define SDL_ulltoa SDL_ulltoa_inline
#endif
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
#ifdef HAVE_STRTOLL
#define SDL_strtoll strtoll
#else
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
int base);
SDL_FORCE_INLINE Sint64 SDL_strtoll_inline(const char *str, char **endp, int base) { return strtoll(str, endp, base); }
#define SDL_strtoll SDL_strtoll_inline
#endif
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
#ifdef HAVE_STRTOULL
#define SDL_strtoull strtoull
#else
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
int base);
SDL_FORCE_INLINE Uint64 SDL_strtoull_inline(const char *str, char **endp, int base) { return strtoull(str, endp, base); }
#define SDL_strtoull SDL_strtoull_inline
#endif
extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
#ifdef HAVE_STRTOD
#define SDL_strtod strtod
#else
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
SDL_FORCE_INLINE double SDL_strtod_inline(const char *str, char **endp) { return strtod(str, endp); }
#define SDL_strtod SDL_strtod_inline
#endif
extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
#ifdef HAVE_ATOI
#define SDL_atoi atoi
SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return atoi(str); }
#else
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
SDL_FORCE_INLINE int SDL_atoi_inline(const char *str) { return SDL_strtol(str, NULL, 0); }
#endif
#define SDL_atoi SDL_atoi_inline
extern DECLSPEC double SDLCALL SDL_atof(const char *str);
#ifdef HAVE_ATOF
#define SDL_atof atof
SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return (double) atof(str); }
#else
#define SDL_atof(X) SDL_strtod(X, NULL)
SDL_FORCE_INLINE double SDL_atof_inline(const char *str) { return SDL_strtod(str, NULL); }
#endif
#define SDL_atof SDL_atof_inline
#ifdef HAVE_STRCMP
#define SDL_strcmp strcmp
#else
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
#ifdef HAVE_STRCMP
SDL_FORCE_INLINE int SDL_strcmp_inline(const char *str1, const char *str2) { return strcmp(str1, str2); }
#define SDL_strcmp SDL_strcmp_inline
#endif
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
#ifdef HAVE_STRNCMP
#define SDL_strncmp strncmp
#else
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
size_t maxlen);
SDL_FORCE_INLINE int SDL_strncmp_inline(const char *str1, const char *str2, size_t maxlen) { return strncmp(str1, str2, maxlen); }
#define SDL_strncmp SDL_strncmp_inline
#endif
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
#ifdef HAVE_STRCASECMP
#define SDL_strcasecmp strcasecmp
SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return strcasecmp(str1, str2); }
#define SDL_strcasecmp SDL_strcasecmp_inline
#elif defined(HAVE__STRICMP)
#define SDL_strcasecmp _stricmp
#else
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
const char *str2);
SDL_FORCE_INLINE int SDL_strcasecmp_inline(const char *str1, const char *str2) { return _stricmp(str1, str2); }
#define SDL_strcasecmp SDL_strcasecmp_inline
#endif
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
#ifdef HAVE_STRNCASECMP
#define SDL_strncasecmp strncasecmp
SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return strncasecmp(str1, str2, len); }
#define SDL_strncasecmp SDL_strncasecmp_inline
#elif defined(HAVE__STRNICMP)
#define SDL_strncasecmp _strnicmp
#else
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
const char *str2, size_t maxlen);
SDL_FORCE_INLINE int SDL_strncasecmp_inline(const char *str1, const char *str2, size_t len) { return _strnicmp(str1, str2, len); }
#define SDL_strncasecmp SDL_strncasecmp_inline
#endif
/* Not doing SDL_*_inline functions for these, because of the varargs. */
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
#ifdef HAVE_SSCANF
#define SDL_sscanf sscanf
#else
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
...);
#define SDL_sscanf sscanf
#endif
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
#ifdef HAVE_SNPRINTF
#define SDL_snprintf snprintf
#else
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
const char *fmt, ...);
#define SDL_snprintf snprintf
#endif
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
#ifdef HAVE_VSNPRINTF
#define SDL_vsnprintf vsnprintf
#else
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
const char *fmt, va_list ap);
SDL_FORCE_INLINE int SDL_vsnprintf_inline(char *text, size_t maxlen, const char *fmt, va_list ap) { return vsnprintf(text, maxlen, fmt, ap); }
#define SDL_vsnprintf SDL_vsnprintf_inline
#endif
#ifndef HAVE_M_PI
@ -645,88 +696,94 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
#endif
#endif
#ifdef HAVE_ATAN
#define SDL_atan atan
#else
extern DECLSPEC double SDLCALL SDL_atan(double x);
#ifdef HAVE_ATAN
SDL_FORCE_INLINE double SDL_atan_inline(double x) { return atan(x); }
#define SDL_atan SDL_atan_inline
#endif
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
#ifdef HAVE_ATAN2
#define SDL_atan2 atan2
#else
extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
SDL_FORCE_INLINE double SDL_atan2_inline(double x, double y) { return atan2(x, y); }
#define SDL_atan2 SDL_atan2_inline
#endif
extern DECLSPEC double SDLCALL SDL_ceil(double x);
#ifdef HAVE_CEIL
#define SDL_ceil ceil
SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return ceil(x); }
#else
#define SDL_ceil(x) ((double)(int)((x)+0.5))
SDL_FORCE_INLINE double SDL_ceil_inline(double x) { return (double)(int)((x)+0.5); }
#endif
#define SDL_ceil SDL_ceil_inline
#ifdef HAVE_COPYSIGN
#define SDL_copysign copysign
#else
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
#ifdef HAVE_COPYSIGN
SDL_FORCE_INLINE double SDL_copysign_inline(double x, double y) { return copysign(x, y); }
#define SDL_copysign SDL_copysign_inline
#endif
#ifdef HAVE_COS
#define SDL_cos cos
#else
extern DECLSPEC double SDLCALL SDL_cos(double x);
#ifdef HAVE_COS
SDL_FORCE_INLINE double SDL_cos_inline(double x) { return cos(x); }
#define SDL_cos SDL_cos_inline
#endif
extern DECLSPEC float SDLCALL SDL_cosf(float x);
#ifdef HAVE_COSF
#define SDL_cosf cosf
SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return cosf(x); }
#else
#define SDL_cosf(x) (float)SDL_cos((double)x)
SDL_FORCE_INLINE float SDL_cosf_inline(float x) { return (float)SDL_cos((double)x); }
#endif
#define SDL_cosf SDL_cosf_inline
#ifdef HAVE_FABS
#define SDL_fabs fabs
#else
extern DECLSPEC double SDLCALL SDL_fabs(double x);
#ifdef HAVE_FABS
SDL_FORCE_INLINE double SDL_fabs_inline(double x) { return fabs(x); }
#define SDL_fabs SDL_fabs_inline
#endif
#ifdef HAVE_FLOOR
#define SDL_floor floor
#else
extern DECLSPEC double SDLCALL SDL_floor(double x);
#ifdef HAVE_FLOOR
SDL_FORCE_INLINE double SDL_floor_inline(double x) { return floor(x); }
#define SDL_floor SDL_floor_inline
#endif
#ifdef HAVE_LOG
#define SDL_log log
#else
extern DECLSPEC double SDLCALL SDL_log(double x);
#ifdef HAVE_LOG
SDL_FORCE_INLINE double SDL_log_inline(double x) { return log(x); }
#define SDL_log SDL_log_inline
#endif
#ifdef HAVE_POW
#define SDL_pow pow
#else
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
#ifdef HAVE_POW
SDL_FORCE_INLINE double SDL_pow_inline(double x, double y) { return pow(x, y); }
#define SDL_pow SDL_pow_inline
#endif
#ifdef HAVE_SCALBN
#define SDL_scalbn scalbn
#else
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
#ifdef HAVE_SCALBN
SDL_FORCE_INLINE double SDL_scalbn_inline(double x, int n) { return scalbn(x, n); }
#define SDL_scalbn SDL_scalbn_inline
#endif
#ifdef HAVE_SIN
#define SDL_sin sin
#else
extern DECLSPEC double SDLCALL SDL_sin(double x);
#ifdef HAVE_SIN
SDL_FORCE_INLINE double SDL_sin_inline(double x) { return sin(x); }
#define SDL_sin SDL_sin_inline
#endif
extern DECLSPEC float SDLCALL SDL_sinf(float x);
#ifdef HAVE_SINF
#define SDL_sinf sinf
SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return sinf(x); }
#else
#define SDL_sinf(x) (float)SDL_sin((double)x)
SDL_FORCE_INLINE float SDL_sinf_inline(float x) { return (float)SDL_sin((double)x); }
#endif
#define SDL_sinf SDL_sinf_inline
#ifdef HAVE_SQRT
#define SDL_sqrt sqrt
#else
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#ifdef HAVE_SQRT
SDL_FORCE_INLINE double SDL_sqrt_inline(double x) { return sqrt(x); }
#define SDL_sqrt SDL_sqrt_inline
#endif
/* The SDL implementation of iconv() returns these error codes */
@ -735,16 +792,11 @@ extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#define SDL_ICONV_EILSEQ (size_t)-3
#define SDL_ICONV_EINVAL (size_t)-4
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
#define SDL_iconv_t iconv_t
#define SDL_iconv_open iconv_open
#define SDL_iconv_close iconv_close
#else
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
typedef struct _SDL_iconv_t *SDL_iconv_t;
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
#endif
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
size_t * inbytesleft, char **outbuf,
size_t * outbytesleft);

View file

@ -34,9 +34,9 @@
#include "SDL.h"
#ifdef __NDS__
#define DEFAULT_WINDOW_WIDTH 256
#define DEFAULT_WINDOW_HEIGHT (2*192)
#if defined(__PSP__)
#define DEFAULT_WINDOW_WIDTH 480
#define DEFAULT_WINDOW_HEIGHT 272
#else
#define DEFAULT_WINDOW_WIDTH 640
#define DEFAULT_WINDOW_HEIGHT 480

View file

@ -53,11 +53,7 @@ typedef struct SDLTest_SurfaceImage_s {
int width;
int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
#if (defined(__GNUC__) && (__GNUC__ <= 2))
unsigned char pixel_data[0];
#else
unsigned char pixel_data[];
#endif
const char *pixel_data;
} SDLTest_SurfaceImage_t;
/* Test images */

View file

@ -40,77 +40,42 @@ extern "C" {
/* *INDENT-ON* */
#endif
typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID;
typedef struct SDL_Finger
{
SDL_FingerID id;
float x;
float y;
float pressure;
} SDL_Finger;
struct SDL_Finger {
SDL_FingerID id;
Uint16 x;
Uint16 y;
Uint16 pressure;
Uint16 xdelta;
Uint16 ydelta;
Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */
SDL_bool down;
};
typedef struct SDL_Touch SDL_Touch;
typedef struct SDL_Finger SDL_Finger;
struct SDL_Touch {
/* Free the touch when it's time */
void (*FreeTouch) (SDL_Touch * touch);
/* data common for tablets */
float pressure_max, pressure_min;
float x_max,x_min;
float y_max,y_min;
Uint16 xres,yres,pressureres;
float native_xres,native_yres,native_pressureres;
float tilt_x; /* for future use */
float tilt_y; /* for future use */
float rotation; /* for future use */
/* Data common to all touch */
SDL_TouchID id;
SDL_Window *focus;
char *name;
Uint8 buttonstate;
SDL_bool relative_mode;
SDL_bool flush_motion;
int num_fingers;
int max_fingers;
SDL_Finger** fingers;
void *driverdata;
};
/* Used as the device ID for mouse events simulated with touch input */
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
/* Function prototypes */
/**
* \brief Get the touch object at the given id.
*
*
* \brief Get the number of registered touch devices.
*/
extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices();
/**
* \brief Get the finger object of the given touch, at the given id.
*
*
* \brief Get the touch ID with the given index, or 0 if the index is invalid.
*/
extern
DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
/**
* \brief Get the number of active fingers for a given touch device.
*/
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
/**
* \brief Get the finger object of the given touch, with the given index.
*/
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View file

@ -504,6 +504,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window,
/**
* \brief Get the position of a window.
*
* \param x Pointer to variable for storing the x position, may be NULL
* \param y Pointer to variable for storing the y position, may be NULL
*
* \sa SDL_SetWindowPosition()
*/
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
@ -512,6 +515,9 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
/**
* \brief Set the size of a window's client area.
*
* \param w The width of the window, must be >0
* \param h The height of the window, must be >0
*
* \note You can't change the size of a fullscreen window, it automatically
* matches the size of the display mode.
*
@ -523,6 +529,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w,
/**
* \brief Get the size of a window's client area.
*
* \param w Pointer to variable for storing the width, may be NULL
* \param h Pointer to variable for storing the height, may be NULL
*
* \sa SDL_SetWindowSize()
*/
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
@ -530,6 +539,9 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
/**
* \brief Set the minimum size of a window's client area.
*
* \param min_w The minimum width of the window, must be >0
* \param min_h The minimum height of the window, must be >0
*
* \note You can't change the minimum size of a fullscreen window, it
* automatically matches the size of the display mode.
@ -542,7 +554,10 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
/**
* \brief Get the minimum size of a window's client area.
*
*
* \param w Pointer to variable for storing the minimum width, may be NULL
* \param h Pointer to variable for storing the minimum height, may be NULL
*
* \sa SDL_GetWindowMaximumSize()
* \sa SDL_SetWindowMinimumSize()
*/
@ -552,6 +567,9 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
/**
* \brief Set the maximum size of a window's client area.
*
* \param max_w The maximum width of the window, must be >0
* \param max_h The maximum height of the window, must be >0
*
* \note You can't change the maximum size of a fullscreen window, it
* automatically matches the size of the display mode.
*
@ -563,6 +581,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
/**
* \brief Get the maximum size of a window's client area.
*
* \param w Pointer to variable for storing the maximum width, may be NULL
* \param h Pointer to variable for storing the maximum height, may be NULL
*
* \sa SDL_GetWindowMinimumSize()
* \sa SDL_SetWindowMaximumSize()
@ -673,7 +694,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
* \sa SDL_UpdateWindowSurfaceRect()
*/
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
SDL_Rect * rects,
const SDL_Rect * rects,
int numrects);
/**

View file

@ -128,6 +128,16 @@
#define __inline__
#endif
#ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline
#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline
#else
#define SDL_FORCE_INLINE static __inline__
#endif
#endif
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL