bump mac library to 2.0.12
61 files modified
2 files added
| | |
| | | ## CMake Support |
| | | |
| | | Included is a CMake config script for use with find_package(SDL2 CONFIG). Simply append the SDL2 path to the CMAKE_PREFIX_PATH |
| | | list(APPEND CMAKE_PREFIX_PATH ../prebuilt/SDL2) |
| | | list(APPEND CMAKE_PREFIX_PATH libs/SDL2) |
| | | find_package(SDL2 CONFIG) |
| | | |
| | | This will set the following variables |
| | |
| | | if(NOT TARGET SDL2 AND CMAKE_VERSION VERSION_GREATER 3.0.0) |
| | | add_library(SDL2 INTERFACE) |
| | | target_link_libraries(SDL2 INTERFACE ${SDL2_LIBRARIES}) |
| | | target_include_directories(SDL2 INTERFACE ${SDL2_INCLUDE_DIRS}) |
| | | target_include_directories(SDL2 INTERFACE SYSTEM ${SDL2_INCLUDE_DIRS}) |
| | | endif() |
| | |
| | | set(PACKAGE_VERSION "2.0.9") |
| | | set(PACKAGE_VERSION "2.0.12") |
| | | |
| | | # Check whether the requested PACKAGE_FIND_VERSION is compatible |
| | | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #include "SDL_loadso.h" |
| | | #include "SDL_log.h" |
| | | #include "SDL_messagebox.h" |
| | | #include "SDL_metal.h" |
| | | #include "SDL_mutex.h" |
| | | #include "SDL_power.h" |
| | | #include "SDL_render.h" |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") |
| | | #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "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__) |
| | | #if 0 /* defined(__LINUX__) || defined(__ANDROID__) */ |
| | | /* Information from: |
| | | https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19 |
| | | |
| | | The Linux kernel provides a helper function which provides the right code for a memory barrier, |
| | | hard-coded at address 0xffff0fa0 |
| | | */ |
| | | typedef void (*SDL_KernelMemoryBarrierFunc)(); |
| | | #define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() |
| | | #define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() |
| | | #elif 0 /* defined(__QNXNTO__) */ |
| | | #include <sys/cpuinline.h> |
| | | |
| | | #define SDL_MemoryBarrierRelease() __cpu_membarrier() |
| | | #define SDL_MemoryBarrierAcquire() __cpu_membarrier() |
| | | #else |
| | | #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__) || defined(__ARM_ARCH_8A__) |
| | | #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__) || defined(__ARM_ARCH_5TE__) |
| | | #ifdef __thumb__ |
| | | /* The mcr instruction isn't available in thumb mode, use real functions */ |
| | | #define SDL_MEMORY_BARRIER_USES_FUNCTION |
| | | #define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() |
| | | #define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() |
| | | #else |
| | |
| | | #else |
| | | #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") |
| | | #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") |
| | | #endif /* __LINUX__ || __ANDROID__ */ |
| | | #endif /* __GNUC__ && __arm__ */ |
| | | #else |
| | | #if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* @} *//* Pause audio functions */ |
| | | |
| | | /** |
| | | * This function loads a WAVE from the data source, automatically freeing |
| | | * that source if \c freesrc is non-zero. For example, to load a WAVE file, |
| | | * you could do: |
| | | * \brief Load the audio data of a WAVE file into memory |
| | | * |
| | | * Loading a WAVE file requires \c src, \c spec, \c audio_buf and \c audio_len |
| | | * to be valid pointers. The entire data portion of the file is then loaded |
| | | * into memory and decoded if necessary. |
| | | * |
| | | * If \c freesrc is non-zero, the data source gets automatically closed and |
| | | * freed before the function returns. |
| | | * |
| | | * Supported are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits), |
| | | * IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and |
| | | * µ-law (8 bits). Other formats are currently unsupported and cause an error. |
| | | * |
| | | * If this function succeeds, the pointer returned by it is equal to \c spec |
| | | * and the pointer to the audio data allocated by the function is written to |
| | | * \c audio_buf and its length in bytes to \c audio_len. The \ref SDL_AudioSpec |
| | | * members \c freq, \c channels, and \c format are set to the values of the |
| | | * audio data in the buffer. The \c samples member is set to a sane default and |
| | | * all others are set to zero. |
| | | * |
| | | * It's necessary to use SDL_FreeWAV() to free the audio data returned in |
| | | * \c audio_buf when it is no longer used. |
| | | * |
| | | * Because of the underspecification of the Waveform format, there are many |
| | | * problematic files in the wild that cause issues with strict decoders. To |
| | | * provide compatibility with these files, this decoder is lenient in regards |
| | | * to the truncation of the file, the fact chunk, and the size of the RIFF |
| | | * chunk. The hints SDL_HINT_WAVE_RIFF_CHUNK_SIZE, SDL_HINT_WAVE_TRUNCATION, |
| | | * and SDL_HINT_WAVE_FACT_CHUNK can be used to tune the behavior of the |
| | | * loading process. |
| | | * |
| | | * Any file that is invalid (due to truncation, corruption, or wrong values in |
| | | * the headers), too big, or unsupported causes an error. Additionally, any |
| | | * critical I/O error from the data source will terminate the loading process |
| | | * with an error. The function returns NULL on error and in all cases (with the |
| | | * exception of \c src being NULL), an appropriate error message will be set. |
| | | * |
| | | * It is required that the data source supports seeking. |
| | | * |
| | | * Example: |
| | | * \code |
| | | * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); |
| | | * \endcode |
| | | * |
| | | * If this function succeeds, it returns the given SDL_AudioSpec, |
| | | * filled with the audio data format of the wave data, and sets |
| | | * \c *audio_buf to a malloc()'d buffer containing the audio data, |
| | | * and sets \c *audio_len to the length of that audio buffer, in bytes. |
| | | * You need to free the audio buffer with SDL_FreeWAV() when you are |
| | | * done with it. |
| | | * |
| | | * This function returns NULL and sets the SDL error message if the |
| | | * wave file cannot be opened, uses an unknown data format, or is |
| | | * corrupt. Currently raw and MS-ADPCM WAVE files are supported. |
| | | * \param src The data source with the WAVE data |
| | | * \param freesrc A integer value that makes the function close the data source if non-zero |
| | | * \param spec A pointer filled with the audio format of the audio data |
| | | * \param audio_buf A pointer filled with the audio data allocated by the function |
| | | * \param audio_len A pointer filled with the length of the audio data buffer in bytes |
| | | * \return NULL on error, or non-NULL on success. |
| | | */ |
| | | extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, |
| | | int freesrc, |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #endif |
| | | } |
| | | |
| | | SDL_FORCE_INLINE SDL_bool |
| | | SDL_HasExactlyOneBitSet32(Uint32 x) |
| | | { |
| | | if (x && !(x & (x - 1))) { |
| | | return SDL_TRUE; |
| | | } |
| | | return SDL_FALSE; |
| | | } |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate |
| | | dstRGB = srcRGB * dstRGB |
| | | dstA = dstA */ |
| | | SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply |
| | | dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) |
| | | dstA = (srcA * dstA) + (dstA * (1-srcA)) */ |
| | | SDL_BLENDMODE_INVALID = 0x7FFFFFFF |
| | | |
| | | /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ |
| | |
| | | /** |
| | | * \brief Create a custom blend mode, which may or may not be supported by a given renderer |
| | | * |
| | | * \param srcColorFactor |
| | | * \param dstColorFactor |
| | | * \param colorOperation |
| | | * \param srcAlphaFactor |
| | | * \param dstAlphaFactor |
| | | * \param alphaOperation |
| | | * \param srcColorFactor source color factor |
| | | * \param dstColorFactor destination color factor |
| | | * \param colorOperation color operation |
| | | * \param srcAlphaFactor source alpha factor |
| | | * \param dstAlphaFactor destination alpha factor |
| | | * \param alphaOperation alpha operation |
| | | * |
| | | * The result of the blend mode operation will be: |
| | | * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #define HAVE_STRCHR 1 |
| | | #define HAVE_STRRCHR 1 |
| | | #define HAVE_STRSTR 1 |
| | | #define HAVE_STRTOK_R 1 |
| | | #define HAVE_STRTOL 1 |
| | | #define HAVE_STRTOUL 1 |
| | | #define HAVE_STRTOLL 1 |
| | |
| | | #define HAVE_SYSCONF 1 |
| | | #define HAVE_SYSCTLBYNAME 1 |
| | | |
| | | #define HAVE_GCC_ATOMICS 1 |
| | | |
| | | /* Enable various audio drivers */ |
| | | #define SDL_AUDIO_DRIVER_COREAUDIO 1 |
| | | #define SDL_AUDIO_DRIVER_DISK 1 |
| | |
| | | #define SDL_VIDEO_DRIVER_COCOA 1 |
| | | #define SDL_VIDEO_DRIVER_DUMMY 1 |
| | | #undef SDL_VIDEO_DRIVER_X11 |
| | | #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_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib" |
| | | #define SDL_VIDEO_DRIVER_X11_XDBE 1 |
| | | #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 |
| | | #define SDL_VIDEO_DRIVER_X11_XRANDR 1 |
| | |
| | | #define SDL_VIDEO_RENDER_OGL_ES2 1 |
| | | #endif |
| | | |
| | | #ifndef SDL_VIDEO_RENDER_METAL |
| | | /* Metal only supported on 64-bit architectures with 10.11+ */ |
| | | #if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) |
| | | #define SDL_PLATFORM_SUPPORTS_METAL 1 |
| | | #else |
| | | #define SDL_PLATFORM_SUPPORTS_METAL 0 |
| | | #endif |
| | | |
| | | #ifndef SDL_VIDEO_RENDER_METAL |
| | | #if SDL_PLATFORM_SUPPORTS_METAL |
| | | #define SDL_VIDEO_RENDER_METAL 1 |
| | | #else |
| | | #define SDL_VIDEO_RENDER_METAL 0 |
| | |
| | | #define SDL_VIDEO_OPENGL_GLX 1 |
| | | #endif |
| | | |
| | | /* Enable Vulkan support */ |
| | | /* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ |
| | | #if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) |
| | | /* Enable Vulkan and Metal support */ |
| | | #ifndef SDL_VIDEO_VULKAN |
| | | #if SDL_PLATFORM_SUPPORTS_METAL |
| | | #define SDL_VIDEO_VULKAN 1 |
| | | #else |
| | | #define SDL_VIDEO_VULKAN 0 |
| | | #endif |
| | | #endif |
| | | |
| | | #ifndef SDL_VIDEO_METAL |
| | | #if SDL_PLATFORM_SUPPORTS_METAL |
| | | #define SDL_VIDEO_METAL 1 |
| | | #else |
| | | #define SDL_VIDEO_METAL 0 |
| | | #endif |
| | | #endif |
| | | |
| | | /* Enable system power support */ |
| | | #define SDL_POWER_MACOSX 1 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #else |
| | | #include <intrin.h> |
| | | #ifndef _WIN64 |
| | | #ifndef __MMX__ |
| | | #define __MMX__ |
| | | #endif |
| | | #ifndef __3dNOW__ |
| | | #define __3dNOW__ |
| | | #endif |
| | | #endif |
| | | #ifndef __SSE__ |
| | | #define __SSE__ |
| | | #endif |
| | | #ifndef __SSE2__ |
| | | #define __SSE2__ |
| | | #endif |
| | | #endif /* __clang__ */ |
| | | #elif defined(__MINGW64_VERSION_MAJOR) |
| | | #include <intrin.h> |
| | | #else |
| | | #ifdef __ALTIVEC__ |
| | | #if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) |
| | | /* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */ |
| | | #if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H) |
| | | #include <altivec.h> |
| | | #undef pixel |
| | | #undef bool |
| | | #endif |
| | | #endif |
| | | #if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H) |
| | | #include <arm_neon.h> |
| | | #if !defined(SDL_DISABLE_ARM_NEON_H) |
| | | # if defined(__ARM_NEON) |
| | | # include <arm_neon.h> |
| | | # elif defined(__WINDOWS__) || defined(__WINRT__) |
| | | /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */ |
| | | # if defined(_M_ARM) |
| | | # include <armintr.h> |
| | | # include <arm_neon.h> |
| | | # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ |
| | | # endif |
| | | # if defined (_M_ARM64) |
| | | # include <arm64intr.h> |
| | | # include <arm64_neon.h> |
| | | # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ |
| | | # endif |
| | | # endif |
| | | #endif |
| | | #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) |
| | | #include <mm3dnow.h> |
| | |
| | | extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); |
| | | |
| | | /** |
| | | * This function returns true if the CPU has ARM SIMD (ARMv6) features. |
| | | */ |
| | | extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); |
| | | |
| | | /** |
| | | * This function returns true if the CPU has NEON (ARM SIMD) features. |
| | | */ |
| | | extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); |
| | |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); |
| | | |
| | | /** |
| | | * \brief Report the alignment this system needs for SIMD allocations. |
| | | * |
| | | * This will return the minimum number of bytes to which a pointer must be |
| | | * aligned to be compatible with SIMD instructions on the current machine. |
| | | * For example, if the machine supports SSE only, it will return 16, but if |
| | | * it supports AVX-512F, it'll return 64 (etc). This only reports values for |
| | | * instruction sets SDL knows about, so if your SDL build doesn't have |
| | | * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and |
| | | * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. |
| | | * Plan accordingly. |
| | | */ |
| | | extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); |
| | | |
| | | /** |
| | | * \brief Allocate memory in a SIMD-friendly way. |
| | | * |
| | | * This will allocate a block of memory that is suitable for use with SIMD |
| | | * instructions. Specifically, it will be properly aligned and padded for |
| | | * the system's supported vector instructions. |
| | | * |
| | | * The memory returned will be padded such that it is safe to read or write |
| | | * an incomplete vector at the end of the memory block. This can be useful |
| | | * so you don't have to drop back to a scalar fallback at the end of your |
| | | * SIMD processing loop to deal with the final elements without overflowing |
| | | * the allocated buffer. |
| | | * |
| | | * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() |
| | | * or delete[], etc. |
| | | * |
| | | * Note that SDL will only deal with SIMD instruction sets it is aware of; |
| | | * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors |
| | | * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't |
| | | * know that AVX-512 wants 64. To be clear: if you can't decide to use an |
| | | * instruction set with an SDL_Has*() function, don't use that instruction |
| | | * set with memory allocated through here. |
| | | * |
| | | * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't |
| | | * out of memory. |
| | | * |
| | | * \param len The length, in bytes, of the block to allocated. The actual |
| | | * allocated block might be larger due to padding, etc. |
| | | * \return Pointer to newly-allocated block, NULL if out of memory. |
| | | * |
| | | * \sa SDL_SIMDAlignment |
| | | * \sa SDL_SIMDFree |
| | | */ |
| | | extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); |
| | | |
| | | /** |
| | | * \brief Deallocate memory obtained from SDL_SIMDAlloc |
| | | * |
| | | * It is not valid to use this function on a pointer from anything but |
| | | * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, |
| | | * SDL_malloc, memalign, new[], etc. |
| | | * |
| | | * However, SDL_SIMDFree(NULL) is a legal no-op. |
| | | * |
| | | * \sa SDL_SIMDAlloc |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr); |
| | | |
| | | /* vi: set ts=4 sw=4 expandtab: */ |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #ifndef WIN32_LEAN_AND_MEAN |
| | | #define WIN32_LEAN_AND_MEAN 1 |
| | | #endif |
| | | #ifndef NOMINMAX /* don't define min() and max(). */ |
| | | #define NOMINMAX |
| | | #endif |
| | | #include <windows.h> |
| | | |
| | | #if __WINRT__ |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #ifdef __linux__ |
| | | #include <endian.h> |
| | | #define SDL_BYTEORDER __BYTE_ORDER |
| | | #else /* __linux__ */ |
| | | #elif defined(__OpenBSD__) |
| | | #include <endian.h> |
| | | #define SDL_BYTEORDER BYTE_ORDER |
| | | #else |
| | | #if defined(__hppa__) || \ |
| | | defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ |
| | | (defined(__MIPS__) && defined(__MISPEB__)) || \ |
| | | (defined(__MIPS__) && defined(__MIPSEB__)) || \ |
| | | defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ |
| | | defined(__sparc__) |
| | | #define SDL_BYTEORDER SDL_BIG_ENDIAN |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | float dx; /**< Normalized in the range -1...1 */ |
| | | float dy; /**< Normalized in the range -1...1 */ |
| | | float pressure; /**< Normalized in the range 0...1 */ |
| | | Uint32 windowID; /**< The window underneath the finger, if any */ |
| | | } SDL_TouchFingerEvent; |
| | | |
| | | |
| | |
| | | { |
| | | Uint32 type; /**< Event type, shared with all events */ |
| | | SDL_CommonEvent common; /**< Common event data */ |
| | | SDL_DisplayEvent display; /**< Window event data */ |
| | | SDL_DisplayEvent display; /**< Display event data */ |
| | | SDL_WindowEvent window; /**< Window event data */ |
| | | SDL_KeyboardEvent key; /**< Keyboard event data */ |
| | | SDL_TextEditingEvent edit; /**< Text editing event data */ |
| | |
| | | Uint8 padding[56]; |
| | | } SDL_Event; |
| | | |
| | | /* Make sure we haven't broken binary compatibility */ |
| | | SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56); |
| | | |
| | | |
| | | /* Function prototypes */ |
| | | |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | struct _SDL_GameController; |
| | | typedef struct _SDL_GameController SDL_GameController; |
| | | |
| | | typedef enum |
| | | { |
| | | SDL_CONTROLLER_TYPE_UNKNOWN = 0, |
| | | SDL_CONTROLLER_TYPE_XBOX360, |
| | | SDL_CONTROLLER_TYPE_XBOXONE, |
| | | SDL_CONTROLLER_TYPE_PS3, |
| | | SDL_CONTROLLER_TYPE_PS4, |
| | | SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO |
| | | } SDL_GameControllerType; |
| | | |
| | | typedef enum |
| | | { |
| | |
| | | extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); |
| | | |
| | | /** |
| | | * Get the type of a game controller. |
| | | * This can be called before any controllers are opened. |
| | | */ |
| | | extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index); |
| | | |
| | | /** |
| | | * Get the mapping of a game controller. |
| | | * This can be called before any controllers are opened. |
| | | * |
| | |
| | | extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); |
| | | |
| | | /** |
| | | * Return the SDL_GameController associated with a player index. |
| | | */ |
| | | extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index); |
| | | |
| | | /** |
| | | * Return the name for this currently opened controller |
| | | */ |
| | | extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); |
| | | |
| | | /** |
| | | * Return the type of this currently opened controller |
| | | */ |
| | | extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller); |
| | | |
| | | /** |
| | | * Get the player index of an opened game controller, or -1 if it's not available |
| | |
| | | extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); |
| | | |
| | | /** |
| | | * Set the player index of an opened game controller |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); |
| | | |
| | | /** |
| | | * Get the USB vendor ID of an opened controller, if available. |
| | | * If the vendor ID isn't available this function returns 0. |
| | | */ |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the graphics context is externally managed. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * "0" - SDL will manage graphics contexts that are attached to windows. |
| | | * "1" - Disable graphics context management on windows. |
| | | * |
| | | * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the |
| | | * context will be automatically saved and restored when pausing the application. Additionally, some |
| | | * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this |
| | | * behavior, which is desireable when the application manages the graphics context, such as |
| | | * an externally managed OpenGL context or attaching a Vulkan surface to the window. |
| | | */ |
| | | #define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the X11 VidMode extension should be used. |
| | | * |
| | | * This variable can be set to the following values: |
| | |
| | | #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" |
| | | |
| | | /** |
| | | * \brief A variable forcing the visual ID chosen for new X11 windows |
| | | * |
| | | */ |
| | | #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. |
| | | * |
| | | * This variable can be set to the following values: |
| | |
| | | * |
| | | */ |
| | | #define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether X11 should use GLX or EGL by default |
| | | * |
| | | * This variable can be set to the following values: |
| | | * "0" - Use GLX |
| | | * "1" - Use EGL |
| | | * |
| | | * By default SDL will use GLX when both are present. |
| | | */ |
| | | #define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden |
| | |
| | | * By default SDL will generate mouse events for touch events |
| | | */ |
| | | #define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether mouse events should generate synthetic touch events |
| | | * |
| | | * This variable can be set to the following values: |
| | | * "0" - Mouse events will not generate touch events (default for desktop platforms) |
| | | * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) |
| | | */ |
| | | |
| | | #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" |
| | | |
| | | /** |
| | | * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. |
| | |
| | | #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" |
| | | |
| | | /** |
| | | * \brief A variable that overrides the automatic controller type detection |
| | | * |
| | | * The variable should be comma separated entries, in the form: VID/PID=type |
| | | * |
| | | * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd |
| | | * |
| | | * The type should be one of: |
| | | * Xbox360 |
| | | * XboxOne |
| | | * PS3 |
| | | * PS4 |
| | | * SwitchPro |
| | | * |
| | | * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) |
| | | */ |
| | | #define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE" |
| | | |
| | | /** |
| | | * \brief A variable that lets you manually hint extra gamecontroller db entries. |
| | | * |
| | | * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h |
| | |
| | | * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() |
| | | */ |
| | | #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" |
| | | |
| | | /** |
| | | * \brief A variable that lets you provide a file with extra gamecontroller db entries. |
| | | * |
| | | * The file should contain lines 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_FILE "SDL_GAMECONTROLLERCONFIG_FILE" |
| | | |
| | | /** |
| | | * \brief A variable containing a list of devices to skip when scanning for game controllers. |
| | |
| | | * file will be loaded and interpreted as the value of the variable. |
| | | */ |
| | | #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" |
| | | |
| | | /** |
| | | * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. |
| | | * |
| | | * For example, on Nintendo Switch controllers, normally you'd get: |
| | | * |
| | | * (Y) |
| | | * (X) (B) |
| | | * (A) |
| | | * |
| | | * but if this hint is set, you'll get: |
| | | * |
| | | * (X) |
| | | * (Y) (A) |
| | | * (B) |
| | | * |
| | | * The variable can be set to the following values: |
| | | * "0" - Report the face buttons by position, as though they were on an Xbox controller. |
| | | * "1" - Report the face buttons by label instead of position |
| | | * |
| | | * The default value is "1". This hint may be set at any time. |
| | | */ |
| | | #define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" |
| | | |
| | | /** |
| | | * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. |
| | |
| | | * The default is the value of SDL_HINT_JOYSTICK_HIDAPI |
| | | */ |
| | | #define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * "0" - HIDAPI driver is not used |
| | | * "1" - HIDAPI driver is used |
| | | * |
| | | * The default is the value of SDL_HINT_JOYSTICK_HIDAPI |
| | | */ |
| | | #define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE" |
| | | |
| | | /** |
| | | * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs |
| | |
| | | #define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" |
| | | |
| | | /** |
| | | * \brief A variable to control whether mouse and touch events are to be treated together or separately |
| | | * |
| | | * The variable can be set to the following values: |
| | | * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse |
| | | * events. This is the behaviour of SDL <= 2.0.3. (default) |
| | | * "1" - Mouse events will be handled separately from pure touch events. |
| | | * |
| | | * The value of this hint is used at runtime, so it can be changed at any time. |
| | | */ |
| | | #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" |
| | | |
| | | /** |
| | | * \brief A variable to control whether we trap the Android back button to handle it manually. |
| | | * This is necessary for the right mouse button to work on some Android devices, or |
| | | * to be able to trap the back button for use in your code reliably. If set to true, |
| | |
| | | * The value of this hint is used at runtime, so it can be changed at any time. |
| | | */ |
| | | #define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" |
| | | |
| | | /** |
| | | * \brief A variable to control whether the event loop will block itself when the app is paused. |
| | | * |
| | | * The variable can be set to the following values: |
| | | * "0" - Non blocking. |
| | | * "1" - Blocking. (default) |
| | | * |
| | | * The value should be set before SDL is initialized. |
| | | */ |
| | | #define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE" |
| | | |
| | | /** |
| | | * \brief A variable to control whether the return key on the soft keyboard |
| | |
| | | #define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" |
| | | |
| | | /** |
| | | * \brief A variable controlling whether the 2D render API is compatible or efficient. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * |
| | | * "0" - Don't use batching to make rendering more efficient. |
| | | * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls. |
| | | * |
| | | * Up to SDL 2.0.9, the render API would draw immediately when requested. Now |
| | | * it batches up draw requests and sends them all to the GPU only when forced |
| | | * to (during SDL_RenderPresent, when changing render targets, by updating a |
| | | * texture that the batch needs, etc). This is significantly more efficient, |
| | | * but it can cause problems for apps that expect to render on top of the |
| | | * render API's output. As such, SDL will disable batching if a specific |
| | | * render backend is requested (since this might indicate that the app is |
| | | * planning to use the underlying graphics API directly). This hint can |
| | | * be used to explicitly request batching in this instance. It is a contract |
| | | * that you will either never use the underlying graphics API directly, or |
| | | * if you do, you will call SDL_RenderFlush() before you do so any current |
| | | * batch goes to the GPU before your work begins. Not following this contract |
| | | * will result in undefined behavior. |
| | | */ |
| | | #define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING" |
| | | |
| | | |
| | | /** |
| | | * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * |
| | | * "0" - Don't log any events (default) |
| | | * "1" - Log all events except mouse and finger motion, which are pretty spammy. |
| | | * "2" - Log all events. |
| | | * |
| | | * This is generally meant to be used to debug SDL itself, but can be useful |
| | | * for application developers that need better visibility into what is going |
| | | * on in the event queue. Logged events are sent through SDL_Log(), which |
| | | * means by default they appear on stdout on most platforms or maybe |
| | | * OutputDebugString() on Windows, and can be funneled by the app with |
| | | * SDL_LogSetOutputFunction(), etc. |
| | | * |
| | | * This hint can be toggled on and off at runtime, if you only need to log |
| | | * events for a small subset of program execution. |
| | | */ |
| | | #define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" |
| | | |
| | | |
| | | |
| | | /** |
| | | * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. |
| | | * |
| | | * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE |
| | | * file) is not always reliable. In case the size is wrong, it's possible to |
| | | * just ignore it and step through the chunks until a fixed limit is reached. |
| | | * |
| | | * Note that files that have trailing data unrelated to the WAVE file or |
| | | * corrupt files may slow down the loading process without a reliable boundary. |
| | | * By default, SDL stops after 10000 chunks to prevent wasting time. Use the |
| | | * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * |
| | | * "force" - Always use the RIFF chunk size as a boundary for the chunk search |
| | | * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) |
| | | * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB |
| | | * "maximum" - Search for chunks until the end of file (not recommended) |
| | | */ |
| | | #define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE" |
| | | |
| | | /** |
| | | * \brief Controls how a truncated WAVE file is handled. |
| | | * |
| | | * A WAVE file is considered truncated if any of the chunks are incomplete or |
| | | * the data chunk size is not a multiple of the block size. By default, SDL |
| | | * decodes until the first incomplete block, as most applications seem to do. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * |
| | | * "verystrict" - Raise an error if the file is truncated |
| | | * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored |
| | | * "dropframe" - Decode until the first incomplete sample frame |
| | | * "dropblock" - Decode until the first incomplete block (default) |
| | | */ |
| | | #define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION" |
| | | |
| | | /** |
| | | * \brief Controls how the fact chunk affects the loading of a WAVE file. |
| | | * |
| | | * The fact chunk stores information about the number of samples of a WAVE |
| | | * file. The Standards Update from Microsoft notes that this value can be used |
| | | * to 'determine the length of the data in seconds'. This is especially useful |
| | | * for compressed formats (for which this is a mandatory chunk) if they produce |
| | | * multiple sample frames per block and truncating the block is not allowed. |
| | | * The fact chunk can exactly specify how many sample frames there should be |
| | | * in this case. |
| | | * |
| | | * Unfortunately, most application seem to ignore the fact chunk and so SDL |
| | | * ignores it by default as well. |
| | | * |
| | | * This variable can be set to the following values: |
| | | * |
| | | * "truncate" - Use the number of samples to truncate the wave data if |
| | | * the fact chunk is present and valid |
| | | * "strict" - Like "truncate", but raise an error if the fact chunk |
| | | * is invalid, not present for non-PCM formats, or if the |
| | | * data chunk doesn't have that many samples |
| | | * "ignorezero" - Like "truncate", but ignore fact chunk if the number of |
| | | * samples is zero |
| | | * "ignore" - Ignore fact chunk entirely (default) |
| | | */ |
| | | #define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" |
| | | |
| | | /* |
| | | * \brief Override for SDL_GetDisplayUsableBounds() |
| | | * |
| | | * If set, this hint will override the expected results for |
| | | * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want |
| | | * to do this, but this allows an embedded system to request that some of the |
| | | * screen be reserved for other uses when paired with a well-behaved |
| | | * application. |
| | | * |
| | | * The contents of this hint must be 4 comma-separated integers, the first |
| | | * is the bounds x, then y, width and height, in that order. |
| | | */ |
| | | #define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS" |
| | | |
| | | /** |
| | | * \brief An enumeration of hint priorities |
| | | */ |
| | | typedef enum |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /** |
| | | * Return the SDL_Joystick associated with an instance id. |
| | | */ |
| | | extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid); |
| | | extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id); |
| | | |
| | | /** |
| | | * Return the SDL_Joystick associated with a player index. |
| | | */ |
| | | extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index); |
| | | |
| | | /** |
| | | * Return the name for this currently opened joystick. |
| | |
| | | extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); |
| | | |
| | | /** |
| | | * Set the player index of an opened joystick |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index); |
| | | |
| | | /** |
| | | * Return the GUID for this opened joystick |
| | | */ |
| | | extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #define SDLK_SCANCODE_MASK (1<<30) |
| | | #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) |
| | | |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDLK_UNKNOWN = 0, |
| | | |
| | |
| | | |
| | | SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), |
| | | SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) |
| | | }; |
| | | } SDL_KeyCode; |
| | | |
| | | /** |
| | | * \brief Enumeration of valid key mods (possibly OR'd together). |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | * at the VERBOSE level and all other categories are enabled at the |
| | | * CRITICAL level. |
| | | */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_LOG_CATEGORY_APPLICATION, |
| | | SDL_LOG_CATEGORY_ERROR, |
| | |
| | | }; |
| | | */ |
| | | SDL_LOG_CATEGORY_CUSTOM |
| | | }; |
| | | } SDL_LogCategory; |
| | | |
| | | /** |
| | | * \brief The predefined log priorities |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* On iOS SDL provides a main function that creates an application delegate |
| | | and starts the iOS application run loop. |
| | | |
| | | If you link with SDL dynamically on iOS, the main function can't be in a |
| | | shared library, so you need to link with libSDLmain.a, which includes a |
| | | stub main function that calls into the shared library to start execution. |
| | | |
| | | See src/video/uikit/SDL_uikitappdelegate.m for more details. |
| | | */ |
| | | #define SDL_MAIN_NEEDED |
| | |
| | | #endif |
| | | #endif /* SDL_MAIN_HANDLED */ |
| | | |
| | | #ifdef __cplusplus |
| | | #define C_LINKAGE "C" |
| | | #else |
| | | #define C_LINKAGE |
| | | #endif /* __cplusplus */ |
| | | |
| | | #ifndef SDLMAIN_DECLSPEC |
| | | #define SDLMAIN_DECLSPEC |
| | | #endif |
| | |
| | | #define main SDL_main |
| | | #endif |
| | | |
| | | /** |
| | | * The prototype for the application's main() function |
| | | */ |
| | | extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); |
| | | |
| | | |
| | | #include "begin_code.h" |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | /** |
| | | * The prototype for the application's main() function |
| | | */ |
| | | typedef int (*SDL_main_func)(int argc, char *argv[]); |
| | | extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); |
| | | |
| | | |
| | | /** |
| | | * This is called by the real SDL main function to let the rest of the |
| | |
| | | /** |
| | | * This can be called to set the application class at startup |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, |
| | | void *hInst); |
| | | extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); |
| | | extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); |
| | | |
| | | #endif /* __WIN32__ */ |
| | |
| | | * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more |
| | | * information on the failure. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * reserved); |
| | | extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved); |
| | | |
| | | #endif /* __WINRT__ */ |
| | | |
| | | #if defined(__IPHONEOS__) |
| | | |
| | | /** |
| | | * \brief Initializes and launches an SDL application. |
| | | * |
| | | * \param argc The argc parameter from the application's main() function |
| | | * \param argv The argv parameter from the application's main() function |
| | | * \param mainFunction The SDL app's C-style main(). |
| | | * \return the return value from mainFunction |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); |
| | | |
| | | #endif /* __IPHONEOS__ */ |
| | | |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | { |
| | | SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ |
| | | SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ |
| | | SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ |
| | | SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */ |
| | | SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */ |
| | | SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */ |
| | | } SDL_MessageBoxFlags; |
| | | |
| | | /** |
| New file |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2020 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_metal.h |
| | | * |
| | | * Header file for functions to creating Metal layers and views on SDL windows. |
| | | */ |
| | | |
| | | #ifndef SDL_metal_h_ |
| | | #define SDL_metal_h_ |
| | | |
| | | #include "SDL_video.h" |
| | | |
| | | #include "begin_code.h" |
| | | /* Set up for C function definitions, even when using C++ */ |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | /** |
| | | * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). |
| | | * |
| | | * \note This can be cast directly to an NSView or UIView. |
| | | */ |
| | | typedef void *SDL_MetalView; |
| | | |
| | | /** |
| | | * \name Metal support functions |
| | | */ |
| | | /* @{ */ |
| | | |
| | | /** |
| | | * \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the |
| | | * specified window. |
| | | * |
| | | * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its |
| | | * own. It is up to user code to do that. |
| | | * |
| | | * The returned handle can be casted directly to a NSView or UIView, and the |
| | | * CAMetalLayer can be accessed from the view's 'layer' property. |
| | | * |
| | | * \code |
| | | * SDL_MetalView metalview = SDL_Metal_CreateView(window); |
| | | * UIView *uiview = (__bridge UIView *)metalview; |
| | | * CAMetalLayer *metallayer = (CAMetalLayer *)uiview.layer; |
| | | * // [...] |
| | | * SDL_Metal_DestroyView(metalview); |
| | | * \endcode |
| | | * |
| | | * \sa SDL_Metal_DestroyView |
| | | */ |
| | | extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window); |
| | | |
| | | /** |
| | | * \brief Destroy an existing SDL_MetalView object. |
| | | * |
| | | * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was |
| | | * called after SDL_CreateWindow. |
| | | * |
| | | * \sa SDL_Metal_CreateView |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); |
| | | |
| | | /* @} *//* Metal support functions */ |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | | } |
| | | #endif |
| | | #include "close_code.h" |
| | | |
| | | #endif /* SDL_metal_h_ */ |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #ifndef WIN32_LEAN_AND_MEAN |
| | | #define WIN32_LEAN_AND_MEAN 1 |
| | | #endif |
| | | #ifndef NOMINMAX /* don't define min() and max(). */ |
| | | #define NOMINMAX |
| | | #endif |
| | | #include <windows.h> |
| | | #endif |
| | | |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* @} */ |
| | | |
| | | /** Pixel type. */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_PIXELTYPE_UNKNOWN, |
| | | SDL_PIXELTYPE_INDEX1, |
| | |
| | | SDL_PIXELTYPE_ARRAYU32, |
| | | SDL_PIXELTYPE_ARRAYF16, |
| | | SDL_PIXELTYPE_ARRAYF32 |
| | | }; |
| | | } SDL_PixelType; |
| | | |
| | | /** Bitmap pixel order, high bit -> low bit. */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_BITMAPORDER_NONE, |
| | | SDL_BITMAPORDER_4321, |
| | | SDL_BITMAPORDER_1234 |
| | | }; |
| | | } SDL_BitmapOrder; |
| | | |
| | | /** Packed component order, high bit -> low bit. */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_PACKEDORDER_NONE, |
| | | SDL_PACKEDORDER_XRGB, |
| | |
| | | SDL_PACKEDORDER_BGRX, |
| | | SDL_PACKEDORDER_ABGR, |
| | | SDL_PACKEDORDER_BGRA |
| | | }; |
| | | } SDL_PackedOrder; |
| | | |
| | | /** Array component order, low byte -> high byte. */ |
| | | /* !!! FIXME: in 2.1, make these not overlap differently with |
| | | !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_ARRAYORDER_NONE, |
| | | SDL_ARRAYORDER_RGB, |
| | |
| | | SDL_ARRAYORDER_BGR, |
| | | SDL_ARRAYORDER_BGRA, |
| | | SDL_ARRAYORDER_ABGR |
| | | }; |
| | | } SDL_ArrayOrder; |
| | | |
| | | /** Packed component layout. */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_PACKEDLAYOUT_NONE, |
| | | SDL_PACKEDLAYOUT_332, |
| | |
| | | SDL_PACKEDLAYOUT_8888, |
| | | SDL_PACKEDLAYOUT_2101010, |
| | | SDL_PACKEDLAYOUT_1010102 |
| | | }; |
| | | } SDL_PackedLayout; |
| | | |
| | | #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) |
| | | |
| | |
| | | ((format) && (SDL_PIXELFLAG(format) != 1)) |
| | | |
| | | /* Note: If you modify this list, update SDL_GetPixelFormatName() */ |
| | | enum |
| | | typedef enum |
| | | { |
| | | SDL_PIXELFORMAT_UNKNOWN, |
| | | SDL_PIXELFORMAT_INDEX1LSB = |
| | |
| | | SDL_PACKEDLAYOUT_332, 8, 1), |
| | | SDL_PIXELFORMAT_RGB444 = |
| | | SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, |
| | | SDL_PACKEDLAYOUT_4444, 12, 2), |
| | | SDL_PIXELFORMAT_BGR444 = |
| | | SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, |
| | | SDL_PACKEDLAYOUT_4444, 12, 2), |
| | | SDL_PIXELFORMAT_RGB555 = |
| | | SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, |
| | |
| | | SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), |
| | | SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ |
| | | SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') |
| | | }; |
| | | } SDL_PixelFormatEnum; |
| | | |
| | | typedef struct SDL_Color |
| | | { |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #endif |
| | | |
| | | /** |
| | | * \brief The structure that defines a point |
| | | * \brief The structure that defines a point (integer) |
| | | * |
| | | * \sa SDL_EnclosePoints |
| | | * \sa SDL_PointInRect |
| | |
| | | } SDL_Point; |
| | | |
| | | /** |
| | | * \brief A rectangle, with the origin at the upper left. |
| | | * \brief The structure that defines a point (floating point) |
| | | * |
| | | * \sa SDL_EnclosePoints |
| | | * \sa SDL_PointInRect |
| | | */ |
| | | typedef struct SDL_FPoint |
| | | { |
| | | float x; |
| | | float y; |
| | | } SDL_FPoint; |
| | | |
| | | |
| | | /** |
| | | * \brief A rectangle, with the origin at the upper left (integer). |
| | | * |
| | | * \sa SDL_RectEmpty |
| | | * \sa SDL_RectEquals |
| | |
| | | int w, h; |
| | | } SDL_Rect; |
| | | |
| | | |
| | | /** |
| | | * \brief A rectangle, with the origin at the upper left (floating point). |
| | | */ |
| | | typedef struct SDL_FRect |
| | | { |
| | | float x; |
| | | float y; |
| | | float w; |
| | | float h; |
| | | } SDL_FRect; |
| | | |
| | | |
| | | /** |
| | | * \brief Returns true if point resides inside a rectangle. |
| | | */ |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | int max_texture_width; /**< The maximum texture width */ |
| | | int max_texture_height; /**< The maximum texture height */ |
| | | } SDL_RendererInfo; |
| | | |
| | | /** |
| | | * \brief The scaling mode for a texture. |
| | | */ |
| | | typedef enum |
| | | { |
| | | SDL_ScaleModeNearest, /**< nearest pixel sampling */ |
| | | SDL_ScaleModeLinear, /**< linear filtering */ |
| | | SDL_ScaleModeBest /**< anisotropic filtering */ |
| | | } SDL_ScaleMode; |
| | | |
| | | /** |
| | | * \brief The access pattern allowed for a texture. |
| | |
| | | SDL_BlendMode *blendMode); |
| | | |
| | | /** |
| | | * \brief Set the scale mode used for texture scale operations. |
| | | * |
| | | * \param texture The texture to update. |
| | | * \param scaleMode ::SDL_ScaleMode to use for texture scaling. |
| | | * |
| | | * \return 0 on success, or -1 if the texture is not valid. |
| | | * |
| | | * \note If the scale mode is not supported, the closest supported mode is |
| | | * chosen. |
| | | * |
| | | * \sa SDL_GetTextureScaleMode() |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture, |
| | | SDL_ScaleMode scaleMode); |
| | | |
| | | /** |
| | | * \brief Get the scale mode used for texture scale operations. |
| | | * |
| | | * \param texture The texture to query. |
| | | * \param scaleMode A pointer filled in with the current scale mode. |
| | | * |
| | | * \return 0 on success, or -1 if the texture is not valid. |
| | | * |
| | | * \sa SDL_SetTextureScaleMode() |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture, |
| | | SDL_ScaleMode *scaleMode); |
| | | |
| | | /** |
| | | * \brief Update the given texture rectangle with new pixel data. |
| | | * |
| | | * \param texture The texture to update |
| | |
| | | void **pixels, int *pitch); |
| | | |
| | | /** |
| | | * \brief Lock a portion of the texture for write-only pixel access. |
| | | * Expose it as a SDL surface. |
| | | * |
| | | * \param texture The texture to lock for access, which was created with |
| | | * ::SDL_TEXTUREACCESS_STREAMING. |
| | | * \param rect A pointer to the rectangle to lock for access. If the rect |
| | | * is NULL, the entire texture will be locked. |
| | | * \param surface This is filled in with a SDL surface representing the locked area |
| | | * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture. |
| | | * |
| | | * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. |
| | | * |
| | | * \sa SDL_UnlockTexture() |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, |
| | | const SDL_Rect *rect, |
| | | SDL_Surface **surface); |
| | | |
| | | /** |
| | | * \brief Unlock a texture, uploading the changes to video memory, if needed. |
| | | * If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed. |
| | | * |
| | | * \sa SDL_LockTexture() |
| | | * \sa SDL_LockTextureToSurface() |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); |
| | | |
| | |
| | | * \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. |
| | | * \param rect A pointer to the rectangle to set as the clip rectangle, |
| | | * relative to the viewport, or NULL to disable clipping. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | * |
| | |
| | | const SDL_Point *center, |
| | | const SDL_RendererFlip flip); |
| | | |
| | | |
| | | /** |
| | | * \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 y The y coordinate of the point. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer, |
| | | float x, float y); |
| | | |
| | | /** |
| | | * \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 count The number of points to draw |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer, |
| | | const SDL_FPoint * points, |
| | | int count); |
| | | |
| | | /** |
| | | * \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 y1 The y coordinate of the start point. |
| | | * \param x2 The x coordinate of the end point. |
| | | * \param y2 The y coordinate of the end point. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer, |
| | | float x1, float y1, float x2, float y2); |
| | | |
| | | /** |
| | | * \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 count The number of points, drawing count-1 lines |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer, |
| | | const SDL_FPoint * points, |
| | | int count); |
| | | |
| | | /** |
| | | * \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. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer, |
| | | const SDL_FRect * rect); |
| | | |
| | | /** |
| | | * \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 count The number of rectangles. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer, |
| | | const SDL_FRect * rects, |
| | | int count); |
| | | |
| | | /** |
| | | * \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 |
| | | * rendering target. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer, |
| | | const SDL_FRect * rect); |
| | | |
| | | /** |
| | | * \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 count The number of rectangles. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer, |
| | | const SDL_FRect * rects, |
| | | int count); |
| | | |
| | | /** |
| | | * \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 srcrect A pointer to the source rectangle, or NULL for the entire |
| | | * texture. |
| | | * \param dstrect A pointer to the destination rectangle, or NULL for the |
| | | * entire rendering target. |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer, |
| | | SDL_Texture * texture, |
| | | const SDL_Rect * srcrect, |
| | | const SDL_FRect * dstrect); |
| | | |
| | | /** |
| | | * \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 srcrect A pointer to the source rectangle, or NULL for the entire |
| | | * texture. |
| | | * \param dstrect A pointer to the destination rectangle, or NULL for the |
| | | * entire rendering target. |
| | | * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction |
| | | * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). |
| | | * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture |
| | | * |
| | | * \return 0 on success, or -1 on error |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer, |
| | | SDL_Texture * texture, |
| | | const SDL_Rect * srcrect, |
| | | const SDL_FRect * dstrect, |
| | | const double angle, |
| | | const SDL_FPoint *center, |
| | | const SDL_RendererFlip flip); |
| | | |
| | | /** |
| | | * \brief Read pixels from the current rendering target. |
| | | * |
| | |
| | | */ |
| | | extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); |
| | | |
| | | /** |
| | | * \brief Force the rendering context to flush any pending commands to the |
| | | * underlying rendering API. |
| | | * |
| | | * You do not need to (and in fact, shouldn't) call this function unless |
| | | * you are planning to call into OpenGL/Direct3D/Metal/whatever directly |
| | | * in addition to using an SDL_Renderer. |
| | | * |
| | | * This is for a very-specific case: if you are using SDL's render API, |
| | | * you asked for a specific renderer backend (OpenGL, Direct3D, etc), |
| | | * you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make |
| | | * OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of |
| | | * this applies, you should call SDL_RenderFlush() between calls to SDL's |
| | | * render API and the low-level API you're using in cooperation. |
| | | * |
| | | * In all other cases, you can ignore this function. This is only here to |
| | | * get maximum performance out of a specific situation. In all other cases, |
| | | * SDL will do the right thing, perhaps at a performance loss. |
| | | * |
| | | * This function is first available in SDL 2.0.10, and is not needed in |
| | | * 2.0.9 and earlier, as earlier versions did not queue rendering commands |
| | | * at all, instead flushing them to the OS immediately. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer); |
| | | |
| | | |
| | | /** |
| | | * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with |
| New file |
| | |
| | | #define SDL_REVISION "hg-0:aaaaaaaaaaah" |
| | | #define SDL_REVISION_NUMBER 0 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #define RW_SEEK_END 2 /**< Seek relative to the end of data */ |
| | | |
| | | /** |
| | | * \name Read/write macros |
| | | * |
| | | * Macros to easily read and write from an SDL_RWops structure. |
| | | * Return the size of the file in this rwops, or -1 if unknown |
| | | */ |
| | | /* @{ */ |
| | | #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 */ |
| | | extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context); |
| | | |
| | | /** |
| | | * Seek to \c offset relative to \c whence, one of stdio's whence values: |
| | | * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END |
| | | * |
| | | * \return the final offset in the data stream, or -1 on error. |
| | | */ |
| | | extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context, |
| | | Sint64 offset, int whence); |
| | | |
| | | /** |
| | | * Return the current offset in the data stream, or -1 on error. |
| | | */ |
| | | extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context); |
| | | |
| | | /** |
| | | * Read up to \c maxnum objects each of size \c size from the data |
| | | * stream to the area pointed at by \c ptr. |
| | | * |
| | | * \return the number of objects read, or 0 at error or end of file. |
| | | */ |
| | | extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context, |
| | | void *ptr, size_t size, size_t maxnum); |
| | | |
| | | /** |
| | | * Write exactly \c num objects each of size \c size from the area |
| | | * pointed at by \c ptr to data stream. |
| | | * |
| | | * \return the number of objects written, or 0 at error or end of file. |
| | | */ |
| | | extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context, |
| | | const void *ptr, size_t size, size_t num); |
| | | |
| | | /** |
| | | * Close and free an allocated SDL_RWops structure. |
| | | * |
| | | * \return 0 if successful or -1 on write error when flushing data. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context); |
| | | |
| | | /** |
| | | * Load all the data from an SDL data stream. |
| | |
| | | /** |
| | | * Load an entire file. |
| | | * |
| | | * Convenience macro. |
| | | * The data is allocated with a zero byte at the end (null terminated) |
| | | * |
| | | * If \c datasize is not NULL, it is filled with the size of the data read. |
| | | * |
| | | * If \c freesrc is non-zero, the stream will be closed after being read. |
| | | * |
| | | * The data should be freed with SDL_free(). |
| | | * |
| | | * \return the data, or NULL if there was an error. |
| | | */ |
| | | #define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) |
| | | extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize); |
| | | |
| | | /** |
| | | * \name Read endian functions |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | * SDL_Event structure. |
| | | * |
| | | * The values in this enumeration are based on the USB usage page standard: |
| | | * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf |
| | | * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf |
| | | */ |
| | | typedef enum |
| | | { |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | * |
| | | */ |
| | | |
| | | #ifndef _SDL_sensor_h |
| | | #define _SDL_sensor_h |
| | | #ifndef SDL_sensor_h_ |
| | | #define SDL_sensor_h_ |
| | | |
| | | #include "SDL_stdinc.h" |
| | | #include "SDL_error.h" |
| | |
| | | #endif |
| | | #include "close_code.h" |
| | | |
| | | #endif /* _SDL_sensor_h */ |
| | | #endif /* SDL_sensor_h_ */ |
| | | |
| | | /* vi: set ts=4 sw=4 expandtab: */ |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | |
| | | extern DECLSPEC int SDLCALL SDL_isdigit(int x); |
| | | extern DECLSPEC int SDLCALL SDL_isspace(int x); |
| | | extern DECLSPEC int SDLCALL SDL_isupper(int x); |
| | | extern DECLSPEC int SDLCALL SDL_islower(int x); |
| | | extern DECLSPEC int SDLCALL SDL_toupper(int x); |
| | | extern DECLSPEC int SDLCALL SDL_tolower(int x); |
| | | |
| | |
| | | |
| | | #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) |
| | | #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) |
| | | #define SDL_zeroa(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, Uint32 val, size_t dwords) |
| | | { |
| | | #if defined(__GNUC__) && defined(i386) |
| | | #ifdef __APPLE__ |
| | | memset_pattern4(dst, &val, dwords * 4); |
| | | #elif defined(__GNUC__) && defined(i386) |
| | | int u0, u1, u2; |
| | | __asm__ __volatile__ ( |
| | | "cld \n\t" |
| | |
| | | extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); |
| | | extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); |
| | | |
| | | extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); |
| | | extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); |
| | | extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); |
| | | extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); |
| | | extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); |
| | | extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle); |
| | | |
| | | extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); |
| | | extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen); |
| | | |
| | | extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); |
| | | extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); |
| | |
| | | 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); |
| | | extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); |
| | | extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); |
| | | |
| | | extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); |
| | |
| | | #define SDL_strchr strchr |
| | | #define SDL_strrchr strrchr |
| | | #define SDL_strstr strstr |
| | | #define SDL_strtokr strtok_r |
| | | #define SDL_strcmp strcmp |
| | | #define SDL_strncmp strncmp |
| | | #define SDL_strcasecmp strcasecmp |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ |
| | | #define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ |
| | | #define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ |
| | | #define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */ |
| | | /* @} *//* Surface flags */ |
| | | |
| | | /** |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #endif /* __LINUX__ */ |
| | | |
| | | /* Platform specific functions for iOS */ |
| | | #if defined(__IPHONEOS__) && __IPHONEOS__ |
| | | #ifdef __IPHONEOS__ |
| | | |
| | | #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam) |
| | | extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); |
| | |
| | | |
| | | |
| | | /* Platform specific functions for Android */ |
| | | #if defined(__ANDROID__) && __ANDROID__ |
| | | #ifdef __ANDROID__ |
| | | |
| | | /** |
| | | \brief Get the JNI environment for the current thread |
| | |
| | | (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) |
| | | */ |
| | | extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); |
| | | |
| | | /** |
| | | \brief Return API level of the current device |
| | | |
| | | API level 29: Android 10 |
| | | API level 28: Android 9 |
| | | API level 27: Android 8.1 |
| | | API level 26: Android 8.0 |
| | | API level 25: Android 7.1 |
| | | API level 24: Android 7.0 |
| | | API level 23: Android 6.0 |
| | | API level 22: Android 5.1 |
| | | API level 21: Android 5.0 |
| | | API level 20: Android 4.4W |
| | | API level 19: Android 4.4 |
| | | API level 18: Android 4.3 |
| | | API level 17: Android 4.2 |
| | | API level 16: Android 4.1 |
| | | API level 15: Android 4.0.3 |
| | | API level 14: Android 4.0 |
| | | API level 13: Android 3.2 |
| | | API level 12: Android 3.1 |
| | | API level 11: Android 3.0 |
| | | API level 10: Android 2.3.3 |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); |
| | | |
| | | /** |
| | | \brief Return true if the application is running on Android TV |
| | |
| | | #endif /* __ANDROID__ */ |
| | | |
| | | /* Platform specific functions for WinRT */ |
| | | #if defined(__WINRT__) && __WINRT__ |
| | | #ifdef __WINRT__ |
| | | |
| | | /** |
| | | * \brief WinRT / Windows Phone path types |
| | |
| | | */ |
| | | extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); |
| | | |
| | | /* Functions used by iOS application delegates to notify SDL about state changes */ |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void); |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void); |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void); |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void); |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void); |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void); |
| | | #ifdef __IPHONEOS__ |
| | | extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void); |
| | | #endif |
| | | |
| | | /* Ends C function definitions when using C++ */ |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #include "SDL_version.h" |
| | | |
| | | /** |
| | | * \file SDL_syswm.h |
| | | * \brief SDL_syswm.h |
| | | * |
| | | * Your application has access to a special type of event ::SDL_SYSWMEVENT, |
| | | * which contains window-manager specific information and arrives whenever |
| | | * an unhandled window event occurs. This event is ignored by default, but |
| | | * you can enable it with SDL_EventState(). |
| | | */ |
| | | #ifdef SDL_PROTOTYPES_ONLY |
| | | struct SDL_SysWMinfo; |
| | | #else |
| | | |
| | | #if !defined(SDL_PROTOTYPES_ONLY) |
| | | |
| | | #if defined(SDL_VIDEO_DRIVER_WINDOWS) |
| | | #ifndef WIN32_LEAN_AND_MEAN |
| | | #define WIN32_LEAN_AND_MEAN |
| | | #endif |
| | | #ifndef NOMINMAX /* don't define min() and max(). */ |
| | | #define NOMINMAX |
| | | #endif |
| | | #include <windows.h> |
| | | #endif |
| | |
| | | #if defined(SDL_VIDEO_DRIVER_VIVANTE) |
| | | #include "SDL_egl.h" |
| | | #endif |
| | | #endif /* SDL_PROTOTYPES_ONLY */ |
| | | |
| | | |
| | | #include "begin_code.h" |
| | | /* Set up for C function definitions, even when using C++ */ |
| | |
| | | extern "C" { |
| | | #endif |
| | | |
| | | #if !defined(SDL_PROTOTYPES_ONLY) |
| | | /** |
| | | * These are the various supported windowing subsystems |
| | | */ |
| | |
| | | SDL_SYSWM_COCOA, |
| | | SDL_SYSWM_UIKIT, |
| | | SDL_SYSWM_WAYLAND, |
| | | SDL_SYSWM_MIR, |
| | | SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ |
| | | SDL_SYSWM_WINRT, |
| | | SDL_SYSWM_ANDROID, |
| | | SDL_SYSWM_VIVANTE, |
| | | SDL_SYSWM_OS2 |
| | | SDL_SYSWM_OS2, |
| | | SDL_SYSWM_HAIKU |
| | | } SDL_SYSWM_TYPE; |
| | | |
| | | /** |
| | |
| | | struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */ |
| | | } wl; |
| | | #endif |
| | | #if defined(SDL_VIDEO_DRIVER_MIR) |
| | | #if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ |
| | | struct |
| | | { |
| | | struct MirConnection *connection; /**< Mir display server connection */ |
| | | struct MirSurface *surface; /**< Mir surface */ |
| | | void *connection; /**< Mir display server connection */ |
| | | void *surface; /**< Mir surface */ |
| | | } mir; |
| | | #endif |
| | | |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | */ |
| | | typedef int (SDLCALL * SDL_ThreadFunction) (void *data); |
| | | |
| | | #if defined(__WIN32__) && !defined(HAVE_LIBC) |
| | | #if defined(__WIN32__) |
| | | /** |
| | | * \file SDL_thread.h |
| | | * |
| | |
| | | void * /*arg*/, unsigned, unsigned * /* threadID */); |
| | | typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); |
| | | |
| | | #ifndef SDL_beginthread |
| | | #define SDL_beginthread _beginthreadex |
| | | #endif |
| | | #ifndef SDL_endthread |
| | | #define SDL_endthread _endthreadex |
| | | #endif |
| | | |
| | | /** |
| | | * Create a thread. |
| | | */ |
| | |
| | | */ |
| | | #if defined(SDL_CreateThread) && SDL_DYNAMIC_API |
| | | #undef SDL_CreateThread |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #undef SDL_CreateThreadWithStackSize |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #else |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #endif |
| | | |
| | | #elif defined(__OS2__) |
| | |
| | | * into a dll with Watcom's runtime statically linked. |
| | | */ |
| | | #define SDL_PASSED_BEGINTHREAD_ENDTHREAD |
| | | |
| | | #ifndef __EMX__ |
| | | #include <process.h> |
| | | #else |
| | | #include <stdlib.h> |
| | | #endif |
| | | |
| | | typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); |
| | | typedef void (*pfnSDL_CurrentEndThread)(void); |
| | | |
| | | #ifndef SDL_beginthread |
| | | #define SDL_beginthread _beginthread |
| | | #endif |
| | | #ifndef SDL_endthread |
| | | #define SDL_endthread _endthread |
| | | #endif |
| | | |
| | | extern DECLSPEC SDL_Thread *SDLCALL |
| | | SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, |
| | | pfnSDL_CurrentBeginThread pfnBeginThread, |
| | |
| | | SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, |
| | | pfnSDL_CurrentBeginThread pfnBeginThread, |
| | | pfnSDL_CurrentEndThread pfnEndThread); |
| | | |
| | | #if defined(SDL_CreateThread) && SDL_DYNAMIC_API |
| | | #undef SDL_CreateThread |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #undef SDL_CreateThreadWithStackSize |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #else |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) |
| | | #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) |
| | | #endif |
| | | |
| | | #else |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | typedef Sint64 SDL_TouchID; |
| | | typedef Sint64 SDL_FingerID; |
| | | |
| | | typedef enum |
| | | { |
| | | SDL_TOUCH_DEVICE_INVALID = -1, |
| | | SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */ |
| | | SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */ |
| | | SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */ |
| | | } SDL_TouchDeviceType; |
| | | |
| | | typedef struct SDL_Finger |
| | | { |
| | | SDL_FingerID id; |
| | |
| | | |
| | | /* Used as the device ID for mouse events simulated with touch input */ |
| | | #define SDL_TOUCH_MOUSEID ((Uint32)-1) |
| | | |
| | | /* Used as the SDL_TouchID for touch events simulated with mouse input */ |
| | | #define SDL_MOUSE_TOUCHID ((Sint64)-1) |
| | | |
| | | |
| | | /* Function prototypes */ |
| | |
| | | extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); |
| | | |
| | | /** |
| | | * \brief Get the type of the given touch device. |
| | | */ |
| | | extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID); |
| | | |
| | | /** |
| | | * \brief Get the number of active fingers for a given touch device. |
| | | */ |
| | | extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | */ |
| | | #define SDL_MAJOR_VERSION 2 |
| | | #define SDL_MINOR_VERSION 0 |
| | | #define SDL_PATCHLEVEL 9 |
| | | #define SDL_PATCHLEVEL 12 |
| | | |
| | | /** |
| | | * \brief Macro to determine SDL version program was compiled against. |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | */ |
| | | typedef enum |
| | | { |
| | | /* !!! FIXME: change this to name = (1<<x). */ |
| | | SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ |
| | | SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ |
| | | SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ |
| | |
| | | * applications to link with libvulkan (and historically MoltenVK was |
| | | * provided as a static library). If it is not found then, on macOS, SDL |
| | | * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, |
| | | * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. |
| | | * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications |
| | | * followed by \c libvulkan.dylib, in that order. |
| | | * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications |
| | | * using a dynamic framework or .dylib must ensure it is included in its |
| | | * application bundle. |
| | | * |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | #ifdef _MSC_VER |
| | | #pragma warning(disable: 4103) |
| | | #endif |
| | | #ifdef __clang__ |
| | | #pragma clang diagnostic ignored "-Wpragma-pack" |
| | | #endif |
| | | #ifdef __BORLANDC__ |
| | | #pragma nopackwarning |
| | | #endif |
| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 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 |
| | |
| | | * after you finish any function and structure declarations in your headers |
| | | */ |
| | | |
| | | #ifndef _begin_code_h |
| | | #error close_code.h included without matching begin_code.h |
| | | #endif |
| | | #undef _begin_code_h |
| | | |
| | | /* Reset structure packing at previous byte alignment */ |