Update SDL2 headers... oops

This commit is contained in:
Tim Angus 2013-08-20 18:30:56 +01:00
parent 32a859c680
commit 273b9ab77e
72 changed files with 2608 additions and 2538 deletions

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -41,22 +41,15 @@
* Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP, * Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
* Pike, Pliant, Python, Ruby, and Smalltalk. * Pike, Pliant, Python, Ruby, and Smalltalk.
* *
* This library is distributed under 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 * found in the file "COPYING". This license allows you to use SDL
* freely in commercial programs as long as you link with the dynamic * freely for any purpose as long as you retain the copyright notice.
* library.
* *
* The best way to learn how to use SDL is to check out the header files in * The best way to learn how to use SDL is to check out the header files in
* the "include" subdirectory and the programs in the "test" subdirectory. * the "include" subdirectory and the programs in the "test" subdirectory.
* The header files and test programs are well commented and always up to date. * The header files and test programs are well commented and always up to date.
* More documentation is available in HTML format in "docs/index.html", and * More documentation and FAQs are available online at:
* a documentation wiki is available online at: * http://wiki.libsdl.org/
* http://www.libsdl.org/cgi/docwiki.cgi
*
* The test programs in the "test" subdirectory are in the public domain.
*
* Frequently asked questions are answered online:
* http://www.libsdl.org/faq.php
* *
* If you need help with the library, or just want to discuss SDL related * If you need help with the library, or just want to discuss SDL related
* issues, you can join the developers mailing list: * issues, you can join the developers mailing list:
@ -79,7 +72,9 @@
#include "SDL_endian.h" #include "SDL_endian.h"
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_events.h" #include "SDL_events.h"
#include "SDL_joystick.h"
#include "SDL_gamecontroller.h" #include "SDL_gamecontroller.h"
#include "SDL_haptic.h"
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"
#include "SDL_log.h" #include "SDL_log.h"
@ -97,9 +92,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* As of version 0.5, SDL is loaded dynamically into the application */ /* As of version 0.5, SDL is loaded dynamically into the application */
@ -113,12 +106,16 @@ extern "C" {
/*@{*/ /*@{*/
#define SDL_INIT_TIMER 0x00000001 #define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010 #define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020 #define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200 #define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000 #define SDL_INIT_HAPTIC 0x00001000
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< turn on game controller also implicitly does JOYSTICK */ #define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ #define SDL_INIT_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_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
)
/*@}*/ /*@}*/
/** /**
@ -154,9 +151,7 @@ extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -27,9 +27,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
#ifndef SDL_ASSERT_LEVEL #ifndef SDL_ASSERT_LEVEL
@ -230,9 +228,7 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -45,6 +45,7 @@
* *
* There's also lots of good information here: * There's also lots of good information here:
* http://www.1024cores.net/home/lock-free-algorithms * http://www.1024cores.net/home/lock-free-algorithms
* http://preshing.com/
* *
* These operations may or may not actually be implemented using * These operations may or may not actually be implemented using
* processor specific atomic operations. When possible they are * processor specific atomic operations. When possible they are
@ -72,9 +73,7 @@
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -126,7 +125,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
* The compiler barrier prevents the compiler from reordering * The compiler barrier prevents the compiler from reordering
* reads and writes to globally visible variables across the call. * reads and writes to globally visible variables across the call.
*/ */
#ifdef _MSC_VER #if defined(_MSC_VER) && (_MSC_VER > 1200)
void _ReadWriteBarrier(void); void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier) #pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier() #define SDL_CompilerBarrier() _ReadWriteBarrier()
@ -134,9 +133,55 @@ void _ReadWriteBarrier(void);
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#else #else
#define SDL_CompilerBarrier() \ #define SDL_CompilerBarrier() \
({ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }) { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
#endif #endif
/**
* Memory barriers are designed to prevent reads and writes from being
* reordered by the compiler and being seen out of order on multi-core CPUs.
*
* A typical pattern would be for thread A to write some data and a flag,
* and for thread B to read the flag and get the data. In this case you
* would insert a release barrier between writing the data and the flag,
* guaranteeing that the data write completes no later than the flag is
* written, and you would insert an acquire barrier between reading the
* flag and reading the data, to ensure that all the reads associated
* with the flag have completed.
*
* In this pattern you should always see a release barrier paired with
* an acquire barrier and you should gate the data reads/writes with a
* single flag variable.
*
* For more information on these semantics, take a look at the blog post:
* http://preshing.com/20120913/acquire-and-release-semantics
*/
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
#elif defined(__GNUC__) && defined(__arm__)
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
#ifdef __thumb__
/* The mcr instruction isn't available in thumb mode, use real functions */
extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#endif /* __thumb__ */
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#endif /* __GNUC__ && __arm__ */
#else
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
#endif
/* Platform specific optimized versions of the atomic functions, /* Platform specific optimized versions of the atomic functions,
* you can disable these by defining SDL_DISABLE_ATOMIC_INLINE * you can disable these by defining SDL_DISABLE_ATOMIC_INLINE
*/ */
@ -196,9 +241,8 @@ typedef struct { int value; } SDL_atomic_t;
* \note If you don't know what this function is for, you shouldn't use it! * \note If you don't know what this function is for, you shouldn't use it!
*/ */
#ifndef SDL_AtomicCAS #ifndef SDL_AtomicCAS
#define SDL_AtomicCAS SDL_AtomicCAS_ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
#endif #endif
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int newval);
/** /**
* \brief Set an atomic variable to a value. * \brief Set an atomic variable to a value.
@ -206,7 +250,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS_(SDL_atomic_t *a, int oldval, int
* \return The previous value of the atomic variable. * \return The previous value of the atomic variable.
*/ */
#ifndef SDL_AtomicSet #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; int value;
do { do {
@ -220,7 +264,7 @@ static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
* \brief Get the value of an atomic variable * \brief Get the value of an atomic variable
*/ */
#ifndef SDL_AtomicGet #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; int value = a->value;
SDL_CompilerBarrier(); SDL_CompilerBarrier();
@ -236,7 +280,7 @@ static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
* \note This same style can be used for any number operation * \note This same style can be used for any number operation
*/ */
#ifndef SDL_AtomicAdd #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; int value;
do { do {
@ -271,9 +315,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! * \note If you don't know what this function is for, you shouldn't use it!
*/ */
#ifndef SDL_AtomicCASPtr #ifndef SDL_AtomicCASPtr
#define SDL_AtomicCASPtr SDL_AtomicCASPtr_ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *newval);
#endif #endif
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void *newval);
/** /**
* \brief Set a pointer to a value atomically. * \brief Set a pointer to a value atomically.
@ -281,7 +324,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr_(void* *a, void *oldval, void
* \return The previous value of the pointer. * \return The previous value of the pointer.
*/ */
#ifndef SDL_AtomicSetPtr #ifndef SDL_AtomicSetPtr
static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v) SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
{ {
void* value; void* value;
do { do {
@ -295,7 +338,7 @@ static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
* \brief Get the value of a pointer atomically. * \brief Get the value of a pointer atomically.
*/ */
#ifndef SDL_AtomicGetPtr #ifndef SDL_AtomicGetPtr
static __inline__ void* SDL_AtomicGetPtr(void* *a) SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
{ {
void* value = *a; void* value = *a;
SDL_CompilerBarrier(); SDL_CompilerBarrier();
@ -306,9 +349,7 @@ static __inline__ void* SDL_AtomicGetPtr(void* *a)
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -38,9 +38,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -100,8 +98,6 @@ typedef Uint16 SDL_AudioFormat;
/** /**
* \name int32 support * \name int32 support
*
* New to SDL 1.3.
*/ */
/*@{*/ /*@{*/
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
@ -111,8 +107,6 @@ typedef Uint16 SDL_AudioFormat;
/** /**
* \name float32 support * \name float32 support
*
* New to SDL 1.3.
*/ */
/*@{*/ /*@{*/
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
@ -189,6 +183,17 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
/** /**
* A structure to hold a set of audio conversion filters and buffers. * A structure to hold a set of audio conversion filters and buffers.
*/ */
#ifdef __GNUC__
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
pad it out to 88 bytes to guarantee ABI compatibility between compilers.
vvv
The next time we rev the ABI, make sure to size the ints and add padding.
*/
#define SDL_AUDIOCVT_PACKED __attribute__((packed))
#else
#define SDL_AUDIOCVT_PACKED
#endif
/* */
typedef struct SDL_AudioCVT typedef struct SDL_AudioCVT
{ {
int needed; /**< Set to 1 if conversion possible */ int needed; /**< Set to 1 if conversion possible */
@ -202,7 +207,7 @@ typedef struct SDL_AudioCVT
double len_ratio; /**< Given len, final size is len*len_ratio */ double len_ratio; /**< Given len, final size is len*len_ratio */
SDL_AudioFilter filters[10]; /**< Filter list */ SDL_AudioFilter filters[10]; /**< Filter list */
int filter_index; /**< Current audio conversion function */ int filter_index; /**< Current audio conversion function */
} SDL_AudioCVT; } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* Function prototypes */ /* Function prototypes */
@ -490,17 +495,9 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
extern DECLSPEC void SDLCALL SDL_CloseAudio(void); extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
/**
* \return 1 if audio device is still functioning, zero if not, -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_AudioDeviceConnected(SDL_AudioDeviceID dev);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -0,0 +1,97 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_bits.h
*
* Functions for fiddling with bits and bitmasks.
*/
#ifndef _SDL_bits_h
#define _SDL_bits_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_bits.h
*/
/**
* Get the index of the most significant bit. Result is undefined when called
* with 0. This operation can also be stated as "count leading zeroes" and
* "log base 2".
*
* \return Index of the most significant bit, or -1 if the value is 0.
*/
SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x)
{
#if defined(__GNUC__) && __GNUC__ >= 4
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/
if (x == 0) {
return -1;
}
return 31 - __builtin_clz(x);
#else
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
* <seander@cs.stanford.edu>, released in the public domain.
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
*/
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
const int S[] = {1, 2, 4, 8, 16};
int msbIndex = 0;
int i;
if (x == 0) {
return -1;
}
for (i = 4; i >= 0; i--)
{
if (x & b[i])
{
x >>= S[i];
msbIndex |= S[i];
}
}
return msbIndex;
#endif
}
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_bits_h */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -31,9 +31,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -41,17 +39,22 @@ extern "C" {
*/ */
typedef enum typedef enum
{ {
SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */ SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
SDL_BLENDMODE_BLEND = 0x00000001, /**< dst = (src * A) + (dst * (1-A)) */ dstRGBA = srcRGBA */
SDL_BLENDMODE_ADD = 0x00000002, /**< dst = (src * A) + dst */ SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
SDL_BLENDMODE_MOD = 0x00000004 /**< dst = src * dst */ dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
dstA = srcA + (dstA * (1-srcA)) */
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA */
SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
} SDL_BlendMode; } SDL_BlendMode;
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -33,9 +33,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* Function prototypes */ /* Function prototypes */
@ -64,9 +62,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -37,8 +37,8 @@
#include "SDL_config_iphoneos.h" #include "SDL_config_iphoneos.h"
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
#include "SDL_config_android.h" #include "SDL_config_android.h"
#elif defined(__NINTENDODS__) #elif defined(__PSP__)
#include "SDL_config_nintendods.h" #include "SDL_config_psp.h"
#else #else
/* This is a minimal configuration just to get SDL running on new platforms */ /* This is a minimal configuration just to get SDL running on new platforms */
#include "SDL_config_minimal.h" #include "SDL_config_minimal.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -32,6 +32,8 @@
#include <stdarg.h> #include <stdarg.h>
#define HAVE_GCC_ATOMICS 1
#define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 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-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -36,10 +36,7 @@
#endif #endif
/* Useful headers */ /* Useful headers */
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
#define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA_H 1
#endif
#define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
#define STDC_HEADERS 1 #define STDC_HEADERS 1
@ -130,7 +127,7 @@
/* Enable various video drivers */ /* Enable various video drivers */
#define SDL_VIDEO_DRIVER_COCOA 1 #define SDL_VIDEO_DRIVER_COCOA 1
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_X11 0 #undef SDL_VIDEO_DRIVER_X11
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -30,10 +30,12 @@
* This is the minimal configuration that can be used to build SDL. * This is the minimal configuration that can be used to build SDL.
*/ */
#include <stddef.h> #define HAVE_STDARG_H 1
#include <stdarg.h> #define HAVE_STDDEF_H 1
#if !defined(_STDINT_H_) && !defined(_STDINT_H) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) /* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
/* Here are some reasonable defaults */
typedef unsigned int size_t; typedef unsigned int size_t;
typedef signed char int8_t; typedef signed char int8_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
@ -44,7 +46,9 @@ typedef unsigned int uint32_t;
typedef signed long long int64_t; typedef signed long long int64_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
typedef unsigned long uintptr_t; typedef unsigned long uintptr_t;
#endif /* if (stdint.h isn't available) */ #else
#define HAVE_STDINT_H 1
#endif /* Visual Studio 2008 */
#ifdef __GNUC__ #ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 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-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

@ -0,0 +1,136 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_config_psp_h
#define _SDL_config_psp_h
#include "SDL_platform.h"
#ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif
#define HAVE_GCC_ATOMICS 1
#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
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#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
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#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_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_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
/* PSP isn't that sophisticated */
#define LACKS_SYS_MMAN_H 1
/* Enable the stub thread support (src/thread/psp/\*.c) */
#define SDL_THREAD_PSP 1
/* Enable the stub timer support (src/timer/psp/\*.c) */
#define SDL_TIMERS_PSP 1
/* Enable the stub joystick driver (src/joystick/psp/\*.c) */
#define SDL_JOYSTICK_PSP 1
/* Enable the stub audio driver (src/audio/psp/\*.c) */
#define SDL_AUDIO_DRIVER_PSP 1
/* PSP video dirver */
#define SDL_VIDEO_DRIVER_PSP 1
/* PSP render dirver */
#define SDL_VIDEO_RENDER_PSP 1
#define SDL_POWER_PSP 1
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
#endif /* _SDL_config_psp_h */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -76,8 +76,7 @@ typedef unsigned int uintptr_t;
# define SIZEOF_VOIDP 4 # define SIZEOF_VOIDP 4
#endif #endif
/* Enabled for SDL 1.2 (binary compatibility) */ /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
//#define HAVE_LIBC 1
#ifdef HAVE_LIBC #ifdef HAVE_LIBC
/* Useful headers */ /* Useful headers */
#define HAVE_STDIO_H 1 #define HAVE_STDIO_H 1
@ -142,9 +141,7 @@ typedef unsigned int uintptr_t;
/* Enable various audio drivers */ /* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DSOUND 1 #define SDL_AUDIO_DRIVER_DSOUND 1
#ifndef __GNUC__
#define SDL_AUDIO_DRIVER_XAUDIO2 1 #define SDL_AUDIO_DRIVER_XAUDIO2 1
#endif
#define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1 #define SDL_AUDIO_DRIVER_DUMMY 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-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View file

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

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -66,9 +66,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* This is a guess for the cacheline size used for padding. /* This is a guess for the cacheline size used for padding.
@ -139,9 +137,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -59,36 +59,29 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
* \file SDL_endian.h * \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__) && \ #if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
static __inline__ Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
return x; return x;
} }
#elif defined(__GNUC__) && defined(__x86_64__) #elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
return x; return x;
} }
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
int result; int result;
@ -97,14 +90,14 @@ SDL_Swap16(Uint16 x)
return (Uint16)result; return (Uint16)result;
} }
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
static __inline__ Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x; return x;
} }
#else #else
static __inline__ Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
@ -112,21 +105,21 @@ SDL_Swap16(Uint16 x)
#endif #endif
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
__asm__("bswap %0": "=r"(x):"0"(x)); __asm__("bswap %0": "=r"(x):"0"(x));
return x; return x;
} }
#elif defined(__GNUC__) && defined(__x86_64__) #elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
__asm__("bswapl %0": "=r"(x):"0"(x)); __asm__("bswapl %0": "=r"(x):"0"(x));
return x; return x;
} }
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
Uint32 result; Uint32 result;
@ -137,14 +130,14 @@ SDL_Swap32(Uint32 x)
return result; return result;
} }
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
static __inline__ Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x; return x;
} }
#else #else
static __inline__ Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
@ -153,7 +146,7 @@ SDL_Swap32(Uint32 x)
#endif #endif
#if defined(__GNUC__) && defined(__i386__) #if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
{ {
union union
@ -171,14 +164,14 @@ SDL_Swap64(Uint64 x)
return v.u; return v.u;
} }
#elif defined(__GNUC__) && defined(__x86_64__) #elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
{ {
__asm__("bswapq %0": "=r"(x):"0"(x)); __asm__("bswapq %0": "=r"(x):"0"(x));
return x; return x;
} }
#else #else
static __inline__ Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
{ {
Uint32 hi, lo; Uint32 hi, lo;
@ -195,7 +188,7 @@ SDL_Swap64(Uint64 x)
#endif #endif
static __inline__ float SDL_FORCE_INLINE float
SDL_SwapFloat(float x) SDL_SwapFloat(float x)
{ {
union union
@ -237,9 +230,7 @@ SDL_SwapFloat(float x)
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -33,13 +33,12 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* Public functions */ /* 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 const char *SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void); extern DECLSPEC void SDLCALL SDL_ClearError(void);
@ -62,14 +61,13 @@ typedef enum
SDL_UNSUPPORTED, SDL_UNSUPPORTED,
SDL_LASTERROR SDL_LASTERROR
} SDL_errorcode; } 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*/ /*@}*//*Internal error functions*/
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -42,9 +42,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* General keyboard/mouse state definitions */ /* General keyboard/mouse state definitions */
@ -61,6 +59,32 @@ 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 */
SDL_APP_TERMINATING, /**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate()
Called on Android in onDestroy()
*/
SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible.
Called on iOS in applicationDidReceiveMemoryWarning()
Called on Android in onLowMemory()
*/
SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
Called on iOS in applicationWillResignActive()
Called on Android in onPause()
*/
SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
Called on iOS in applicationDidEnterBackground()
Called on Android in onPause()
*/
SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground
Called on iOS in applicationWillEnterForeground()
Called on Android in onResume()
*/
SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive
Called on iOS in applicationDidBecomeActive()
Called on Android in onResume()
*/
/* Window events */ /* Window events */
SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_WINDOWEVENT = 0x200, /**< Window state change */
SDL_SYSWMEVENT, /**< System specific event */ SDL_SYSWMEVENT, /**< System specific event */
@ -77,14 +101,6 @@ typedef enum
SDL_MOUSEBUTTONUP, /**< Mouse button released */ SDL_MOUSEBUTTONUP, /**< Mouse button released */
SDL_MOUSEWHEEL, /**< Mouse wheel motion */ 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 */ /* Joystick events */
SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */
SDL_JOYBALLMOTION, /**< Joystick trackball motion */ SDL_JOYBALLMOTION, /**< Joystick trackball motion */
@ -100,13 +116,12 @@ typedef enum
SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ SDL_CONTROLLERBUTTONUP, /**< Game controller button released */
SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */
SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */
SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */
/* Touch events */ /* Touch events */
SDL_FINGERDOWN = 0x700, SDL_FINGERDOWN = 0x700,
SDL_FINGERUP, SDL_FINGERUP,
SDL_FINGERMOTION, SDL_FINGERMOTION,
SDL_TOUCHBUTTONDOWN,
SDL_TOUCHBUTTONUP,
/* Gesture events */ /* Gesture events */
SDL_DOLLARGESTURE = 0x800, SDL_DOLLARGESTURE = 0x800,
@ -130,6 +145,15 @@ typedef enum
SDL_LASTEVENT = 0xFFFF SDL_LASTEVENT = 0xFFFF
} SDL_EventType; } SDL_EventType;
/**
* \brief Fields shared by every event
*/
typedef struct SDL_CommonEvent
{
Uint32 type;
Uint32 timestamp;
} SDL_CommonEvent;
/** /**
* \brief Window state change event data (event.window.*) * \brief Window state change event data (event.window.*)
*/ */
@ -142,8 +166,8 @@ typedef struct SDL_WindowEvent
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
int data1; /**< event dependent data */ Sint32 data1; /**< event dependent data */
int data2; /**< event dependent data */ Sint32 data2; /**< event dependent data */
} SDL_WindowEvent; } SDL_WindowEvent;
/** /**
@ -171,8 +195,8 @@ typedef struct SDL_TextEditingEvent
Uint32 timestamp; Uint32 timestamp;
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
int start; /**< The start cursor of selected editing text */ Sint32 start; /**< The start cursor of selected editing text */
int length; /**< The length of selected editing text */ Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingEvent; } SDL_TextEditingEvent;
@ -196,14 +220,12 @@ typedef struct SDL_MouseMotionEvent
Uint32 type; /**< ::SDL_MOUSEMOTION */ Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 timestamp; Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint8 state; /**< The current button state */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 padding1; Uint32 state; /**< The current button state */
Uint8 padding2; Sint32 x; /**< X coordinate, relative to window */
Uint8 padding3; Sint32 y; /**< Y coordinate, relative to window */
int x; /**< X coordinate, relative to window */ Sint32 xrel; /**< The relative motion in the X direction */
int y; /**< Y coordinate, relative to window */ Sint32 yrel; /**< The relative motion in the Y direction */
int xrel; /**< The relative motion in the X direction */
int yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent; } SDL_MouseMotionEvent;
/** /**
@ -214,12 +236,13 @@ typedef struct SDL_MouseButtonEvent
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 timestamp; Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */ 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 button; /**< The mouse button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
int x; /**< X coordinate, relative to window */ Sint32 x; /**< X coordinate, relative to window */
int y; /**< Y coordinate, relative to window */ Sint32 y; /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent; } SDL_MouseButtonEvent;
/** /**
@ -230,8 +253,9 @@ typedef struct SDL_MouseWheelEvent
Uint32 type; /**< ::SDL_MOUSEWHEEL */ Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 timestamp; Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
int x; /**< The amount scrolled horizontally */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
int y; /**< The amount scrolled vertically */ Sint32 x; /**< The amount scrolled horizontally */
Sint32 y; /**< The amount scrolled vertically */
} SDL_MouseWheelEvent; } SDL_MouseWheelEvent;
/** /**
@ -241,11 +265,13 @@ typedef struct SDL_JoyAxisEvent
{ {
Uint32 type; /**< ::SDL_JOYAXISMOTION */ Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 timestamp; Uint32 timestamp;
Uint8 which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */ Uint8 axis; /**< The joystick axis index */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; 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; } SDL_JoyAxisEvent;
/** /**
@ -255,12 +281,13 @@ typedef struct SDL_JoyBallEvent
{ {
Uint32 type; /**< ::SDL_JOYBALLMOTION */ Uint32 type; /**< ::SDL_JOYBALLMOTION */
Uint32 timestamp; Uint32 timestamp;
Uint8 which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */ Uint8 ball; /**< The joystick trackball index */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
int xrel; /**< The relative motion in the X direction */ Uint8 padding3;
int yrel; /**< The relative motion in the Y direction */ Sint16 xrel; /**< The relative motion in the X direction */
Sint16 yrel; /**< The relative motion in the Y direction */
} SDL_JoyBallEvent; } SDL_JoyBallEvent;
/** /**
@ -270,7 +297,7 @@ typedef struct SDL_JoyHatEvent
{ {
Uint32 type; /**< ::SDL_JOYHATMOTION */ Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 timestamp; Uint32 timestamp;
Uint8 which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */ Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value. Uint8 value; /**< The hat position value.
* \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
@ -280,6 +307,7 @@ typedef struct SDL_JoyHatEvent
* Note that zero means the POV is centered. * Note that zero means the POV is centered.
*/ */
Uint8 padding1; Uint8 padding1;
Uint8 padding2;
} SDL_JoyHatEvent; } SDL_JoyHatEvent;
/** /**
@ -289,10 +317,11 @@ typedef struct SDL_JoyButtonEvent
{ {
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 timestamp; Uint32 timestamp;
Uint8 which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */ Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1; Uint8 padding1;
Uint8 padding2;
} SDL_JoyButtonEvent; } SDL_JoyButtonEvent;
/** /**
@ -302,7 +331,7 @@ typedef struct SDL_JoyDeviceEvent
{ {
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp; 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; } SDL_JoyDeviceEvent;
@ -313,9 +342,13 @@ typedef struct SDL_ControllerAxisEvent
{ {
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
Uint32 timestamp; Uint32 timestamp;
Uint8 which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
SDL_CONTROLLER_AXIS axis; /**< The joystick axis index */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
int value; /**< The axis value (range: -32768 to 32767) */ Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint16 value; /**< The axis value (range: -32768 to 32767) */
Uint16 padding4;
} SDL_ControllerAxisEvent; } SDL_ControllerAxisEvent;
@ -326,9 +359,11 @@ typedef struct SDL_ControllerButtonEvent
{ {
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
Uint32 timestamp; Uint32 timestamp;
Uint8 which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
SDL_CONTROLLER_BUTTON button; /**< The joystick button index */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
} SDL_ControllerButtonEvent; } SDL_ControllerButtonEvent;
@ -337,51 +372,29 @@ typedef struct SDL_ControllerButtonEvent
*/ */
typedef struct SDL_ControllerDeviceEvent typedef struct SDL_ControllerDeviceEvent
{ {
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED or ::SDL_CONTROLLERDEVICEREMOVED */ Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
Uint32 timestamp; 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; } SDL_ControllerDeviceEvent;
/** /**
* \brief Touch finger motion/finger event structure (event.tfinger.*) * \brief Touch finger event structure (event.tfinger.*)
*/ */
typedef struct SDL_TouchFingerEvent typedef struct SDL_TouchFingerEvent
{ {
Uint32 type; /**< ::SDL_FINGERMOTION OR Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
SDL_FINGERDOWN OR SDL_FINGERUP*/
Uint32 timestamp; 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; SDL_FingerID fingerId;
Uint8 state; /**< The current button state */ float x; /**< Normalized in the range 0...1 */
Uint8 padding1; float y; /**< Normalized in the range 0...1 */
Uint8 padding2; float dx; /**< Normalized in the range 0...1 */
Uint8 padding3; float dy; /**< Normalized in the range 0...1 */
Uint16 x; float pressure; /**< Normalized in the range 0...1 */
Uint16 y;
Sint16 dx;
Sint16 dy;
Uint16 pressure;
} SDL_TouchFingerEvent; } 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.*) * \brief Multiple Finger Gesture Event (event.mgesture.*)
*/ */
@ -389,31 +402,29 @@ typedef struct SDL_MultiGestureEvent
{ {
Uint32 type; /**< ::SDL_MULTIGESTURE */ Uint32 type; /**< ::SDL_MULTIGESTURE */
Uint32 timestamp; 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 dTheta;
float dDist; float dDist;
float x; /* currently 0...1. Change to screen coords? */ float x;
float y; float y;
Uint16 numFingers; Uint16 numFingers;
Uint16 padding; Uint16 padding;
} SDL_MultiGestureEvent; } SDL_MultiGestureEvent;
/* (event.dgesture.*) */
/**
* \brief Dollar Gesture Event (event.dgesture.*)
*/
typedef struct SDL_DollarGestureEvent typedef struct SDL_DollarGestureEvent
{ {
Uint32 type; /**< ::SDL_DOLLARGESTURE */ Uint32 type; /**< ::SDL_DOLLARGESTURE */
Uint32 timestamp; Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */ SDL_TouchID touchId; /**< The touch device id */
SDL_TouchID touchId; /**< The touch device index */
SDL_GestureID gestureId; SDL_GestureID gestureId;
Uint32 numFingers; Uint32 numFingers;
float error; float error;
/* float x; /**< Normalized center of gesture */
//TODO: Enable to give location? float y; /**< Normalized center of gesture */
float x; //currently 0...1. Change to screen coords?
float y;
*/
} SDL_DollarGestureEvent; } SDL_DollarGestureEvent;
@ -439,16 +450,24 @@ typedef struct SDL_QuitEvent
Uint32 timestamp; Uint32 timestamp;
} SDL_QuitEvent; } SDL_QuitEvent;
/**
* \brief OS Specific event
*/
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 timestamp;
} SDL_OSEvent;
/** /**
* \brief A user-defined event type (event.user.*) * \brief A user-defined event type (event.user.*)
*/ */
typedef struct SDL_UserEvent typedef struct SDL_UserEvent
{ {
Uint32 type; /**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
Uint32 timestamp; Uint32 timestamp;
Uint32 windowID; /**< The associated window if any */ 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 *data1; /**< User defined data pointer */
void *data2; /**< User defined data pointer */ void *data2; /**< User defined data pointer */
} SDL_UserEvent; } SDL_UserEvent;
@ -476,6 +495,7 @@ typedef struct SDL_SysWMEvent
typedef union SDL_Event typedef union SDL_Event
{ {
Uint32 type; /**< Event type, shared with all events */ Uint32 type; /**< Event type, shared with all events */
SDL_CommonEvent common; /**< Common event data */
SDL_WindowEvent window; /**< Window event data */ SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */ SDL_TextEditingEvent edit; /**< Text editing event data */
@ -488,16 +508,15 @@ typedef union SDL_Event
SDL_JoyHatEvent jhat; /**< Joystick hat event data */ SDL_JoyHatEvent jhat; /**< Joystick hat event data */
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
SDL_JoyDeviceEvent jdevice; /**< Joystick device change 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_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller 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 */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_TouchButtonEvent tbutton; /**< Touch button event data */ SDL_MultiGestureEvent mgesture; /**< Gesture event data */
SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */ SDL_DollarGestureEvent dgesture; /**< Gesture event data */
SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */
SDL_DropEvent drop; /**< Drag and drop event data */ SDL_DropEvent drop; /**< Drag and drop event data */
/* This is necessary for ABI compatibility between Visual C++ and GCC /* This is necessary for ABI compatibility between Visual C++ and GCC
@ -593,6 +612,7 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
* *
* \param event If not NULL, the next event is removed from the queue and * \param event If not NULL, the next event is removed from the queue and
* stored in that area. * stored in that area.
* \param timeout The timeout (in milliseconds) to wait for next event.
*/ */
extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
int timeout); int timeout);
@ -611,7 +631,7 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
* Sets up a filter to process all events before they change internal state and * Sets up a filter to process all events before they change internal state and
* are posted to the internal event queue. * are posted to the internal event queue.
* *
* The filter is protypted as: * The filter is prototyped as:
* \code * \code
* int SDL_EventFilter(void *userdata, SDL_Event * event); * int SDL_EventFilter(void *userdata, SDL_Event * event);
* \endcode * \endcode
@ -624,7 +644,7 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
* \warning Be very careful of what you do in the event filter function, as * \warning Be very careful of what you do in the event filter function, as
* it may run in a different thread! * it may run in a different thread!
* *
* There is one caveat when dealing with the ::SDL_QUITEVENT event type. The * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
* event filter is only called when the window manager desires to close the * event filter is only called when the window manager desires to close the
* application window. If the event filter returns 1, then the window will * application window. If the event filter returns 1, then the window will
* be closed, otherwise the window will remain open if possible. * be closed, otherwise the window will remain open if possible.
@ -691,9 +711,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -35,9 +35,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -46,6 +44,10 @@ extern "C" {
* 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_JOYSTICK 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
* is in the background, you should set the following hint before calling
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/ */
/* The gamecontroller structure used to identify an SDL game controller */ /* The gamecontroller structure used to identify an SDL game controller */
@ -59,25 +61,23 @@ typedef enum
SDL_CONTROLLER_BINDTYPE_BUTTON, SDL_CONTROLLER_BINDTYPE_BUTTON,
SDL_CONTROLLER_BINDTYPE_AXIS, SDL_CONTROLLER_BINDTYPE_AXIS,
SDL_CONTROLLER_BINDTYPE_HAT SDL_CONTROLLER_BINDTYPE_HAT
} SDL_CONTROLLER_BINDTYPE; } SDL_GameControllerBindType;
/**
* get the sdl joystick layer binding for this controller button/axis mapping
*/
struct _SDL_GameControllerHatBind
{
int hat;
int hat_mask;
};
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 union
{ {
int button; int button;
int axis; int axis;
struct _SDL_GameControllerHatBind hat; struct {
}; int hat;
int hat_mask;
} hat;
} value;
} SDL_GameControllerButtonBind; } SDL_GameControllerButtonBind;
@ -92,7 +92,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 * 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. * 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.
@ -104,16 +104,35 @@ typedef struct _SDL_GameControllerButtonBind
* Buttons can be used as a controller axis and vice versa. * Buttons can be used as a controller axis and vice versa.
* *
* This string shows an example of a valid mapping for a controller * This string shows an example of a valid mapping for a controller
* "341a3608000000000000504944564944,Aferglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
* *
*/ */
/**
* 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? * Is the joystick on this index supported by the game controller interface?
* returns 1 if supported, 0 otherwise.
*/ */
extern DECLSPEC int SDLCALL SDL_IsGameController(int joystick_index); extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
/** /**
@ -136,17 +155,18 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
/** /**
* Return the name for this currently opened controller * Return the name for this currently opened controller
*/ */
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController * gamecontroller); extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
/** /**
* Returns 1 if the controller has been opened and currently connected, or 0 if it has not. * Returns SDL_TRUE if the controller has been opened and currently connected,
* or SDL_FALSE if it has not.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerGetAttached(SDL_GameController * gamecontroller); extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller);
/** /**
* Get the underlying joystick object used by a controller * Get the underlying joystick object used by a controller
*/ */
extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller); extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller);
/** /**
* Enable/disable controller event polling. * Enable/disable controller event polling.
@ -160,7 +180,16 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont
extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
/** /**
* The list of axii available from a controller * 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 axes available from a controller
*/ */
typedef enum typedef enum
{ {
@ -172,17 +201,24 @@ typedef enum
SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_CONTROLLER_AXIS_TRIGGERLEFT,
SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
SDL_CONTROLLER_AXIS_MAX SDL_CONTROLLER_AXIS_MAX
} SDL_CONTROLLER_AXIS; } SDL_GameControllerAxis;
/** /**
* turn this string into a axis mapping * 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 SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS button); 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_GameControllerAxis axis);
/** /**
* Get the current state of an axis control on a game controller. * Get the current state of an axis control on a game controller.
@ -191,8 +227,9 @@ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindFo
* *
* The axis indices start at index 0. * The axis indices start at index 0.
*/ */
extern DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, extern DECLSPEC Sint16 SDLCALL
SDL_CONTROLLER_AXIS axis); SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
SDL_GameControllerAxis axis);
/** /**
* The list of buttons available from a controller * The list of buttons available from a controller
@ -216,18 +253,24 @@ typedef enum
SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
SDL_CONTROLLER_BUTTON_MAX SDL_CONTROLLER_BUTTON_MAX
} SDL_CONTROLLER_BUTTON; } SDL_GameControllerButton;
/** /**
* turn this string into a button mapping * 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 SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button); 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_GameControllerButton button);
/** /**
@ -235,20 +278,18 @@ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindFo
* *
* The button indices start at index 0. * The button indices start at index 0.
*/ */
extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController * gamecontroller, extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
SDL_CONTROLLER_BUTTON button); SDL_GameControllerButton button);
/** /**
* Close a controller previously opened with SDL_GameControllerOpen(). * Close a controller previously opened with SDL_GameControllerOpen().
*/ */
extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController * gamecontrollerk); extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -38,9 +38,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
typedef Sint64 SDL_GestureID; typedef Sint64 SDL_GestureID;
@ -80,9 +78,7 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -119,9 +119,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif /* __cplusplus */ #endif /* __cplusplus */
/** /**
@ -168,13 +166,18 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_SINE (1<<1) #define SDL_HAPTIC_SINE (1<<1)
/** /**
* \brief Square wave effect supported. * \brief Left/Right effect supported.
* *
* Periodic haptic effect that simulates square waves. * Haptic effect for direct control over high/low frequency motors.
* *
* \sa SDL_HapticPeriodic * \sa SDL_HapticLeftRight
* \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
* we ran out of bits, and this is important for XInput devices.
*/ */
#define SDL_HAPTIC_SQUARE (1<<2) #define SDL_HAPTIC_LEFTRIGHT (1<<2)
/* !!! FIXME: put this back when we have more bits in 2.1 */
/*#define SDL_HAPTIC_SQUARE (1<<2)*/
/** /**
* \brief Triangle wave effect supported. * \brief Triangle wave effect supported.
@ -480,7 +483,7 @@ typedef struct SDL_HapticConstant
* *
* The struct handles the following effects: * The struct handles the following effects:
* - ::SDL_HAPTIC_SINE * - ::SDL_HAPTIC_SINE
* - ::SDL_HAPTIC_SQUARE * - ::SDL_HAPTIC_LEFTRIGHT
* - ::SDL_HAPTIC_TRIANGLE * - ::SDL_HAPTIC_TRIANGLE
* - ::SDL_HAPTIC_SAWTOOTHUP * - ::SDL_HAPTIC_SAWTOOTHUP
* - ::SDL_HAPTIC_SAWTOOTHDOWN * - ::SDL_HAPTIC_SAWTOOTHDOWN
@ -489,13 +492,13 @@ 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 cyle meaning that giving the phase a value * Phase is given by hundredth of a cycle meaning that giving the phase a value
* of 9000 will displace it 25% of it's 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 it's period. * - 9000: Displaced 25% of its period.
* - 18000: Displaced 50% of it's period. * - 18000: Displaced 50% of its period.
* - 27000: Displaced 75% of it's period. * - 27000: Displaced 75% of its period.
* - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered. * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
* *
* Examples: * Examples:
* \verbatim * \verbatim
@ -526,7 +529,7 @@ typedef struct SDL_HapticConstant
\endverbatim \endverbatim
* *
* \sa SDL_HAPTIC_SINE * \sa SDL_HAPTIC_SINE
* \sa SDL_HAPTIC_SQUARE * \sa SDL_HAPTIC_LEFTRIGHT
* \sa SDL_HAPTIC_TRIANGLE * \sa SDL_HAPTIC_TRIANGLE
* \sa SDL_HAPTIC_SAWTOOTHUP * \sa SDL_HAPTIC_SAWTOOTHUP
* \sa SDL_HAPTIC_SAWTOOTHDOWN * \sa SDL_HAPTIC_SAWTOOTHDOWN
@ -535,7 +538,7 @@ typedef struct SDL_HapticConstant
typedef struct SDL_HapticPeriodic typedef struct SDL_HapticPeriodic
{ {
/* Header */ /* Header */
Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_SQUARE, Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
::SDL_HAPTIC_SAWTOOTHDOWN */ ::SDL_HAPTIC_SAWTOOTHDOWN */
SDL_HapticDirection direction; /**< Direction of the effect. */ SDL_HapticDirection direction; /**< Direction of the effect. */
@ -616,7 +619,7 @@ typedef struct SDL_HapticCondition
* *
* The ramp effect starts at start strength and ends at end strength. * The ramp effect starts at start strength and ends at end strength.
* It augments in linear fashion. If you use attack and fade with a ramp * It augments in linear fashion. If you use attack and fade with a ramp
* they effects get added to the ramp effect making the effect become * the effects get added to the ramp effect making the effect become
* quadratic instead of linear. * quadratic instead of linear.
* *
* \sa SDL_HAPTIC_RAMP * \sa SDL_HAPTIC_RAMP
@ -647,11 +650,36 @@ typedef struct SDL_HapticRamp
Uint16 fade_level; /**< Level at the end of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */
} SDL_HapticRamp; } SDL_HapticRamp;
/**
* \brief A structure containing a template for a Left/Right effect.
*
* This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
*
* The Left/Right effect is used to explicitly control the large and small
* motors, commonly found in modern game controllers. One motor is high
* frequency, the other is low frequency.
*
* \sa SDL_HAPTIC_LEFTRIGHT
* \sa SDL_HapticEffect
*/
typedef struct SDL_HapticLeftRight
{
/* Header */
Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
/* Replay */
Uint32 length; /**< Duration of the effect. */
/* Rumble */
Uint16 large_magnitude; /**< Control of the large controller motor. */
Uint16 small_magnitude; /**< Control of the small controller motor. */
} SDL_HapticLeftRight;
/** /**
* \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
* *
* A custom force feedback effect is much like a periodic effect, where the * A custom force feedback effect is much like a periodic effect, where the
* application can define it's exact shape. You will have to allocate the * application can define its exact shape. You will have to allocate the
* data yourself. Data should consist of channels * samples Uint16 samples. * data yourself. Data should consist of channels * samples Uint16 samples.
* *
* If channels is one, the effect is rotated using the defined direction. * If channels is one, the effect is rotated using the defined direction.
@ -702,7 +730,7 @@ typedef struct SDL_HapticCustom
* *
* Button triggers may not be supported on all devices, it is advised to not * Button triggers may not be supported on all devices, it is advised to not
* use them if possible. Buttons start at index 1 instead of index 0 like * use them if possible. Buttons start at index 1 instead of index 0 like
* they joystick. * the joystick.
* *
* If both attack_length and fade_level are 0, the envelope is not used, * If both attack_length and fade_level are 0, the envelope is not used,
* otherwise both values are used. * otherwise both values are used.
@ -753,6 +781,7 @@ typedef struct SDL_HapticCustom
* \sa SDL_HapticPeriodic * \sa SDL_HapticPeriodic
* \sa SDL_HapticCondition * \sa SDL_HapticCondition
* \sa SDL_HapticRamp * \sa SDL_HapticRamp
* \sa SDL_HapticLeftRight
* \sa SDL_HapticCustom * \sa SDL_HapticCustom
*/ */
typedef union SDL_HapticEffect typedef union SDL_HapticEffect
@ -763,13 +792,14 @@ typedef union SDL_HapticEffect
SDL_HapticPeriodic periodic; /**< Periodic effect. */ SDL_HapticPeriodic periodic; /**< Periodic effect. */
SDL_HapticCondition condition; /**< Condition effect. */ SDL_HapticCondition condition; /**< Condition effect. */
SDL_HapticRamp ramp; /**< Ramp effect. */ SDL_HapticRamp ramp; /**< Ramp effect. */
SDL_HapticLeftRight leftright; /**< Left/Right effect. */
SDL_HapticCustom custom; /**< Custom effect. */ SDL_HapticCustom custom; /**< Custom effect. */
} SDL_HapticEffect; } SDL_HapticEffect;
/* Function prototypes */ /* Function prototypes */
/** /**
* \brief Count the number of joysticks attached to the system. * \brief Count the number of haptic devices attached to the system.
* *
* \return Number of haptic devices detected on the system. * \return Number of haptic devices detected on the system.
*/ */
@ -781,7 +811,7 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* If no name can be found, this function returns NULL. * If no name can be found, this function returns NULL.
* *
* \param device_index Index of the device to get it's name. * \param device_index Index of the device to get its name.
* \return Name of the device or NULL on error. * \return Name of the device or NULL on error.
* *
* \sa SDL_NumHaptics * \sa SDL_NumHaptics
@ -794,7 +824,7 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
* The index passed as an argument refers to the N'th Haptic device on this * The index passed as an argument refers to the N'th Haptic device on this
* system. * system.
* *
* When opening a haptic device, it's gain will be set to maximum and * When opening a haptic device, its gain will be set to maximum and
* autocenter will be disabled. To modify these values use * autocenter will be disabled. To modify these values use
* SDL_HapticSetGain() and SDL_HapticSetAutocenter(). * SDL_HapticSetGain() and SDL_HapticSetAutocenter().
* *
@ -895,7 +925,7 @@ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
* \brief Returns the number of effects a haptic device can store. * \brief Returns the number of effects a haptic device can store.
* *
* On some platforms this isn't fully supported, and therefore is an * On some platforms this isn't fully supported, and therefore is an
* aproximation. Always check to see if your created effect was actually * approximation. Always check to see if your created effect was actually
* created and do not rely solely on SDL_HapticNumEffects(). * created and do not rely solely on SDL_HapticNumEffects().
* *
* \param haptic The haptic device to query effect max. * \param haptic The haptic device to query effect max.
@ -912,7 +942,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
* time. * time.
* *
* This is not supported on all platforms, but will always return a value. * This is not supported on all platforms, but will always return a value.
* Added here for the sake of completness. * Added here for the sake of completeness.
* *
* \param haptic The haptic device to query maximum playing effects. * \param haptic The haptic device to query maximum playing effects.
* \return The number of effects the haptic device can play at the same time * \return The number of effects the haptic device can play at the same time
@ -928,7 +958,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
* *
* Example: * Example:
* \code * \code
* if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) { * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
* printf("We have constant haptic effect!"); * printf("We have constant haptic effect!");
* } * }
* \endcode * \endcode
@ -988,7 +1018,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
* \param haptic Haptic device that has the effect. * \param haptic Haptic device that has the effect.
* \param effect Effect to update. * \param effect Effect to update.
* \param data New effect properties to use. * \param data New effect properties to use.
* \return The id of the effect on success or -1 on error. * \return 0 on success or -1 on error.
* *
* \sa SDL_HapticNewEffect * \sa SDL_HapticNewEffect
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
@ -999,7 +1029,7 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
SDL_HapticEffect * data); SDL_HapticEffect * data);
/** /**
* \brief Runs the haptic effect on it's assosciated haptic device. * \brief Runs the haptic effect on its associated haptic device.
* *
* If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
* repeating the envelope (attack and fade) every time. If you only want the * repeating the envelope (attack and fade) every time. If you only want the
@ -1021,7 +1051,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
Uint32 iterations); Uint32 iterations);
/** /**
* \brief Stops the haptic effect on it's assosciated haptic device. * \brief Stops the haptic effect on its associated haptic device.
* *
* \param haptic Haptic device to stop the effect on. * \param haptic Haptic device to stop the effect on.
* \param effect Identifier of the effect to stop. * \param effect Identifier of the effect to stop.
@ -1053,9 +1083,8 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
* Device must support the ::SDL_HAPTIC_STATUS feature. * Device must support the ::SDL_HAPTIC_STATUS feature.
* *
* \param haptic Haptic device to query the effect status on. * \param haptic Haptic device to query the effect status on.
* \param effect Identifier of the effect to query it's status. * \param effect Identifier of the effect to query its status.
* \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing * \return 0 if it isn't playing, 1 if it is playing or -1 on error.
* or -1 on error.
* *
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
* \sa SDL_HapticStopEffect * \sa SDL_HapticStopEffect
@ -1068,9 +1097,9 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
* *
* Device must support the ::SDL_HAPTIC_GAIN feature. * Device must support the ::SDL_HAPTIC_GAIN feature.
* *
* The user may specify the maxmimum gain by setting the environment variable * The user may specify the maximum gain by setting the environment variable
* ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to
* SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
* maximum. * maximum.
* *
* \param haptic Haptic device to set the gain on. * \param haptic Haptic device to set the gain on.
@ -1135,7 +1164,7 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
/** /**
* \brief Checks to see if rumble is supported on a haptic device.. * \brief Checks to see if rumble is supported on a haptic device.
* *
* \param haptic Haptic device to check to see if it supports rumble. * \param haptic Haptic device to check to see if it supports rumble.
* \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
@ -1164,7 +1193,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
* *
* \param haptic Haptic device to play rumble effect on. * \param haptic Haptic device to play rumble effect on.
* \param strength Strength of the rumble to play as a 0-1 float value. * \param strength Strength of the rumble to play as a 0-1 float value.
* \param length Length of the rumble to play in miliseconds. * \param length Length of the rumble to play in milliseconds.
* \return 0 on success or -1 on error. * \return 0 on success or -1 on error.
* *
* \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumbleSupported
@ -1185,13 +1214,9 @@ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float stre
*/ */
extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -44,15 +44,13 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
* \brief A variable controlling how 3D acceleration is used to accelerate the SDL 1.2 screen surface. * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
* *
* SDL can try to accelerate the SDL 1.2 screen surface by using streaming * SDL can try to accelerate the SDL screen surface by using streaming
* textures with a 3D rendering engine. This variable controls whether and * textures with a 3D rendering engine. This variable controls whether and
* how this is done. * how this is done.
* *
@ -102,14 +100,14 @@ extern "C" {
* This variable can be set to the following values: * This variable can be set to the following values:
* "0" or "nearest" - Nearest pixel sampling * "0" or "nearest" - Nearest pixel sampling
* "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D)
* "2" or "best" - Anisotropic filtering (supported by Direct3D) * "2" or "best" - Currently this is the same as "linear"
* *
* By default nearest pixel sampling is used * By default nearest pixel sampling is used
*/ */
#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" #define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY"
/** /**
* \brief A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing. * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing.
* *
* This variable can be set to the following values: * This variable can be set to the following values:
* "0" - Disable vsync * "0" - Disable vsync
@ -196,14 +194,41 @@ extern "C" {
#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS"
/**
* \brief A variable that lets you disable the detection and use of Xinput gamepad devices
*
* 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 * \brief A variable that lets you manually hint extra gamecontroller db entries
* *
* The variable expected newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * 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" #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG"
/**
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
*
* The variable can be set to the following values:
* "0" - Disable joystick & gamecontroller input events when the
* application is in the background.
* "1" - Enable joystick & gamecontroller input events when the
* application is in the backgroumd.
*
* The default value is "0". This hint may be set at any time.
*/
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
/** /**
* \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"
@ -215,6 +240,23 @@ extern "C" {
#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST"
/**
* \brief A variable that controls the timer resolution, in milliseconds.
*
* The higher resolution the timer, the more frequently the CPU services
* timer interrupts, and the more precise delays are, but this takes up
* power and CPU time. This hint is only used on Windows 7 and earlier.
*
* See this blog post for more information:
* http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
*
* If this variable is set to "0", the system timer resolution is not set.
*
* The default value is "1". This hint may be set at any time.
*/
#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION"
/** /**
* \brief An enumeration of hint priorities * \brief An enumeration of hint priorities
@ -248,7 +290,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name,
extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
const char *value); const char *value);
/** /**
* \brief Get a hint * \brief Get a hint
* *
@ -256,6 +297,29 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name,
*/ */
extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name);
/**
* \brief Add a function to watch a particular hint
*
* \param name The hint to watch
* \param callback The function to call when the hint value changes
* \param userdata A pointer to pass to the callback function
*/
typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name,
SDL_HintCallback callback,
void *userdata);
/**
* \brief Remove a function watching a particular hint
*
* \param name The hint being watched
* \param callback The function being called when the hint value changes
* \param userdata A pointer being passed to the callback function
*/
extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name,
SDL_HintCallback callback,
void *userdata);
/** /**
* \brief Clear all hints * \brief Clear all hints
* *
@ -266,9 +330,7 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -45,9 +45,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -56,6 +54,10 @@ extern "C" {
* 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_JOYSTICK flag. This causes SDL to scan the system
* for joysticks, and load appropriate drivers. * for joysticks, and load appropriate drivers.
*
* If you would like to receive joystick updates while the application
* is in the background, you should set the following hint before calling
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/ */
/* The joystick structure used to identify an SDL joystick */ /* The joystick structure used to identify an SDL joystick */
@ -67,7 +69,7 @@ typedef struct {
Uint8 data[16]; Uint8 data[16];
} SDL_JoystickGUID; } SDL_JoystickGUID;
typedef int SDL_JoystickID; typedef Sint32 SDL_JoystickID;
/* Function prototypes */ /* Function prototypes */
@ -126,7 +128,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick); 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); extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);
@ -242,9 +244,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -36,20 +36,20 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
* \brief The SDL keysym structure, used in key events. * \brief The SDL keysym structure, used in key events.
*
* \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
*/ */
typedef struct SDL_Keysym typedef struct SDL_Keysym
{ {
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Uint16 mod; /**< current key modifiers */ Uint16 mod; /**< current key modifiers */
Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */ Uint32 unused;
} SDL_Keysym; } SDL_Keysym;
/* Function prototypes */ /* Function prototypes */
@ -68,13 +68,13 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
* *
* \b Example: * \b Example:
* \code * \code
* Uint8 *state = SDL_GetKeyboardState(NULL); * const Uint8 *state = SDL_GetKeyboardState(NULL);
* if ( state[SDL_SCANCODE_RETURN] ) { * if ( state[SDL_SCANCODE_RETURN] ) {
* printf("<RETURN> is pressed.\n"); * printf("<RETURN> is pressed.\n");
* } * }
* \endcode * \endcode
*/ */
extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
/** /**
* \brief Get the current key modifier state for the keyboard. * \brief Get the current key modifier state for the keyboard.
@ -208,9 +208,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

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

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -47,9 +47,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -74,9 +72,7 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -42,9 +42,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
@ -204,9 +202,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -30,11 +30,33 @@
* Redefine main() on some platforms so that it is called by SDL. * Redefine main() on some platforms so that it is called by SDL.
*/ */
#if defined(__WIN32__) || defined(__IPHONEOS__) || defined(__ANDROID__)
#ifndef SDL_MAIN_HANDLED #ifndef SDL_MAIN_HANDLED
#if defined(__WIN32__)
/* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function.
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__IPHONEOS__)
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
See src/video/uikit/SDL_uikitappdelegate.m for more details.
*/
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
#elif defined(__ANDROID__)
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
See README-android.txt for more details on extending that class.
*/
#define SDL_MAIN_NEEDED
#endif #endif
#endif #endif /* SDL_MAIN_HANDLED */
#ifdef __cplusplus #ifdef __cplusplus
#define C_LINKAGE "C" #define C_LINKAGE "C"
@ -57,7 +79,7 @@
* \endcode * \endcode
*/ */
#ifdef SDL_MAIN_NEEDED #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
#define main SDL_main #define main SDL_main
#endif #endif
@ -69,11 +91,18 @@ extern C_LINKAGE int SDL_main(int argc, char *argv[]);
#include "begin_code.h" #include "begin_code.h"
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/*
* This is called by the real SDL main function to let the rest of the
* library know that initialization was done properly.
*
* Calling this yourself without knowing what you're doing can cause
* crashes and hard to diagnose problems with your application.
*/
extern DECLSPEC void SDL_SetMainReady(void);
#ifdef __WIN32__ #ifdef __WIN32__
/** /**
@ -87,9 +116,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -28,9 +28,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -58,7 +56,7 @@ typedef enum
typedef struct typedef struct
{ {
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
int buttonid; /**< User defined button id (value returned via SDL_MessageBox) */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
const char * text; /**< The UTF-8 button text */ const char * text; /**< The UTF-8 button text */
} SDL_MessageBoxButtonData; } SDL_MessageBoxButtonData;
@ -107,7 +105,8 @@ typedef struct
/** /**
* \brief Create a modal message box. * \brief Create a modal message box.
* *
* \param messagebox The SDL_MessageBox structure with title, text, etc. * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc.
* \param buttonid The pointer to which user id of hit button should be copied.
* *
* \return -1 on error, otherwise 0 and buttonid contains user id of button * \return -1 on error, otherwise 0 and buttonid contains user id of button
* hit or -1 if dialog was closed. * hit or -1 if dialog was closed.
@ -136,9 +135,7 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -23,22 +23,6 @@
* \file SDL_mouse.h * \file SDL_mouse.h
* *
* Include file for SDL mouse event handling. * Include file for SDL mouse event handling.
*
* Please note that this ONLY discusses "mice" with the notion of the
* desktop GUI. You (usually) have one system cursor, and the OS hides
* the hardware details from you. If you plug in 10 mice, all ten move that
* one cursor. For many applications and games, this is perfect, and this
* API has served hundreds of SDL programs well since its birth.
*
* It's not the whole picture, though. If you want more lowlevel control,
* SDL offers a different API, that gives you visibility into each input
* device, multi-touch interfaces, etc.
*
* Those two APIs are incompatible, and you usually should not use both
* at the same time. But for legacy purposes, this API refers to a "mouse"
* when it actually means the system pointer and not a physical mouse.
*
* The other API is in SDL_input.h
*/ */
#ifndef _SDL_mouse_h #ifndef _SDL_mouse_h
@ -51,9 +35,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
@ -63,18 +45,18 @@ typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */
*/ */
typedef enum typedef enum
{ {
SDL_SYSTEM_CURSOR_ARROW, // Arrow SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
SDL_SYSTEM_CURSOR_IBEAM, // I-beam SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
SDL_SYSTEM_CURSOR_WAIT, // Wait SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
SDL_SYSTEM_CURSOR_CROSSHAIR, // Crosshair SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
SDL_SYSTEM_CURSOR_WAITARROW, // Small wait cursor (or Wait if not available) SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
SDL_SYSTEM_CURSOR_SIZENWSE, // Double arrow pointing northwest and southeast SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
SDL_SYSTEM_CURSOR_SIZENESW, // Double arrow pointing northeast and southwest SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
SDL_SYSTEM_CURSOR_SIZEWE, // Double arrow pointing west and east SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
SDL_SYSTEM_CURSOR_SIZENS, // Double arrow pointing north and south SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
SDL_SYSTEM_CURSOR_SIZEALL, // Four pointed arrow pointing north, south, east, and west SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
SDL_SYSTEM_CURSOR_NO, // Slashed circle or crossbones SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
SDL_SYSTEM_CURSOR_HAND, // Hand SDL_SYSTEM_CURSOR_HAND, /**< Hand */
SDL_NUM_SYSTEM_CURSORS SDL_NUM_SYSTEM_CURSORS
} SDL_SystemCursor; } SDL_SystemCursor;
@ -190,6 +172,11 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
*/ */
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
/**
* \brief Return the default cursor.
*/
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
/** /**
* \brief Frees a cursor created with SDL_CreateCursor(). * \brief Frees a cursor created with SDL_CreateCursor().
* *
@ -228,9 +215,7 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -34,9 +34,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -70,8 +68,15 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
* *
* \return 0, or -1 on error. * \return 0, or -1 on error.
*/ */
#define SDL_LockMutex(m) SDL_mutexP(m) #define SDL_mutexP(m) SDL_LockMutex(m)
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex * mutex); 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. * Unlock the mutex.
@ -81,8 +86,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 * \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. * the current thread, and doing so results in undefined behavior.
*/ */
#define SDL_UnlockMutex(m) SDL_mutexV(m) #define SDL_mutexV(m) SDL_UnlockMutex(m)
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex * mutex); extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
/** /**
* Destroy a mutex. * Destroy a mutex.
@ -237,9 +242,7 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -40,14 +40,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef __HAIKU__ /* !!! FIXME: temp compiler warning fix... */
#define NO_SDL_GLEXT 1
#endif
#ifdef __FreeBSD__ /* !!! FIXME: temp compiler warning fix... */
#define NO_SDL_GLEXT 1
#endif
#ifdef __glext_h_ #ifdef __glext_h_
/* Someone has already included glext.h */ /* Someone has already included glext.h */
#define NO_SDL_GLEXT #define NO_SDL_GLEXT
@ -83,7 +75,6 @@
*/ */
#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY) #if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY)
/* *INDENT-OFF* */
#ifndef __glext_h_ #ifndef __glext_h_
#define __glext_h_ #define __glext_h_
@ -11126,7 +11117,6 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons
#endif #endif
#endif #endif
/* *INDENT-ON* */
#endif /* NO_SDL_GLEXT */ #endif /* NO_SDL_GLEXT */
#endif /* !__IPHONEOS__ */ #endif /* !__IPHONEOS__ */

