41 files modified
3 files added
| | |
| | | * The spin lock functions and type are required and can not be |
| | | * emulated because they are used in the atomic emulation code. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | typedef int SDL_SpinLock; |
| | | |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); |
| | | |
| | | /*@}*//*SDL AtomicLock*/ |
| | | /* @} *//* SDL AtomicLock */ |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * \name Audio flags |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | #define SDL_AUDIO_MASK_BITSIZE (0xFF) |
| | | #define SDL_AUDIO_MASK_DATATYPE (1<<8) |
| | |
| | | * |
| | | * Defaults to LSB byte order. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ |
| | | #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ |
| | | #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ |
| | |
| | | #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_U16 AUDIO_U16LSB |
| | | #define AUDIO_S16 AUDIO_S16LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name int32 support |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ |
| | | #define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_S32 AUDIO_S32LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name float32 support |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ |
| | | #define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_F32 AUDIO_F32LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Native audio byte ordering |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
| | | #define AUDIO_U16SYS AUDIO_U16LSB |
| | | #define AUDIO_S16SYS AUDIO_S16LSB |
| | |
| | | #define AUDIO_S32SYS AUDIO_S32MSB |
| | | #define AUDIO_F32SYS AUDIO_F32MSB |
| | | #endif |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Allow change flags |
| | | * |
| | | * Which audio format changes are allowed when opening a device. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 |
| | | #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 |
| | | #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 |
| | | #define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /*@}*//*Audio flags*/ |
| | | /* @} *//* Audio flags */ |
| | | |
| | | /** |
| | | * This function is called when the audio device needs more data. |
| | |
| | | * These functions return the list of built in audio drivers, in the |
| | | * order that they are normally initialized by default. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); |
| | | extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Initialization and cleanup |
| | |
| | | * you have a specific need to specify the audio driver you want to |
| | | * use. You should normally use SDL_Init() or SDL_InitSubSystem(). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); |
| | | extern DECLSPEC void SDLCALL SDL_AudioQuit(void); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * This function returns the name of the current audio driver, or NULL |
| | |
| | | * |
| | | * Get the current audio state. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | typedef enum |
| | | { |
| | | SDL_AUDIO_STOPPED = 0, |
| | |
| | | |
| | | extern DECLSPEC SDL_AudioStatus SDLCALL |
| | | SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); |
| | | /*@}*//*Audio State*/ |
| | | /* @} *//* Audio State */ |
| | | |
| | | /** |
| | | * \name Pause audio functions |
| | |
| | | * data for your callback function after opening the audio device. |
| | | * Silence will be written to the audio device during the pause. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); |
| | | extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, |
| | | int pause_on); |
| | | /*@}*//*Pause audio functions*/ |
| | | /* @} *//* Pause audio functions */ |
| | | |
| | | /** |
| | | * This function loads a WAVE from the data source, automatically freeing |
| | |
| | | * the callback function is not running. Do not call these from the callback |
| | | * function or you will cause deadlock. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC void SDLCALL SDL_LockAudio(void); |
| | | extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); |
| | | extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); |
| | | extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); |
| | | /*@}*//*Audio lock functions*/ |
| | | /* @} *//* Audio lock functions */ |
| | | |
| | | /** |
| | | * This function shuts down audio processing and closes the audio device. |
| | |
| | | /* Enable system power support */ |
| | | #define SDL_POWER_MACOSX 1 |
| | | |
| | | /* enable filesystem support */ |
| | | #define SDL_FILESYSTEM_COCOA 1 |
| | | |
| | | /* Enable assembly routines */ |
| | | #define SDL_ASSEMBLY_ROUTINES 1 |
| | | #ifdef __ppc__ |
| New file |
| | |
| | | /* |
| | | 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. |
| | | */ |
| | |
| | | /** |
| | | * \name The two types of endianness |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_LIL_ENDIAN 1234 |
| | | #define SDL_BIG_ENDIAN 4321 |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ |
| | | #ifdef __linux__ |
| | |
| | | * \name Swap to native |
| | | * Byteswap item from the specified endianness to the native endianness. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
| | | #define SDL_SwapLE16(X) (X) |
| | | #define SDL_SwapLE32(X) (X) |
| | |
| | | #define SDL_SwapBE64(X) (X) |
| | | #define SDL_SwapFloatBE(X) (X) |
| | | #endif |
| | | /*@}*//*Swap to native*/ |
| | | /* @} *//* Swap to native */ |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | |
| | | * \internal |
| | | * Private error reporting function - used internally. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) |
| | | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) |
| | | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) |
| | |
| | | } SDL_errorcode; |
| | | /* 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++ */ |
| | | #ifdef __cplusplus |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_PumpEvents(void); |
| | | |
| | | /*@{*/ |
| | | /* @{ */ |
| | | typedef enum |
| | | { |
| | | SDL_ADDEVENT, |
| | |
| | | extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, |
| | | SDL_eventaction action, |
| | | Uint32 minType, Uint32 maxType); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * Checks to see if certain event types are in the event queue. |
| | |
| | | extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, |
| | | void *userdata); |
| | | |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_QUERY -1 |
| | | #define SDL_IGNORE 0 |
| | | #define SDL_DISABLE 0 |
| | |
| | | * current processing state of the specified event. |
| | | */ |
| | | extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); |
| | | /*@}*/ |
| | | /* @} */ |
| | | #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY) |
| | | |
| | | /** |
| | |
| | | * |
| | | * Different haptic features a device can have. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \name Haptic effects |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \brief Constant effect supported. |
| | |
| | | #define SDL_HAPTIC_LEFTRIGHT (1<<2) |
| | | |
| | | /* !!! FIXME: put this back when we have more bits in 2.1 */ |
| | | /*#define SDL_HAPTIC_SQUARE (1<<2)*/ |
| | | /* #define SDL_HAPTIC_SQUARE (1<<2) */ |
| | | |
| | | /** |
| | | * \brief Triangle wave effect supported. |
| | |
| | | */ |
| | | #define SDL_HAPTIC_CUSTOM (1<<11) |
| | | |
| | | /*@}*//*Haptic effects*/ |
| | | /* @} *//* Haptic effects */ |
| | | |
| | | /* These last few are features the device has, not effects */ |
| | | |
| | |
| | | /** |
| | | * \name Direction encodings |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \brief Uses polar coordinates for the direction. |
| | |
| | | */ |
| | | #define SDL_HAPTIC_SPHERICAL 2 |
| | | |
| | | /*@}*//*Direction encodings*/ |
| | | /* @} *//* Direction encodings */ |
| | | |
| | | /*@}*//*Haptic features*/ |
| | | /* @} *//* Haptic features */ |
| | | |
| | | /* |
| | | * Misc defines. |
| | |
| | | /** |
| | | * \name Hat positions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_HAT_CENTERED 0x00 |
| | | #define SDL_HAT_UP 0x01 |
| | | #define SDL_HAT_RIGHT 0x02 |
| | |
| | | #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) |
| | | #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) |
| | | #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * Get the current state of a POV hat on a joystick. |
| | |
| | | /** |
| | | * \name Mutex functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /* The SDL mutex structure, defined in SDL_sysmutex.c */ |
| | | struct SDL_mutex; |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); |
| | | |
| | | /*@}*//*Mutex functions*/ |
| | | /* @} *//* Mutex functions */ |
| | | |
| | | |
| | | /** |
| | | * \name Semaphore functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /* The SDL semaphore structure, defined in SDL_syssem.c */ |
| | | struct SDL_semaphore; |
| | |
| | | */ |
| | | extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); |
| | | |
| | | /*@}*//*Semaphore functions*/ |
| | | /* @} *//* Semaphore functions */ |
| | | |
| | | |
| | | /** |
| | | * \name Condition variable functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /* The SDL condition variable structure, defined in SDL_syscond.c */ |
| | | struct SDL_cond; |
| | |
| | | extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, |
| | | SDL_mutex * mutex, Uint32 ms); |
| | | |
| | | /*@}*//*Condition variable functions*/ |
| | | /* @} *//* Condition variable functions */ |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | |
| | | * |
| | | * These define alpha as the opacity of a surface. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_ALPHA_OPAQUE 255 |
| | | #define SDL_ALPHA_TRANSPARENT 0 |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** Pixel type. */ |
| | | enum |
| | |
| | | * |
| | | * Functions to create SDL_RWops structures from various data streams. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, |
| | | const char *mode); |
| | |
| | | extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, |
| | | int size); |
| | | |
| | | /*@}*//*RWFrom functions*/ |
| | | /* @} *//* RWFrom functions */ |
| | | |
| | | |
| | | extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); |
| | |
| | | * |
| | | * Macros to easily read and write from an SDL_RWops structure. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_RWsize(ctx) (ctx)->size(ctx) |
| | | #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) |
| | | #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) |
| | | #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) |
| | | #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) |
| | | #define SDL_RWclose(ctx) (ctx)->close(ctx) |
| | | /*@}*//*Read/write macros*/ |
| | | /* @} *//* Read/write macros */ |
| | | |
| | | |
| | | /** |
| | |
| | | * |
| | | * Read an item of the specified endianness and return in native format. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); |
| | | extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); |
| | | extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); |
| | |
| | | extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); |
| | | extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); |
| | | extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); |
| | | /*@}*//*Read endian functions*/ |
| | | /* @} *//* Read endian functions */ |
| | | |
| | | /** |
| | | * \name Write endian functions |
| | | * |
| | | * Write an item of native format to the specified endianness. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); |
| | |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); |
| | | /*@}*//*Write endian functions*/ |
| | | /* @} *//* Write endian functions */ |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | |
| | | * |
| | | * These values are from usage page 0x07 (USB keyboard page). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | SDL_SCANCODE_A = 4, |
| | | SDL_SCANCODE_B = 5, |
| | |
| | | * special KMOD_MODE for it I'm adding it here |
| | | */ |
| | | |
| | | /*@}*//*Usage page 0x07*/ |
| | | /* @} *//* Usage page 0x07 */ |
| | | |
| | | /** |
| | | * \name Usage page 0x0C |
| | | * |
| | | * These values are mapped from usage page 0x0C (USB consumer page). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | SDL_SCANCODE_AUDIONEXT = 258, |
| | | SDL_SCANCODE_AUDIOPREV = 259, |
| | |
| | | SDL_SCANCODE_AC_REFRESH = 273, |
| | | SDL_SCANCODE_AC_BOOKMARKS = 274, |
| | | |
| | | /*@}*//*Usage page 0x0C*/ |
| | | /* @} *//* Usage page 0x0C */ |
| | | |
| | | /** |
| | | * \name Walther keys |
| | | * |
| | | * These are values that Christian Walther added (for mac keyboard?). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | SDL_SCANCODE_BRIGHTNESSDOWN = 275, |
| | | SDL_SCANCODE_BRIGHTNESSUP = 276, |
| | |
| | | SDL_SCANCODE_APP1 = 283, |
| | | SDL_SCANCODE_APP2 = 284, |
| | | |
| | | /*@}*//*Walther keys*/ |
| | | /* @} *//* Walther keys */ |
| | | |
| | | /* Add any other keys here. */ |
| | | |
| | |
| | | * Use proper C++ casts when compiled as C++ to be compatible with the option |
| | | * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #ifdef __cplusplus |
| | | #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) ((type)(expression)) |
| | | #define SDL_const_cast(type, expression) ((type)(expression)) |
| | | #endif |
| | | /*@}*//*Cast operators*/ |
| | | /* @} *//* Cast operators */ |
| | | |
| | | /* Define a four character code as a Uint32 */ |
| | | #define SDL_FOURCC(A, B, C, D) \ |
| | |
| | | /** |
| | | * \name Basic data types |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | typedef enum |
| | | { |
| | |
| | | */ |
| | | typedef uint64_t Uint64; |
| | | |
| | | /*@}*//*Basic data types*/ |
| | | /* @} *//* Basic data types */ |
| | | |
| | | |
| | | #define SDL_COMPILE_TIME_ASSERT(name, x) \ |
| | |
| | | #include "SDL_endian.h" |
| | | #include "SDL_error.h" |
| | | #include "SDL_events.h" |
| | | #include "SDL_filesystem.h" |
| | | #include "SDL_joystick.h" |
| | | #include "SDL_gamecontroller.h" |
| | | #include "SDL_haptic.h" |
| | |
| | | * These are the flags which may be passed to SDL_Init(). You should |
| | | * specify the subsystems which you will be using in your application. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_INIT_TIMER 0x00000001 |
| | | #define SDL_INIT_AUDIO 0x00000010 |
| | | #define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ |
| | |
| | | SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ |
| | | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ |
| | | ) |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * This function initializes the subsystems specified by \c flags |
| | |
| | | disable assertions. |
| | | */ |
| | | |
| | | #ifdef _MSC_VER /* stupid /W4 warnings. */ |
| | | #define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__) |
| | | #else |
| | | #define SDL_NULL_WHILE_LOOP_CONDITION (0) |
| | | #endif |
| | | |
| | | #define SDL_disabled_assert(condition) \ |
| | | do { (void) sizeof ((condition)); } while (0) |
| | | do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) |
| | | |
| | | typedef enum |
| | | { |
| | |
| | | } \ |
| | | break; /* not retrying. */ \ |
| | | } \ |
| | | } while (0) |
| | | } while (SDL_NULL_WHILE_LOOP_CONDITION) |
| | | |
| | | #endif /* enabled assertions support code */ |
| | | |
| | |
| | | # error Unknown assertion level. |
| | | #endif |
| | | |
| | | /* this assertion is never disabled at any level. */ |
| | | #define SDL_assert_always(condition) SDL_enabled_assert(condition) |
| | | |
| | | |
| | | typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( |
| | | const SDL_assert_data* data, void* userdata); |
| | |
| | | * The spin lock functions and type are required and can not be |
| | | * emulated because they are used in the atomic emulation code. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | typedef int SDL_SpinLock; |
| | | |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); |
| | | |
| | | /*@}*//*SDL AtomicLock*/ |
| | | /* @} *//* SDL AtomicLock */ |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * \name Audio flags |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | #define SDL_AUDIO_MASK_BITSIZE (0xFF) |
| | | #define SDL_AUDIO_MASK_DATATYPE (1<<8) |
| | |
| | | * |
| | | * Defaults to LSB byte order. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ |
| | | #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ |
| | | #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ |
| | |
| | | #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_U16 AUDIO_U16LSB |
| | | #define AUDIO_S16 AUDIO_S16LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name int32 support |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ |
| | | #define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_S32 AUDIO_S32LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name float32 support |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ |
| | | #define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ |
| | | #define AUDIO_F32 AUDIO_F32LSB |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Native audio byte ordering |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
| | | #define AUDIO_U16SYS AUDIO_U16LSB |
| | | #define AUDIO_S16SYS AUDIO_S16LSB |
| | |
| | | #define AUDIO_S32SYS AUDIO_S32MSB |
| | | #define AUDIO_F32SYS AUDIO_F32MSB |
| | | #endif |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Allow change flags |
| | | * |
| | | * Which audio format changes are allowed when opening a device. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 |
| | | #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 |
| | | #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 |
| | | #define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /*@}*//*Audio flags*/ |
| | | /* @} *//* Audio flags */ |
| | | |
| | | /** |
| | | * This function is called when the audio device needs more data. |
| | |
| | | * These functions return the list of built in audio drivers, in the |
| | | * order that they are normally initialized by default. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); |
| | | extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * \name Initialization and cleanup |
| | |
| | | * you have a specific need to specify the audio driver you want to |
| | | * use. You should normally use SDL_Init() or SDL_InitSubSystem(). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); |
| | | extern DECLSPEC void SDLCALL SDL_AudioQuit(void); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * This function returns the name of the current audio driver, or NULL |
| | |
| | | * |
| | | * Get the current audio state. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | typedef enum |
| | | { |
| | | SDL_AUDIO_STOPPED = 0, |
| | |
| | | |
| | | extern DECLSPEC SDL_AudioStatus SDLCALL |
| | | SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); |
| | | /*@}*//*Audio State*/ |
| | | /* @} *//* Audio State */ |
| | | |
| | | /** |
| | | * \name Pause audio functions |
| | |
| | | * data for your callback function after opening the audio device. |
| | | * Silence will be written to the audio device during the pause. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); |
| | | extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, |
| | | int pause_on); |
| | | /*@}*//*Pause audio functions*/ |
| | | /* @} *//* Pause audio functions */ |
| | | |
| | | /** |
| | | * This function loads a WAVE from the data source, automatically freeing |
| | |
| | | * the callback function is not running. Do not call these from the callback |
| | | * function or you will cause deadlock. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC void SDLCALL SDL_LockAudio(void); |
| | | extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); |
| | | extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); |
| | | extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); |
| | | /*@}*//*Audio lock functions*/ |
| | | /* @} *//* Audio lock functions */ |
| | | |
| | | /** |
| | | * This function shuts down audio processing and closes the audio device. |
| | |
| | | /* Enable system power support */ |
| | | #define SDL_POWER_MACOSX 1 |
| | | |
| | | /* enable filesystem support */ |
| | | #define SDL_FILESYSTEM_COCOA 1 |
| | | |
| | | /* Enable assembly routines */ |
| | | #define SDL_ASSEMBLY_ROUTINES 1 |
| | | #ifdef __ppc__ |
| | |
| | | */ |
| | | extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); |
| | | |
| | | /** |
| | | * This function returns the amount of RAM configured in the system, in MB. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | |
| | | /** |
| | | * \name The two types of endianness |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_LIL_ENDIAN 1234 |
| | | #define SDL_BIG_ENDIAN 4321 |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ |
| | | #ifdef __linux__ |
| | |
| | | * \name Swap to native |
| | | * Byteswap item from the specified endianness to the native endianness. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
| | | #define SDL_SwapLE16(X) (X) |
| | | #define SDL_SwapLE32(X) (X) |
| | |
| | | #define SDL_SwapBE64(X) (X) |
| | | #define SDL_SwapFloatBE(X) (X) |
| | | #endif |
| | | /*@}*//*Swap to native*/ |
| | | /* @} *//* Swap to native */ |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | |
| | | * \internal |
| | | * Private error reporting function - used internally. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) |
| | | #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) |
| | | #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) |
| | |
| | | } SDL_errorcode; |
| | | /* 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++ */ |
| | | #ifdef __cplusplus |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_PumpEvents(void); |
| | | |
| | | /*@{*/ |
| | | /* @{ */ |
| | | typedef enum |
| | | { |
| | | SDL_ADDEVENT, |
| | |
| | | extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, |
| | | SDL_eventaction action, |
| | | Uint32 minType, Uint32 maxType); |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * Checks to see if certain event types are in the event queue. |
| | |
| | | extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, |
| | | void *userdata); |
| | | |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_QUERY -1 |
| | | #define SDL_IGNORE 0 |
| | | #define SDL_DISABLE 0 |
| | |
| | | * current processing state of the specified event. |
| | | */ |
| | | extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); |
| | | /*@}*/ |
| | | /* @} */ |
| | | #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY) |
| | | |
| | | /** |
| New file |
| | |
| | | /* |
| | | 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_filesystem.h |
| | | * |
| | | * \brief Include file for filesystem SDL API functions |
| | | */ |
| | | |
| | | #ifndef _SDL_filesystem_h |
| | | #define _SDL_filesystem_h |
| | | |
| | | #include "SDL_stdinc.h" |
| | | |
| | | #include "begin_code.h" |
| | | |
| | | /* Set up for C function definitions, even when using C++ */ |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | /** |
| | | * \brief Get the path where the application resides. |
| | | * |
| | | * Get the "base path". This is the directory where the application was run |
| | | * from, which is probably the installation directory, and may or may not |
| | | * be the process's current working directory. |
| | | * |
| | | * This returns an absolute path in UTF-8 encoding, and is guaranteed to |
| | | * end with a path separator ('\\' on Windows, '/' most other places). |
| | | * |
| | | * The pointer returned by this function is owned by you. Please call |
| | | * SDL_free() on the pointer when you are done with it, or it will be a |
| | | * memory leak. This is not necessarily a fast call, though, so you should |
| | | * call this once near startup and save the string if you need it. |
| | | * |
| | | * Some platforms can't determine the application's path, and on other |
| | | * platforms, this might be meaningless. In such cases, this function will |
| | | * return NULL. |
| | | * |
| | | * \return String of base dir in UTF-8 encoding, or NULL on error. |
| | | * |
| | | * \sa SDL_GetPrefPath |
| | | */ |
| | | extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); |
| | | |
| | | /** |
| | | * \brief Get the user-and-app-specific path where files can be written. |
| | | * |
| | | * Get the "pref dir". This is meant to be where users can write personal |
| | | * files (preferences and save games, etc) that are specific to your |
| | | * application. This directory is unique per user, per application. |
| | | * |
| | | * This function will decide the appropriate location in the native filesystem, |
| | | * create the directory if necessary, and return a string of the absolute |
| | | * path to the directory in UTF-8 encoding. |
| | | * |
| | | * On Windows, the string might look like: |
| | | * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\" |
| | | * |
| | | * On Linux, the string might look like: |
| | | * "/home/bob/.local/share/My Program Name/" |
| | | * |
| | | * On Mac OS X, the string might look like: |
| | | * "/Users/bob/Library/Application Support/My Program Name/" |
| | | * |
| | | * (etc.) |
| | | * |
| | | * You specify the name of your organization (if it's not a real organization, |
| | | * your name or an Internet domain you own might do) and the name of your |
| | | * application. These should be untranslated proper names. |
| | | * |
| | | * Both the org and app strings may become part of a directory name, so |
| | | * please follow these rules: |
| | | * |
| | | * - Try to use the same org string (including case-sensitivity) for |
| | | * all your applications that use this function. |
| | | * - Always use a unique app string for each one, and make sure it never |
| | | * changes for an app once you've decided on it. |
| | | * - Unicode characters are legal, as long as it's UTF-8 encoded, but... |
| | | * - ...only use letters, numbers, and spaces. Avoid punctuation like |
| | | * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. |
| | | * |
| | | * This returns an absolute path in UTF-8 encoding, and is guaranteed to |
| | | * end with a path separator ('\\' on Windows, '/' most other places). |
| | | * |
| | | * The pointer returned by this function is owned by you. Please call |
| | | * SDL_free() on the pointer when you are done with it, or it will be a |
| | | * memory leak. This is not necessarily a fast call, though, so you should |
| | | * call this once near startup and save the string if you need it. |
| | | * |
| | | * You should assume the path returned by this function is the only safe |
| | | * place to write files (and that SDL_GetBasePath(), while it might be |
| | | * writable, or even the parent of the returned path, aren't where you |
| | | * should be writing things). |
| | | * |
| | | * Some platforms can't determine the pref path, and on other |
| | | * platforms, this might be meaningless. In such cases, this function will |
| | | * return NULL. |
| | | * |
| | | * \param org The name of your organization. |
| | | * \param app The name of your application. |
| | | * \return UTF-8 string of user dir in platform-dependent notation. NULL |
| | | * if there's a problem (creating directory failed, etc). |
| | | * |
| | | * \sa SDL_GetBasePath |
| | | */ |
| | | extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | | } |
| | | #endif |
| | | #include "close_code.h" |
| | | |
| | | #endif /* _SDL_system_h */ |
| | | |
| | | /* vi: set ts=4 sw=4 expandtab: */ |
| | |
| | | * |
| | | * Different haptic features a device can have. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \name Haptic effects |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \brief Constant effect supported. |
| | |
| | | #define SDL_HAPTIC_LEFTRIGHT (1<<2) |
| | | |
| | | /* !!! FIXME: put this back when we have more bits in 2.1 */ |
| | | /*#define SDL_HAPTIC_SQUARE (1<<2)*/ |
| | | /* #define SDL_HAPTIC_SQUARE (1<<2) */ |
| | | |
| | | /** |
| | | * \brief Triangle wave effect supported. |
| | |
| | | */ |
| | | #define SDL_HAPTIC_CUSTOM (1<<11) |
| | | |
| | | /*@}*//*Haptic effects*/ |
| | | /* @} *//* Haptic effects */ |
| | | |
| | | /* These last few are features the device has, not effects */ |
| | | |
| | |
| | | /** |
| | | * \name Direction encodings |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \brief Uses polar coordinates for the direction. |
| | |
| | | */ |
| | | #define SDL_HAPTIC_SPHERICAL 2 |
| | | |
| | | /*@}*//*Direction encodings*/ |
| | | /* @} *//* Direction encodings */ |
| | | |
| | | /*@}*//*Haptic features*/ |
| | | /* @} *//* Haptic features */ |
| | | |
| | | /* |
| | | * Misc defines. |
| | |
| | | #define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * "0" - Thread-safety is not enabled (faster) |
| | | * "1" - Thread-safety is enabled |
| | | * |
| | | * By default the Direct3D device is created with thread-safety disabled. |
| | | */ |
| | | #define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" |
| | | |
| | | /** |
| | | * \brief A variable controlling the scaling quality |
| | | * |
| | | * This variable can be set to the following values: |
| | |
| | | #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" |
| | | |
| | | |
| | | /** |
| | | * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac) |
| | | */ |
| | | #define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" |
| | | |
| | | |
| | | /** |
| | | * \brief An enumeration of hint priorities |
| | |
| | | /** |
| | | * \name Hat positions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_HAT_CENTERED 0x00 |
| | | #define SDL_HAT_UP 0x01 |
| | | #define SDL_HAT_RIGHT 0x02 |
| | |
| | | #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) |
| | | #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) |
| | | #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** |
| | | * Get the current state of a POV hat on a joystick. |
| | |
| | | /** |
| | | * \name Mutex functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /* The SDL mutex structure, defined in SDL_sysmutex.c */ |
| | | struct SDL_mutex; |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); |
| | | |
| | | /*@}*//*Mutex functions*/ |
| | | /* @} *//* Mutex functions */ |
| | | |
| | | |
| | | /** |
| | | * \name Semaphore functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /* The SDL semaphore structure, defined in SDL_syssem.c */ |
| | | struct SDL_semaphore; |
| | |
| | | */ |
| | | extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); |
| | | |
| | | /*@}*//*Semaphore functions*/ |
| | | /* @} *//* Semaphore functions */ |
| | | |
| | | |
| | | /** |
| | | * \name Condition variable functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /* The SDL condition variable structure, defined in SDL_syscond.c */ |
| | | struct SDL_cond; |
| | |
| | | extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, |
| | | SDL_mutex * mutex, Uint32 ms); |
| | | |
| | | /*@}*//*Condition variable functions*/ |
| | | /* @} *//* Condition variable functions */ |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | |
| | | * |
| | | * These define alpha as the opacity of a surface. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_ALPHA_OPAQUE 255 |
| | | #define SDL_ALPHA_TRANSPARENT 0 |
| | | /*@}*/ |
| | | /* @} */ |
| | | |
| | | /** Pixel type. */ |
| | | enum |
| | |
| | | #endif |
| | | #if defined(ANDROID) |
| | | #undef __ANDROID__ |
| | | #undef __LINUX__ /*do we need to do this?*/ |
| | | #undef __LINUX__ /* do we need to do this? */ |
| | | #define __ANDROID__ 1 |
| | | #endif |
| | | |
| | |
| | | #define __SOLARIS__ 1 |
| | | #endif |
| | | #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) |
| | | #undef __WINDOWS__ |
| | | #define __WINDOWS__ 1 |
| | | #endif |
| | | #if defined(__WINDOWS__) |
| | | #undef __WIN32__ |
| | | #define __WIN32__ 1 |
| | | #define __WIN32__ 1 |
| | | #endif |
| | | #if defined(__PSP__) |
| | | #undef __PSP__ |
| | |
| | | * |
| | | * \sa SDL_EnclosePoints |
| | | */ |
| | | typedef struct |
| | | typedef struct SDL_Point |
| | | { |
| | | int x; |
| | | int y; |
| | |
| | | const void *pixels, int pitch); |
| | | |
| | | /** |
| | | * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data. |
| | | * |
| | | * \param texture The texture to update |
| | | * \param rect A pointer to the rectangle of pixels to update, or NULL to |
| | | * update the entire texture. |
| | | * \param Yplane The raw pixel data for the Y plane. |
| | | * \param Ypitch The number of bytes between rows of pixel data for the Y plane. |
| | | * \param Uplane The raw pixel data for the U plane. |
| | | * \param Upitch The number of bytes between rows of pixel data for the U plane. |
| | | * \param Vplane The raw pixel data for the V plane. |
| | | * \param Vpitch The number of bytes between rows of pixel data for the V plane. |
| | | * |
| | | * \return 0 on success, or -1 if the texture is not valid. |
| | | * |
| | | * \note You can use SDL_UpdateTexture() as long as your pixel data is |
| | | * a contiguous block of Y and U/V planes in the proper order, but |
| | | * this function is available if your pixel data is not contiguous. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture, |
| | | const SDL_Rect * rect, |
| | | const Uint8 *Yplane, int Ypitch, |
| | | const Uint8 *Uplane, int Upitch, |
| | | const Uint8 *Vplane, int Vpitch); |
| | | |
| | | /** |
| | | * \brief Lock a portion of the texture for write-only pixel access. |
| | | * |
| | | * \param texture The texture to lock for access, which was created with |
| | |
| | | * |
| | | * Functions to create SDL_RWops structures from various data streams. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, |
| | | const char *mode); |
| | |
| | | extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, |
| | | int size); |
| | | |
| | | /*@}*//*RWFrom functions*/ |
| | | /* @} *//* RWFrom functions */ |
| | | |
| | | |
| | | extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); |
| | |
| | | * |
| | | * Macros to easily read and write from an SDL_RWops structure. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_RWsize(ctx) (ctx)->size(ctx) |
| | | #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) |
| | | #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) |
| | | #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) |
| | | #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) |
| | | #define SDL_RWclose(ctx) (ctx)->close(ctx) |
| | | /*@}*//*Read/write macros*/ |
| | | /* @} *//* Read/write macros */ |
| | | |
| | | |
| | | /** |
| | |
| | | * |
| | | * Read an item of the specified endianness and return in native format. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); |
| | | extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); |
| | | extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); |
| | |
| | | extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); |
| | | extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); |
| | | extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); |
| | | /*@}*//*Read endian functions*/ |
| | | /* @} *//* Read endian functions */ |
| | | |
| | | /** |
| | | * \name Write endian functions |
| | | * |
| | | * Write an item of native format to the specified endianness. |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); |
| | |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); |
| | | extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); |
| | | /*@}*//*Write endian functions*/ |
| | | /* @} *//* Write endian functions */ |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | |
| | | * |
| | | * These values are from usage page 0x07 (USB keyboard page). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | SDL_SCANCODE_A = 4, |
| | | SDL_SCANCODE_B = 5, |
| | |
| | | * special KMOD_MODE for it I'm adding it here |
| | | */ |
| | | |
| | | /*@}*//*Usage page 0x07*/ |
| | | /* @} *//* Usage page 0x07 */ |
| | | |
| | | /** |
| | | * \name Usage page 0x0C |
| | | * |
| | | * These values are mapped from usage page 0x0C (USB consumer page). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | SDL_SCANCODE_AUDIONEXT = 258, |
| | | SDL_SCANCODE_AUDIOPREV = 259, |
| | |
| | | SDL_SCANCODE_AC_REFRESH = 273, |
| | | SDL_SCANCODE_AC_BOOKMARKS = 274, |
| | | |
| | | /*@}*//*Usage page 0x0C*/ |
| | | /* @} *//* Usage page 0x0C */ |
| | | |
| | | /** |
| | | * \name Walther keys |
| | | * |
| | | * These are values that Christian Walther added (for mac keyboard?). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | SDL_SCANCODE_BRIGHTNESSDOWN = 275, |
| | | SDL_SCANCODE_BRIGHTNESSUP = 276, |
| | |
| | | SDL_SCANCODE_APP1 = 283, |
| | | SDL_SCANCODE_APP2 = 284, |
| | | |
| | | /*@}*//*Walther keys*/ |
| | | /* @} *//* Walther keys */ |
| | | |
| | | /* Add any other keys here. */ |
| | | |
| | |
| | | * Use proper C++ casts when compiled as C++ to be compatible with the option |
| | | * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #ifdef __cplusplus |
| | | #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) ((type)(expression)) |
| | | #define SDL_const_cast(type, expression) ((type)(expression)) |
| | | #endif |
| | | /*@}*//*Cast operators*/ |
| | | /* @} *//* Cast operators */ |
| | | |
| | | /* Define a four character code as a Uint32 */ |
| | | #define SDL_FOURCC(A, B, C, D) \ |
| | |
| | | /** |
| | | * \name Basic data types |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | typedef enum |
| | | { |
| | |
| | | */ |
| | | typedef uint64_t Uint64; |
| | | |
| | | /*@}*//*Basic data types*/ |
| | | /* @} *//* Basic data types */ |
| | | |
| | | |
| | | #define SDL_COMPILE_TIME_ASSERT(name, x) \ |
| | |
| | | * \internal |
| | | * Used internally (read-only). |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | #define SDL_SWSURFACE 0 /**< Just here for compatibility */ |
| | | #define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ |
| | | #define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ |
| | | #define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ |
| | | /*@}*//*Surface flags*/ |
| | | /* @} *//* Surface flags */ |
| | | |
| | | /** |
| | | * Evaluates to true if the surface needs to be locked before access. |
| | |
| | | * surface. |
| | | */ |
| | | extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface |
| | | (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags); |
| | | (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags); |
| | | extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat |
| | | (SDL_Surface * src, Uint32 pixel_format, Uint32 flags); |
| | | |
| | |
| | | #define _SDL_system_h |
| | | |
| | | #include "SDL_stdinc.h" |
| | | |
| | | #if defined(__IPHONEOS__) && __IPHONEOS__ |
| | | #include "SDL_video.h" |
| | | #include "SDL_keyboard.h" |
| | | #endif |
| | | #include "SDL_render.h" |
| | | #include "SDL_video.h" |
| | | |
| | | #include "begin_code.h" |
| | | /* Set up for C function definitions, even when using C++ */ |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | |
| | | /* Platform specific functions for Windows */ |
| | | #ifdef __WIN32__ |
| | | |
| | | /* Returns the D3D9 adapter index that matches the specified display index. |
| | | This adapter index can be passed to IDirect3D9::CreateDevice and controls |
| | | on which monitor a full screen application will appear. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); |
| | | |
| | | /* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. |
| | | Once you are done using the device, you should release it to avoid a resource leak. |
| | | */ |
| | | typedef struct IDirect3DDevice9 IDirect3DDevice9; |
| | | extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); |
| | | |
| | | #endif /* __WIN32__ */ |
| | | |
| | | |
| | | /* Platform specific functions for iOS */ |
| | | #if defined(__IPHONEOS__) && __IPHONEOS__ |
| | |
| | | extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); |
| | | |
| | | #endif /* __ANDROID__ */ |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | |
| | | extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); |
| | | |
| | | /** |
| | | * \brief Compare SDL ticks values, and return true if A has passed B |
| | | * |
| | | * e.g. if you want to wait 100 ms, you could do this: |
| | | * Uint32 timeout = SDL_GetTicks() + 100; |
| | | * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { |
| | | * ... do work until timeout has elapsed |
| | | * } |
| | | */ |
| | | #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) |
| | | |
| | | /** |
| | | * \brief Get the current value of the high resolution counter |
| | | */ |
| | | extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); |
| | |
| | | */ |
| | | #define SDL_MAJOR_VERSION 2 |
| | | #define SDL_MINOR_VERSION 0 |
| | | #define SDL_PATCHLEVEL 0 |
| | | #define SDL_PATCHLEVEL 1 |
| | | |
| | | /** |
| | | * \brief Macro to determine SDL version program was compiled against. |
| | |
| | | SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ |
| | | SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ |
| | | SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), |
| | | SDL_WINDOW_FOREIGN = 0x00000800 /**< window not created by SDL */ |
| | | SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ |
| | | SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /**< window should be created in high-DPI mode if supported */ |
| | | } SDL_WindowFlags; |
| | | |
| | | /** |
| | |
| | | SDL_GL_CONTEXT_EGL, |
| | | SDL_GL_CONTEXT_FLAGS, |
| | | SDL_GL_CONTEXT_PROFILE_MASK, |
| | | SDL_GL_SHARE_WITH_CURRENT_CONTEXT |
| | | SDL_GL_SHARE_WITH_CURRENT_CONTEXT, |
| | | SDL_GL_FRAMEBUFFER_SRGB_CAPABLE |
| | | } SDL_GLattr; |
| | | |
| | | typedef enum |
| | |
| | | * \param w The width of the window. |
| | | * \param h The height of the window. |
| | | * \param flags The flags for the window, a mask of any of the following: |
| | | * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, |
| | | * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, |
| | | * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, |
| | | * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED. |
| | | * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, |
| | | * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, |
| | | * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, |
| | | * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, |
| | | * ::SDL_WINDOW_ALLOW_HIGHDPI. |
| | | * |
| | | * \return The id of the window created, or zero if window creation failed. |
| | | * |
| | |
| | | /** |
| | | * \name OpenGL support functions |
| | | */ |
| | | /*@{*/ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \brief Dynamically load an OpenGL library. |
| | |
| | | extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); |
| | | |
| | | /** |
| | | * \brief Get the size of a window's underlying drawable (for use with glViewport). |
| | | * |
| | | * \param window Window from which the drawable size should be queried |
| | | * \param w Pointer to variable for storing the width, may be NULL |
| | | * \param h Pointer to variable for storing the height, may be NULL |
| | | * |
| | | * This may differ from SDL_GetWindowSize if we're rendering to a high-DPI |
| | | * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a |
| | | * platform with high-DPI support (Apple calls this "Retina"), and not disabled |
| | | * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. |
| | | * |
| | | * \sa SDL_GetWindowSize() |
| | | * \sa SDL_CreateWindow() |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, |
| | | int *h); |
| | | |
| | | /** |
| | | * \brief Set the swap interval for the current OpenGL context. |
| | | * |
| | | * \param interval 0 for immediate updates, 1 for updates synchronized with the |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); |
| | | |
| | | /*@}*//*OpenGL support functions*/ |
| | | /* @} *//* OpenGL support functions */ |
| | | |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | |
| | | #endif |
| | | #define _begin_code_h |
| | | |
| | | #ifndef SDL_DEPRECATED |
| | | # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ |
| | | # define SDL_DEPRECATED __attribute__((deprecated)) |
| | | # else |
| | | # define SDL_DEPRECATED |
| | | # endif |
| | | #endif |
| | | |
| | | /* Some compilers use a special export keyword */ |
| | | #ifndef DECLSPEC |
| | | # if defined(__WIN32__) |
| | |
| | | #endif |
| | | #endif /* Compiler needs structure packing set */ |
| | | |
| | | /* Set up compiler-specific options for inlining functions */ |
| | | #ifndef SDL_INLINE_OKAY |
| | | #ifdef __GNUC__ |
| | | #define SDL_INLINE_OKAY |
| | | #else |
| | | /* Add any special compiler-specific cases here */ |
| | | #if defined(_MSC_VER) || defined(__BORLANDC__) || \ |
| | | defined(__DMC__) || defined(__SC__) || \ |
| | | defined(__WATCOMC__) || defined(__LCC__) || \ |
| | | defined(__DECC) |
| | | #ifndef SDL_INLINE |
| | | #if defined(__GNUC__) |
| | | #define SDL_INLINE __inline__ |
| | | #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ |
| | | defined(__DMC__) || defined(__SC__) || \ |
| | | defined(__WATCOMC__) || defined(__LCC__) || \ |
| | | defined(__DECC) |
| | | #define SDL_INLINE __inline |
| | | #ifndef __inline__ |
| | | #define __inline__ __inline |
| | | #define __inline__ __inline |
| | | #endif |
| | | #define SDL_INLINE_OKAY |
| | | #else |
| | | #if !defined(__MRC__) && !defined(_SGI_SOURCE) |
| | | #define SDL_INLINE inline |
| | | #ifndef __inline__ |
| | | #define __inline__ inline |
| | | #endif |
| | | #define SDL_INLINE_OKAY |
| | | #endif /* Not a funky compiler */ |
| | | #endif /* Visual C++ */ |
| | | #endif /* GNU C */ |
| | | #endif /* SDL_INLINE_OKAY */ |
| | | |
| | | /* If inlining isn't supported, remove "__inline__", turning static |
| | | inlined functions into static functions (resulting in code bloat |
| | | in all files which include the offending header files) |
| | | */ |
| | | #ifndef SDL_INLINE_OKAY |
| | | #define __inline__ |
| | | #endif |
| | | #endif /* SDL_INLINE not defined */ |
| | | |
| | | #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 |
| | | #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ |
| | | #else |
| | | #define SDL_FORCE_INLINE static __inline__ |
| | | #define SDL_FORCE_INLINE static SDL_INLINE |
| | | #endif |
| | | #endif |
| | | #endif /* SDL_FORCE_INLINE not defined */ |
| | | |
| | | /* Apparently this is needed by several Windows compilers */ |
| | | #if !defined(__MACH__) |
| | |
| | | <key>CFBundlePackageType</key> |
| | | <string>FMWK</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>2.0.0</string> |
| | | <string>2.0.1</string> |
| | | <key>CFBundleSignature</key> |
| | | <string>SDLX</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>2.0.0</string> |
| | | <string>2.0.1</string> |
| | | <key>DTCompiler</key> |
| | | <string></string> |
| | | <key>DTPlatformBuild</key> |