View file

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

View file

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

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -31,9 +31,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -256,7 +254,7 @@ typedef struct SDL_Color
Uint8 r; Uint8 r;
Uint8 g; Uint8 g;
Uint8 b; Uint8 b;
Uint8 unused; Uint8 a;
} SDL_Color; } SDL_Color;
#define SDL_Colour SDL_Color #define SDL_Colour SDL_Color
@ -420,9 +418,7 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -83,6 +83,9 @@
/* if not compiling for iPhone */ /* if not compiling for iPhone */
#undef __MACOSX__ #undef __MACOSX__
#define __MACOSX__ 1 #define __MACOSX__ 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
# error SDL for Mac OS X only supports deploying on 10.5 and above.
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
#endif /* TARGET_OS_IPHONE */ #endif /* TARGET_OS_IPHONE */
#endif /* defined(__APPLE__) */ #endif /* defined(__APPLE__) */
@ -114,23 +117,19 @@
#undef __SOLARIS__ #undef __SOLARIS__
#define __SOLARIS__ 1 #define __SOLARIS__ 1
#endif #endif
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
#undef __WIN32__ #undef __WIN32__
#define __WIN32__ 1 #define __WIN32__ 1
#endif #endif
#if defined(__PSP__)
#if defined(__NDS__) #undef __PSP__
#undef __NINTENDODS__ #define __PSP__ 1
#define __NINTENDODS__ 1
#endif #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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -140,9 +139,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -33,9 +33,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -68,9 +66,7 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

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

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -36,9 +36,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -71,14 +69,19 @@ typedef struct SDL_Rect
/** /**
* \brief Returns true if the rectangle has no area. * \brief Returns true if the rectangle has no area.
*/ */
#define SDL_RectEmpty(X) ((!(X)) || ((X)->w <= 0) || ((X)->h <= 0)) SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
{
return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE;
}
/** /**
* \brief Returns true if the two rectangles are equal. * \brief Returns true if the two rectangles are equal.
*/ */
#define SDL_RectEquals(A, B) (((A)) && ((B)) && \ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
((A)->x == (B)->x) && ((A)->y == (B)->y) && \ {
((A)->w == (B)->w) && ((A)->h == (B)->h)) return (a && b && (a->x == b->x) && (a->y == b->y) &&
(a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE;
}
/** /**
* \brief Determine whether two rectangles intersect. * \brief Determine whether two rectangles intersect.
@ -126,9 +129,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -37,9 +37,12 @@
* them, and may also be stretched with linear interpolation. * them, and may also be stretched with linear interpolation.
* *
* This API is designed to accelerate simple 2D operations. You may * This API is designed to accelerate simple 2D operations. You may
* want more functionality such as rotation and particle effects and * want more functionality such as polygons and particle effects and
* in that case you should use SDL's OpenGL/Direct3D support or one * in that case you should use SDL's OpenGL/Direct3D support or one
* of the many good 3D engines. * of the many good 3D engines.
*
* These functions must be called from the main thread.
* See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
*/ */
#ifndef _SDL_render_h #ifndef _SDL_render_h
@ -52,9 +55,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -213,9 +214,16 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
SDL_RendererInfo * info); SDL_RendererInfo * info);
/**
* \brief Get the output size of a rendering context.
*/
extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer,
int *w, int *h);
/** /**
* \brief Create a texture for a rendering context. * \brief Create a texture for a rendering context.
* *
* \param renderer The renderer.
* \param format The format of the texture. * \param format The format of the texture.
* \param access One of the enumerated values in ::SDL_TextureAccess. * \param access One of the enumerated values in ::SDL_TextureAccess.
* \param w The width of the texture in pixels. * \param w The width of the texture in pixels.
@ -237,6 +245,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer,
/** /**
* \brief Create a texture from an existing surface. * \brief Create a texture from an existing surface.
* *
* \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 0 on error.
@ -410,6 +419,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *rendere
/** /**
* \brief Set a texture as the current rendering target. * \brief Set a texture as the current rendering target.
* *
* \param renderer The renderer.
* \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
* *
* \return 0 on success, or -1 on error * \return 0 on success, or -1 on error
@ -431,6 +441,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer
/** /**
* \brief Set device independent resolution for rendering * \brief Set device independent resolution for rendering
* *
* \param renderer The renderer for which resolution should be set.
* \param w The width of the logical resolution * \param w The width of the logical resolution
* \param h The height of the logical resolution * \param h The height of the logical resolution
* *
@ -455,22 +466,25 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in
/** /**
* \brief Get device independent resolution for rendering * \brief Get device independent resolution for rendering
* *
* \param renderer The renderer from which resolution should be queried.
* \param w A pointer filled with the width of the logical resolution * \param w A pointer filled with the width of the logical resolution
* \param h A pointer filled with the height of the logical resolution * \param h A pointer filled with the height of the logical resolution
* *
* \sa SDL_RenderSetLogicalSize() * \sa SDL_RenderSetLogicalSize()
*/ */
extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *y); extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h);
/** /**
* \brief Set the drawing area for rendering on the current target. * \brief Set the drawing area for rendering on the current target.
* *
* \param renderer The renderer for which the drawing area should be set.
* \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
* *
* The x,y of the viewport rect represents the origin for rendering. * The x,y of the viewport rect represents the origin for rendering.
* *
* \note When the window is resized, the current viewport is automatically * \return 0 on success, or -1 on error
* centered within the new window size. *
* \note If the window associated with the renderer is resized, the viewport is automatically reset.
* *
* \sa SDL_RenderGetViewport() * \sa SDL_RenderGetViewport()
* \sa SDL_RenderSetLogicalSize() * \sa SDL_RenderSetLogicalSize()
@ -486,9 +500,36 @@ extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer,
extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer,
SDL_Rect * rect); SDL_Rect * rect);
/**
* \brief Set the clip rectangle for the current target.
*
* \param renderer The renderer for which clip rectangle should be set.
* \param rect A pointer to the rectangle to set as the clip rectangle, or
* NULL to disable clipping.
*
* \return 0 on success, or -1 on error
*
* \sa SDL_RenderGetClipRect()
*/
extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer,
const SDL_Rect * rect);
/**
* \brief Get the clip rectangle for the current target.
*
* \param renderer The renderer from which clip rectangle should be queried.
* \param rect A pointer filled in with the current clip rectangle, or
* an empty rectangle if clipping is disabled.
*
* \sa SDL_RenderSetClipRect()
*/
extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer,
SDL_Rect * rect);
/** /**
* \brief Set the drawing scale for rendering on the current target. * \brief Set the drawing scale for rendering on the current target.
* *
* \param renderer The renderer for which the drawing scale should be set.
* \param scaleX The horizontal scaling factor * \param scaleX The horizontal scaling factor
* \param scaleY The vertical scaling factor * \param scaleY The vertical scaling factor
* *
@ -509,6 +550,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer,
/** /**
* \brief Get the drawing scale for the current target. * \brief Get the drawing scale for the current target.
* *
* \param renderer The renderer from which drawing scale should be queried.
* \param scaleX A pointer filled in with the horizontal scaling factor * \param scaleX A pointer filled in with the horizontal scaling factor
* \param scaleY A pointer filled in with the vertical scaling factor * \param scaleY A pointer filled in with the vertical scaling factor
* *
@ -520,6 +562,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer,
/** /**
* \brief Set the color used for drawing operations (Rect, Line and Clear). * \brief Set the color used for drawing operations (Rect, Line and Clear).
* *
* \param renderer The renderer for which drawing color should be set.
* \param r The red value used to draw on the rendering target. * \param r The red value used to draw on the rendering target.
* \param g The green value used to draw on the rendering target. * \param g The green value used to draw on the rendering target.
* \param b The blue value used to draw on the rendering target. * \param b The blue value used to draw on the rendering target.
@ -535,6 +578,7 @@ extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
/** /**
* \brief Get the color used for drawing operations (Rect, Line and Clear). * \brief Get the color used for drawing operations (Rect, Line and Clear).
* *
* \param renderer The renderer from which drawing color should be queried.
* \param r A pointer to the red value used to draw on the rendering target. * \param r A pointer to the red value used to draw on the rendering target.
* \param g A pointer to the green value used to draw on the rendering target. * \param g A pointer to the green value used to draw on the rendering target.
* \param b A pointer to the blue value used to draw on the rendering target. * \param b A pointer to the blue value used to draw on the rendering target.
@ -550,6 +594,7 @@ extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
/** /**
* \brief Set the blend mode used for drawing operations (Fill and Line). * \brief Set the blend mode used for drawing operations (Fill and Line).
* *
* \param renderer The renderer for which blend mode should be set.
* \param blendMode ::SDL_BlendMode to use for blending. * \param blendMode ::SDL_BlendMode to use for blending.
* *
* \return 0 on success, or -1 on error * \return 0 on success, or -1 on error
@ -565,6 +610,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
/** /**
* \brief Get the blend mode used for drawing operations. * \brief Get the blend mode used for drawing operations.
* *
* \param renderer The renderer from which blend mode should be queried.
* \param blendMode A pointer filled in with the current blend mode. * \param blendMode A pointer filled in with the current blend mode.
* *
* \return 0 on success, or -1 on error * \return 0 on success, or -1 on error
@ -578,12 +624,15 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
* \brief Clear the current rendering target with the drawing color * \brief Clear the current rendering target with the drawing color
* *
* This function clears the entire rendering target, ignoring the viewport. * This function clears the entire rendering target, ignoring the viewport.
*
* \return 0 on success, or -1 on error
*/ */
extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
/** /**
* \brief Draw a point on the current rendering target. * \brief Draw a point on the current rendering target.
* *
* \param renderer The renderer which should draw a point.
* \param x The x coordinate of the point. * \param x The x coordinate of the point.
* \param y The y coordinate of the point. * \param y The y coordinate of the point.
* *
@ -595,6 +644,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
/** /**
* \brief Draw multiple points on the current rendering target. * \brief Draw multiple points on the current rendering target.
* *
* \param renderer The renderer which should draw multiple points.
* \param points The points to draw * \param points The points to draw
* \param count The number of points to draw * \param count The number of points to draw
* *
@ -607,6 +657,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
/** /**
* \brief Draw a line on the current rendering target. * \brief Draw a line on the current rendering target.
* *
* \param renderer The renderer which should draw a line.
* \param x1 The x coordinate of the start point. * \param x1 The x coordinate of the start point.
* \param y1 The y coordinate of the start point. * \param y1 The y coordinate of the start point.
* \param x2 The x coordinate of the end point. * \param x2 The x coordinate of the end point.
@ -620,6 +671,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
/** /**
* \brief Draw a series of connected lines on the current rendering target. * \brief Draw a series of connected lines on the current rendering target.
* *
* \param renderer The renderer which should draw multiple lines.
* \param points The points along the lines * \param points The points along the lines
* \param count The number of points, drawing count-1 lines * \param count The number of points, drawing count-1 lines
* *
@ -632,6 +684,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
/** /**
* \brief Draw a rectangle on the current rendering target. * \brief Draw a rectangle on the current rendering target.
* *
* \param renderer The renderer which should draw a rectangle.
* \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
* *
* \return 0 on success, or -1 on error * \return 0 on success, or -1 on error
@ -642,6 +695,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
/** /**
* \brief Draw some number of rectangles on the current rendering target. * \brief Draw some number of rectangles on the current rendering target.
* *
* \param renderer The renderer which should draw multiple rectangles.
* \param rects A pointer to an array of destination rectangles. * \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles. * \param count The number of rectangles.
* *
@ -654,6 +708,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
/** /**
* \brief Fill a rectangle on the current rendering target with the drawing color. * \brief Fill a rectangle on the current rendering target with the drawing color.
* *
* \param renderer The renderer which should fill a rectangle.
* \param rect A pointer to the destination rectangle, or NULL for the entire * \param rect A pointer to the destination rectangle, or NULL for the entire
* rendering target. * rendering target.
* *
@ -665,6 +720,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
/** /**
* \brief Fill some number of rectangles on the current rendering target with the drawing color. * \brief Fill some number of rectangles on the current rendering target with the drawing color.
* *
* \param renderer The renderer which should fill multiple rectangles.
* \param rects A pointer to an array of destination rectangles. * \param rects A pointer to an array of destination rectangles.
* \param count The number of rectangles. * \param count The number of rectangles.
* *
@ -677,6 +733,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
/** /**
* \brief Copy a portion of the texture to the current rendering target. * \brief Copy a portion of the texture to the current rendering target.
* *
* \param renderer The renderer which should copy parts of a texture.
* \param texture The source texture. * \param texture The source texture.
* \param srcrect A pointer to the source rectangle, or NULL for the entire * \param srcrect A pointer to the source rectangle, or NULL for the entire
* texture. * texture.
@ -693,6 +750,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
/** /**
* \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
* *
* \param renderer The renderer which should copy parts of a texture.
* \param texture The source texture. * \param texture The source texture.
* \param srcrect A pointer to the source rectangle, or NULL for the entire * \param srcrect A pointer to the source rectangle, or NULL for the entire
* texture. * texture.
@ -700,7 +758,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
* 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 aroud dstrect.w/2, dstrect.h/2)
* \param flip A SFL_Flip 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
*/ */
@ -715,6 +773,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer,
/** /**
* \brief Read pixels from the current rendering target. * \brief Read pixels from the current rendering target.
* *
* \param renderer The renderer from which pixels should be read.
* \param rect A pointer to the rectangle to read, or NULL for the entire * \param rect A pointer to the rectangle to read, or NULL for the entire
* render target. * render target.
* \param format The desired format of the pixel data, or 0 to use the format * \param format The desired format of the pixel data, or 0 to use the format
@ -777,9 +836,7 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,2 +1,2 @@
#define SDL_REVISION "hg-0:aaaaaaaaaaah" #define SDL_REVISION "hg-7633:d6a8fa507a45"
#define SDL_REVISION_NUMBER 0 #define SDL_REVISION_NUMBER 7633

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -35,11 +35,17 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #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. * This is the read/write operation structure -- very basic.
*/ */
@ -54,7 +60,7 @@ typedef struct SDL_RWops
* Seek to \c offset relative to \c whence, one of stdio's whence values: * Seek to \c offset relative to \c whence, one of stdio's whence values:
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END * 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, Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
int whence); int whence);
@ -130,6 +136,7 @@ typedef struct SDL_RWops
struct struct
{ {
void *data1; void *data1;
void *data2;
} unknown; } unknown;
} hidden; } hidden;
@ -216,9 +223,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -38,7 +38,7 @@
* SDL_Event structure. * SDL_Event structure.
* *
* The values in this enumeration are based on the USB usage page standard: * 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 typedef enum
{ {
@ -385,6 +385,9 @@ typedef enum
SDL_SCANCODE_EJECT = 281, SDL_SCANCODE_EJECT = 281,
SDL_SCANCODE_SLEEP = 282, SDL_SCANCODE_SLEEP = 282,
SDL_SCANCODE_APP1 = 283,
SDL_SCANCODE_APP2 = 284,
/*@}*//*Walther keys*/ /*@}*//*Walther keys*/
/* Add any other keys here. */ /* Add any other keys here. */

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -31,9 +31,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** \file SDL_shape.h /** \file SDL_shape.h
@ -57,7 +55,7 @@ extern "C" {
* \param h The height of the window. * \param h The height of the window.
* \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
* ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED,
* ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_RESIZABLE, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE,
* ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED,
* ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset.
* *
@ -138,9 +136,7 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -30,7 +30,6 @@
#include "SDL_config.h" #include "SDL_config.h"
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@ -94,9 +93,11 @@
#ifdef __cplusplus #ifdef __cplusplus
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression) #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
#define SDL_static_cast(type, expression) static_cast<type>(expression) #define SDL_static_cast(type, expression) static_cast<type>(expression)
#define SDL_const_cast(type, expression) const_cast<type>(expression)
#else #else
#define SDL_reinterpret_cast(type, expression) ((type)(expression)) #define SDL_reinterpret_cast(type, expression) ((type)(expression))
#define SDL_static_cast(type, expression) ((type)(expression)) #define SDL_static_cast(type, expression) ((type)(expression))
#define SDL_const_cast(type, expression) ((type)(expression))
#endif #endif
/*@}*//*Cast operators*/ /*@}*//*Cast operators*/
@ -175,14 +176,10 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
enums having the size of an int must be enabled. enums having the size of an int must be enabled.
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). 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 */ /** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS #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 */ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum typedef enum
{ {
@ -197,33 +194,7 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#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
/* *INDENT-OFF* */
extern "C" { 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 #endif
#if defined(HAVE_ALLOCA) && !defined(alloca) #if defined(HAVE_ALLOCA) && !defined(alloca)
@ -256,381 +227,112 @@ char *alloca();
#define SDL_stack_free(data) SDL_free(data) #define SDL_stack_free(data) SDL_free(data)
#endif #endif
#ifdef HAVE_GETENV extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
#define SDL_getenv getenv extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
#else extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
extern DECLSPEC void SDLCALL SDL_free(void *mem);
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
#endif extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
/* SDL_putenv() has moved to SDL_compat. */ extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
#ifdef HAVE_SETENV
#define SDL_setenv setenv
#else
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value,
int overwrite);
#endif
#ifdef HAVE_QSORT extern DECLSPEC int SDLCALL SDL_abs(int x);
#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 *));
#endif
#ifdef HAVE_ABS
#define SDL_abs abs
#else
#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
#endif
/* !!! 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_min(x, y) (((x) < (y)) ? (x) : (y))
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) #define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
#ifdef HAVE_CTYPE_H extern DECLSPEC int SDLCALL SDL_isdigit(int x);
#define SDL_isdigit(X) isdigit(X) extern DECLSPEC int SDLCALL SDL_isspace(int x);
#define SDL_isspace(X) isspace(X) extern DECLSPEC int SDLCALL SDL_toupper(int x);
#define SDL_toupper(X) toupper(X) extern DECLSPEC int SDLCALL SDL_tolower(int x);
#define SDL_tolower(X) 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))
#endif
#ifdef HAVE_MEMSET
#define SDL_memset memset
#else
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
#endif
#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)))
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t dwords)
{
#if defined(__GNUC__) && defined(i386) #if defined(__GNUC__) && defined(i386)
#define SDL_memset4(dst, val, len) \ int u0, u1, u2;
do { \ __asm__ __volatile__ (
int u0, u1, u2; \ "cld \n\t"
__asm__ __volatile__ ( \ "rep ; stosl \n\t"
"cld\n\t" \ : "=&D" (u0), "=&a" (u1), "=&c" (u2)
"rep ; stosl\n\t" \ : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \ : "memory"
: "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)
#endif
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACOSX__)
#define SDL_memcpy memcpy
#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)
#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))
#else #else
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t _n = (dwords + 3) / 4;
size_t len); Uint32 *_p = SDL_static_cast(Uint32 *, dst);
#endif Uint32 _val = (val);
if (dwords == 0)
return;
switch (dwords % 4)
{
case 0: do { *_p++ = _val;
case 3: *_p++ = _val;
case 2: *_p++ = _val;
case 1: *_p++ = _val;
} while ( --_n );
}
#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)
#endif
#ifdef HAVE_MEMMOVE extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
#define SDL_memmove memmove
#else
extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src,
size_t len);
#endif
#ifdef HAVE_MEMCMP SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords)
#define SDL_memcmp memcmp {
#else return SDL_memcpy(dst, src, dwords * 4);
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, }
size_t len);
#endif
#ifdef HAVE_STRLEN extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len);
#define SDL_strlen strlen extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
#else
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
#endif
#ifdef HAVE_WCSLEN extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
#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);
#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); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
#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); extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);
#endif
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_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);
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
#ifdef HAVE_STRLCPY extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
#define SDL_strlcpy strlcpy extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
#else extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
size_t maxlen); extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
#endif extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
size_t dst_bytes); extern DECLSPEC double SDLCALL SDL_atof(const char *str);
extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
#ifdef HAVE_STRLCAT
#define SDL_strlcat strlcat
#else
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
size_t maxlen);
#endif
#ifdef HAVE_STRDUP
#define SDL_strdup strdup
#else
extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
#endif
#ifdef HAVE__STRREV
#define SDL_strrev _strrev
#else
extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
#endif
#ifdef HAVE__STRUPR
#define SDL_strupr _strupr
#else
extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
#endif
#ifdef HAVE__STRLWR
#define SDL_strlwr _strlwr
#else
extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
#endif
#ifdef HAVE_STRCHR
#define SDL_strchr strchr
#elif defined(HAVE_INDEX)
#define SDL_strchr index
#else
extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
#endif
#ifdef HAVE_STRRCHR
#define SDL_strrchr strrchr
#elif defined(HAVE_RINDEX)
#define SDL_strrchr rindex
#else
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
#endif
#ifdef HAVE_STRSTR
#define SDL_strstr strstr
#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)
#endif
#ifdef HAVE__LTOA
#define SDL_ltoa _ltoa
#else
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
#endif
#ifdef HAVE__UITOA
#define SDL_uitoa _uitoa
#else
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
#endif
#ifdef HAVE__ULTOA
#define SDL_ultoa _ultoa
#else
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
int radix);
#endif
#ifdef HAVE_STRTOL
#define SDL_strtol strtol
#else
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
int base);
#endif
#ifdef HAVE_STRTOUL
#define SDL_strtoul strtoul
#else
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
char **endp, int base);
#endif
#ifdef HAVE__I64TOA
#define SDL_lltoa _i64toa
#else
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
int radix);
#endif
#ifdef HAVE__UI64TOA
#define SDL_ulltoa _ui64toa
#else
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
int radix);
#endif
#ifdef HAVE_STRTOLL
#define SDL_strtoll strtoll
#else
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
int base);
#endif
#ifdef HAVE_STRTOULL
#define SDL_strtoull strtoull
#else
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
int base);
#endif
#ifdef HAVE_STRTOD
#define SDL_strtod strtod
#else
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
#endif
#ifdef HAVE_ATOI
#define SDL_atoi atoi
#else
#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
#endif
#ifdef HAVE_ATOF
#define SDL_atof atof
#else
#define SDL_atof(X) SDL_strtod(X, NULL)
#endif
#ifdef HAVE_STRCMP
#define SDL_strcmp strcmp
#else
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
#endif extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
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);
#ifdef HAVE_STRNCMP extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
#define SDL_strncmp strncmp extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
#else extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
size_t maxlen);
#endif
#ifdef HAVE_STRCASECMP
#define SDL_strcasecmp strcasecmp
#elif defined(HAVE__STRICMP)
#define SDL_strcasecmp _stricmp
#else
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
const char *str2);
#endif
#ifdef HAVE_STRNCASECMP
#define SDL_strncasecmp strncasecmp
#elif defined(HAVE__STRNICMP)
#define SDL_strncasecmp _strnicmp
#else
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
const char *str2, size_t maxlen);
#endif
#ifdef HAVE_SSCANF
#define SDL_sscanf sscanf
#else
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
...);
#endif
#ifdef HAVE_SNPRINTF
#define SDL_snprintf snprintf
#else
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
const char *fmt, ...);
#endif
#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);
#endif
#ifndef HAVE_M_PI #ifndef HAVE_M_PI
#ifndef M_PI #ifndef M_PI
@ -638,89 +340,20 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
#endif #endif
#endif #endif
#ifdef HAVE_ATAN
#define SDL_atan atan
#else
extern DECLSPEC double SDLCALL SDL_atan(double x); extern DECLSPEC double SDLCALL SDL_atan(double x);
#endif extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
extern DECLSPEC double SDLCALL SDL_ceil(double x);
#ifdef HAVE_ATAN2
#define SDL_atan2 atan2
#else
extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
#endif
#ifdef HAVE_CEIL
#define SDL_ceil ceil
#else
#define SDL_ceil(x) ((double)(int)((x)+0.5))
#endif
#ifdef HAVE_COPYSIGN
#define SDL_copysign copysign
#else
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
#endif
#ifdef HAVE_COS
#define SDL_cos cos
#else
extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC double SDLCALL SDL_cos(double x);
#endif extern DECLSPEC float SDLCALL SDL_cosf(float x);
#ifdef HAVE_COSF
#define SDL_cosf cosf
#else
#define SDL_cosf(x) (float)SDL_cos((double)x)
#endif
#ifdef HAVE_FABS
#define SDL_fabs fabs
#else
extern DECLSPEC double SDLCALL SDL_fabs(double x); extern DECLSPEC double SDLCALL SDL_fabs(double x);
#endif
#ifdef HAVE_FLOOR
#define SDL_floor floor
#else
extern DECLSPEC double SDLCALL SDL_floor(double x); extern DECLSPEC double SDLCALL SDL_floor(double x);
#endif
#ifdef HAVE_LOG
#define SDL_log log
#else
extern DECLSPEC double SDLCALL SDL_log(double x); extern DECLSPEC double SDLCALL SDL_log(double x);
#endif
#ifdef HAVE_POW
#define SDL_pow pow
#else
extern DECLSPEC double SDLCALL SDL_pow(double x, double y); extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
#endif
#ifdef HAVE_SCALBN
#define SDL_scalbn scalbn
#else
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
#endif
#ifdef HAVE_SIN
#define SDL_sin sin
#else
extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC double SDLCALL SDL_sin(double x);
#endif extern DECLSPEC float SDLCALL SDL_sinf(float x);
#ifdef HAVE_SINF
#define SDL_sinf sinf
#else
#define SDL_sinf(x) (float)SDL_sin((double)x)
#endif
#ifdef HAVE_SQRT
#define SDL_sqrt sqrt
#else
extern DECLSPEC double SDLCALL SDL_sqrt(double x); extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#endif
/* 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
@ -728,16 +361,11 @@ extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#define SDL_ICONV_EILSEQ (size_t)-3 #define SDL_ICONV_EILSEQ (size_t)-3
#define SDL_ICONV_EINVAL (size_t)-4 #define SDL_ICONV_EINVAL (size_t)-4
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) /* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
#define SDL_iconv_t iconv_t
#define SDL_iconv_open iconv_open
#define SDL_iconv_close iconv_close
#else
typedef struct _SDL_iconv_t *SDL_iconv_t; typedef struct _SDL_iconv_t *SDL_iconv_t;
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
const char *fromcode); const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); 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, extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
size_t * inbytesleft, char **outbuf, size_t * inbytesleft, char **outbuf,
size_t * outbytesleft); size_t * outbytesleft);
@ -755,9 +383,7 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -22,7 +22,7 @@
/** /**
* \file SDL_surface.h * \file SDL_surface.h
* *
* Header file for ::SDL_surface definition and management functions. * Header file for ::SDL_Surface definition and management functions.
*/ */
#ifndef _SDL_surface_h #ifndef _SDL_surface_h
@ -37,15 +37,13 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
* \name Surface flags * \name Surface flags
* *
* These are the currently supported flags for the ::SDL_surface. * These are the currently supported flags for the ::SDL_Surface.
* *
* \internal * \internal
* Used internally (read-only). * Used internally (read-only).
@ -109,6 +107,13 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
* If the function runs out of memory, it will return NULL. * If the function runs out of memory, it will return NULL.
* *
* \param flags The \c flags are obsolete and should be set to 0. * \param flags The \c flags are obsolete and should be set to 0.
* \param width The width in pixels of the surface to create.
* \param height The height in pixels of the surface to create.
* \param depth The depth in bits of the surface to create.
* \param Rmask The red mask of the surface to create.
* \param Gmask The green mask of the surface to create.
* \param Bmask The blue mask of the surface to create.
* \param Amask The alpha mask of the surface to create.
*/ */
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth, (Uint32 flags, int width, int height, int depth,
@ -394,48 +399,46 @@ extern DECLSPEC int SDLCALL SDL_FillRects
* *
* The blit function should not be called on a locked surface. * The blit function should not be called on a locked surface.
* *
* The blit semantics for surfaces with and without alpha and colorkey * The blit semantics for surfaces with and without blending and colorkey
* are defined as follows: * are defined as follows:
* \verbatim * \verbatim
RGBA->RGB: RGBA->RGB:
SDL_SRCALPHA set: Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using alpha-channel). alpha-blend (using the source alpha-channel and per-surface alpha)
SDL_SRCCOLORKEY ignored. SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set: Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB. copy RGB.
if SDL_SRCCOLORKEY set, only copy the pixels matching the if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the RGB values of the source color key, ignoring alpha in the
comparison. comparison.
RGB->RGBA: RGB->RGBA:
SDL_SRCALPHA set: Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source per-surface alpha value); alpha-blend (using the source per-surface alpha)
set destination alpha to opaque. Source surface blend mode set to SDL_BLENDMODE_NONE:
SDL_SRCALPHA not set:
copy RGB, set destination alpha to source per-surface alpha value. copy RGB, set destination alpha to source per-surface alpha value.
both: both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the if SDL_SRCCOLORKEY set, only copy the pixels matching the
source colour key. source color key.
RGBA->RGBA: RGBA->RGBA:
SDL_SRCALPHA set: Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source alpha channel) the RGB values; alpha-blend (using the source alpha-channel and per-surface alpha)
leave destination alpha untouched. [Note: is this correct?]
SDL_SRCCOLORKEY ignored. SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set: Source surface blend mode set to SDL_BLENDMODE_NONE:
copy all of RGBA to the destination. copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the RGB values of the source color key, ignoring alpha in the
comparison. comparison.
RGB->RGB: RGB->RGB:
SDL_SRCALPHA set: Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source per-surface alpha value). alpha-blend (using the source per-surface alpha)
SDL_SRCALPHA not set: Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB. copy RGB.
both: both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the if SDL_SRCCOLORKEY set, only copy the pixels matching the
source colour key. source color key.
\endverbatim \endverbatim
* *
* You should call SDL_BlitSurface() unless you know exactly how SDL * You should call SDL_BlitSurface() unless you know exactly how SDL
@ -491,9 +494,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -38,9 +38,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* Platform specific functions for iOS */ /* Platform specific functions for iOS */
@ -62,6 +60,9 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv();
/* Get the SDL Activity object for the application /* 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.
It is the caller's responsibility to properly release it
(using env->Push/PopLocalFrame or manually with env->DeleteLocalRef)
*/ */
extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity();
@ -95,9 +96,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath();
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -36,9 +36,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -221,7 +219,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
* \code * \code
* SDL_SysWMinfo info; * SDL_SysWMinfo info;
* SDL_VERSION(&info.version); * SDL_VERSION(&info.version);
* if ( SDL_GetWindowWMInfo(&info) ) { ... } * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
* \endcode * \endcode
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
@ -230,9 +228,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -46,9 +46,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* Global definitions */ /* Global definitions */
@ -61,9 +59,7 @@ extern "C" {
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -39,9 +39,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -98,9 +96,7 @@ void SDLTest_LogAssertSummary();
int SDLTest_AssertSummaryToTestResult(); int SDLTest_AssertSummaryToTestResult();
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -34,9 +34,9 @@
#include "SDL.h" #include "SDL.h"
#ifdef __NDS__ #if defined(__PSP__)
#define DEFAULT_WINDOW_WIDTH 256 #define DEFAULT_WINDOW_WIDTH 480
#define DEFAULT_WINDOW_HEIGHT (2*192) #define DEFAULT_WINDOW_HEIGHT 272
#else #else
#define DEFAULT_WINDOW_WIDTH 640 #define DEFAULT_WINDOW_WIDTH 640
#define DEFAULT_WINDOW_HEIGHT 480 #define DEFAULT_WINDOW_HEIGHT 480
@ -69,6 +69,9 @@ typedef struct
int window_minH; int window_minH;
int window_maxW; int window_maxW;
int window_maxH; int window_maxH;
int logical_w;
int logical_h;
float scale;
int depth; int depth;
int refresh_rate; int refresh_rate;
int num_windows; int num_windows;
@ -104,14 +107,13 @@ typedef struct
int gl_accelerated; int gl_accelerated;
int gl_major_version; int gl_major_version;
int gl_minor_version; int gl_minor_version;
int gl_debug;
} SDLTest_CommonState; } SDLTest_CommonState;
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* Function prototypes */ /* Function prototypes */
@ -175,9 +177,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -43,9 +43,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -62,9 +60,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface,
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -39,9 +39,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
@ -117,9 +115,7 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -33,9 +33,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* Function prototypes */ /* Function prototypes */
@ -55,9 +53,7 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -39,9 +39,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
@ -158,13 +156,13 @@ double SDLTest_RandomDouble();
* RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
* RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
* RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100 * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100
* RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns -1 (== error value) * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set)
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or 0 with error set
*/ */
Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
@ -179,13 +177,13 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo
* RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
* RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
* RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100 * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100
* RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns -1 (== error value) * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set)
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or 0 with error set
*/ */
Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
@ -200,13 +198,13 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL
* RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
* RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
* RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100 * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100
* RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns -1 (== error value) * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set)
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or 0 with error set
*/ */
Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
@ -221,13 +219,13 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL
* RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20
* RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21
* RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100 * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100
* RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns -1 (== error value) * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set)
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or 0 with error set
*/ */
Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
@ -241,14 +239,14 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL
* Usage examples: * Usage examples:
* RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
* RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
* RandomSint8BoundaryValue(-128, 99, SDL_FALSE) returns 100 * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100
* RandomSint8BoundaryValue(-128, 127, SDL_FALSE) returns SINT8_MIN (== error value) * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or SINT8_MIN with error set
*/ */
Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
@ -263,14 +261,14 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo
* Usage examples: * Usage examples:
* RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
* RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
* RandomSint16BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100
* RandomSint16BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT16_MIN (== error value) * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or SINT16_MIN with error set
*/ */
Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
@ -289,9 +287,9 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or SINT32_MIN with error set
*/ */
Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
@ -306,13 +304,13 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL
* RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20
* RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9
* RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100 * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100
* RandomSint64BoundaryValue(SINT64_MIN, SINT32_MAX, SDL_FALSE) returns SINT64_MIN (== error value) * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set
* *
* \param boundary1 Lower boundary limit * \param boundary1 Lower boundary limit
* \param boundary2 Upper boundary limit * \param boundary2 Upper boundary limit
* \param validDomain Should the generated boundary be valid or not? * \param validDomain Should the generated boundary be valid (=within the bounds) or not?
* *
* \returns Boundary value in given range or error value (-1) * \returns Random boundary value for the given range and domain or SINT64_MIN with error set
*/ */
Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
@ -323,7 +321,10 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL
* If Max in smaller tham min, then the values are swapped. * If Max in smaller tham 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.
* *
* \returns Generated integer * \param min Minimum inclusive value of returned random number
* \param max Maximum inclusive value of returned random number
*
* \returns Generated random integer in range
*/ */
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
@ -374,9 +375,7 @@ int SDLTest_GetFuzzerInvocationCount();
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -39,9 +39,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
@ -51,8 +49,9 @@ extern "C" {
//! Definition of all the possible test return values of the test case method //! Definition of all the possible test return values of the test case method
#define TEST_ABORTED -1 #define TEST_ABORTED -1
#define TEST_COMPLETED 0 #define TEST_STARTED 0
#define TEST_SKIPPED 1 #define TEST_COMPLETED 1
#define TEST_SKIPPED 2
//! Definition of all the possible test results for the harness //! Definition of all the possible test results for the harness
#define TEST_RESULT_PASSED 0 #define TEST_RESULT_PASSED 0
@ -65,7 +64,7 @@ extern "C" {
typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
//!< Function pointer to a test case function //!< Function pointer to a test case function
typedef void (*SDLTest_TestCaseFp)(void *arg); typedef int (*SDLTest_TestCaseFp)(void *arg);
//!< Function pointer to a test case teardown function (run after every test) //!< Function pointer to a test case teardown function (run after every test)
typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
@ -115,9 +114,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -41,9 +41,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -53,11 +51,7 @@ typedef struct SDLTest_SurfaceImage_s {
int width; int width;
int height; int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
#if (defined(__GNUC__) && (__GNUC__ <= 2)) const char *pixel_data;
unsigned char pixel_data[0];
#else
unsigned char pixel_data[];
#endif
} SDLTest_SurfaceImage_t; } SDLTest_SurfaceImage_t;
/* Test images */ /* Test images */
@ -75,9 +69,7 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend();
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -39,9 +39,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -60,9 +58,7 @@ void SDLTest_LogError(const char *fmt, ...);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -59,9 +59,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* ------------ Definitions --------- */ /* ------------ Definitions --------- */
@ -122,9 +120,7 @@ extern "C" {
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -43,9 +43,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* --- Definitions */ /* --- Definitions */
@ -108,9 +106,7 @@ extern "C" {
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -32,14 +32,13 @@
#include "SDL_error.h" #include "SDL_error.h"
/* Thread synchronization primitives */ /* Thread synchronization primitives */
#include "SDL_atomic.h"
#include "SDL_mutex.h" #include "SDL_mutex.h"
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/* The SDL thread structure, defined in SDL_thread.c */ /* The SDL thread structure, defined in SDL_thread.c */
@ -49,6 +48,9 @@ typedef struct SDL_Thread SDL_Thread;
/* The SDL thread ID */ /* The SDL thread ID */
typedef unsigned long SDL_threadID; typedef unsigned long SDL_threadID;
/* Thread local storage ID, 0 is the invalid ID */
typedef unsigned int SDL_TLSID;
/* The SDL thread priority /* The SDL thread priority
* *
* Note: On many systems you require special privileges to set high priority. * Note: On many systems you require special privileges to set high priority.
@ -107,7 +109,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
/** /**
* Create a thread. * Create a thread.
*/ */
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex) #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
#else #else
@ -168,12 +170,68 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
*/ */
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
/**
* \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
*
* \return The newly created thread local storage identifier, or 0 on error
*
* \code
* static SDL_SpinLock tls_lock;
* static SDL_TLSID thread_local_storage;
*
* void SetMyThreadData(void *value)
* {
* if (!thread_local_storage) {
* SDL_AtomicLock(&tls_lock);
* if (!thread_local_storage) {
* thread_local_storage = SDL_TLSCreate();
* }
* SDL_AtomicUnLock(&tls_lock);
* }
* SDL_TLSSet(thread_local_storage, value);
* }
*
* void *GetMyThreadData(void)
* {
* return SDL_TLSGet(thread_local_storage);
* }
* \endcode
*
* \sa SDL_TLSGet()
* \sa SDL_TLSSet()
*/
extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
/**
* \brief Get the value associated with a thread local storage ID for the current thread.
*
* \param id The thread local storage ID
*
* \return The value associated with the ID for the current thread, or NULL if no value has been set.
*
* \sa SDL_TLSCreate()
* \sa SDL_TLSSet()
*/
extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
/**
* \brief Set the value associated with a thread local storage ID for the current thread.
*
* \param id The thread local storage ID
* \param value The value to associate with the ID for the current thread
* \param destructor A function called when the thread exits, to free the value.
*
* \return 0 on success, -1 on error
*
* \sa SDL_TLSCreate()
* \sa SDL_TLSGet()
*/
extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -34,9 +34,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -97,9 +95,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -35,88 +35,49 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
typedef Sint64 SDL_TouchID; typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID; typedef Sint64 SDL_FingerID;
typedef struct SDL_Finger
struct SDL_Finger { {
SDL_FingerID id; SDL_FingerID id;
Uint16 x; float x;
Uint16 y; float y;
Uint16 pressure; float pressure;
Uint16 xdelta; } SDL_Finger;
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 */ /* 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(void);
/** /**
* \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 extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
/**
* \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++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

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

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -33,9 +33,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -155,9 +153,7 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -36,9 +36,7 @@
#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
/* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */
#endif #endif
/** /**
@ -323,6 +321,7 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
/** /**
* \brief Get the closest match to the requested display mode. * \brief Get the closest match to the requested display mode.
* *
* \param displayIndex The index of display from which mode should be queried.
* \param mode The desired display mode * \param mode The desired display mode
* \param closest A pointer to a display mode to be filled in with the closest * \param closest A pointer to a display mode to be filled in with the closest
* match of the available display modes. * match of the available display modes.
@ -356,6 +355,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window);
* By default the window's dimensions and the desktop format and refresh rate * By default the window's dimensions and the desktop format and refresh rate
* are used. * are used.
* *
* \param window The window for which the display mode should be set.
* \param mode The mode to use, or NULL for the default mode. * \param mode The mode to use, or NULL for the default mode.
* *
* \return 0 on success, or -1 if setting the display mode failed. * \return 0 on success, or -1 if setting the display mode failed.
@ -394,7 +394,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);
* \param h The height of the window. * \param h The height of the window.
* \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_SHOWN, ::SDL_WINDOW_BORDERLESS, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS,
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED. * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED.
* *
@ -450,6 +450,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window);
/** /**
* \brief Set the icon for a window. * \brief Set the icon for a window.
* *
* \param window The window for which the icon should be set.
* \param icon The icon for the window. * \param icon The icon for the window.
*/ */
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window,
@ -504,6 +505,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 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() * \sa SDL_SetWindowPosition()
*/ */
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window,
@ -512,6 +517,10 @@ 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 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 * \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.
* *
@ -523,6 +532,10 @@ 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 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() * \sa SDL_SetWindowSize()
*/ */
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
@ -531,6 +544,10 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w,
/** /**
* \brief Set the minimum size of a window's client area. * \brief Set the minimum size of a window's client area.
* *
* \param window The window to set a new minimum size.
* \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 * \note You can't change the minimum size of a fullscreen window, it
* automatically matches the size of the display mode. * automatically matches the size of the display mode.
* *
@ -543,6 +560,10 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window,
/** /**
* \brief Get the minimum size of a window's client area. * \brief Get the minimum size of a window's client area.
* *
* \param window The window to query.
* \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_GetWindowMaximumSize()
* \sa SDL_SetWindowMinimumSize() * \sa SDL_SetWindowMinimumSize()
*/ */
@ -552,6 +573,10 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window,
/** /**
* \brief Set the maximum size of a window's client area. * \brief Set the maximum size of a window's client area.
* *
* \param window The window to set a new maximum size.
* \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 * \note You can't change the maximum size of a fullscreen window, it
* automatically matches the size of the display mode. * automatically matches the size of the display mode.
* *
@ -564,6 +589,10 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window,
/** /**
* \brief Get the maximum size of a window's client area. * \brief Get the maximum size of a window's client area.
* *
* \param window The window to query.
* \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_GetWindowMinimumSize()
* \sa SDL_SetWindowMaximumSize() * \sa SDL_SetWindowMaximumSize()
*/ */
@ -673,12 +702,13 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window);
* \sa SDL_UpdateWindowSurfaceRect() * \sa SDL_UpdateWindowSurfaceRect()
*/ */
extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
SDL_Rect * rects, const SDL_Rect * rects,
int numrects); int numrects);
/** /**
* \brief Set a window's input grab mode. * \brief Set a window's input grab mode.
* *
* \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.
* *
* \sa SDL_GetWindowGrab() * \sa SDL_GetWindowGrab()
@ -717,6 +747,7 @@ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window);
/** /**
* \brief Set the gamma ramp for a window. * \brief Set the gamma ramp for a window.
* *
* \param window The window for which the gamma ramp should be set.
* \param red The translation table for the red channel, or NULL. * \param red The translation table for the red channel, or NULL.
* \param green The translation table for the green channel, or NULL. * \param green The translation table for the green channel, or NULL.
* \param blue The translation table for the blue channel, or NULL. * \param blue The translation table for the blue channel, or NULL.
@ -739,6 +770,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window,
/** /**
* \brief Get the gamma ramp for a window. * \brief Get the gamma ramp for a window.
* *
* \param window The window from which the gamma ramp should be queried.
* \param red A pointer to a 256 element array of 16-bit quantities to hold * \param red A pointer to a 256 element array of 16-bit quantities to hold
* the translation table for the red channel, or NULL. * the translation table for the red channel, or NULL.
* \param green A pointer to a 256 element array of 16-bit quantities to hold * \param green A pointer to a 256 element array of 16-bit quantities to hold
@ -857,6 +889,16 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *
extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window,
SDL_GLContext context); SDL_GLContext context);
/**
* \brief Get the currently active OpenGL window.
*/
extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
/**
* \brief Get the currently active OpenGL context.
*/
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
/** /**
* \brief Set the swap interval for the current OpenGL context. * \brief Set the swap interval for the current OpenGL context.
* *
@ -902,9 +944,7 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */
} }
/* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"

View file

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -128,6 +128,16 @@
#define __inline__ #define __inline__
#endif #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 */ /* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__) #if !defined(__MACH__)
#ifndef NULL #ifndef NULL

View file

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