Move third_party from src to root directory.

This commit is contained in:
Tijani Lawal 2024-08-31 13:11:04 -05:00
parent c821949354
commit f47e2eb4af
151 changed files with 39274 additions and 40770 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*.exe
*.pdf
*.obj
*.pdb
*.res

View File

@ -41,8 +41,8 @@ set auto_compile_flags=
if "%tracy%"=="1" set auto_compile_flags=%auto_compile_flags% /DTRACY_ENABLE && echo [tracy profiling enabled] if "%tracy%"=="1" set auto_compile_flags=%auto_compile_flags% /DTRACY_ENABLE && echo [tracy profiling enabled]
:: Third Party libraries :: Third Party libraries
set third_party_includes="%~dp0\src\\third_party\\SDL2\\include" set third_party_includes="%~dp0\third_party\\SDL2\\include"
set third_party_lib="%~dp0\src\\third_party\\SDL2\\lib\\x64" set third_party_lib="%~dp0\third_party\\SDL2\\lib\\x64"
:: MSVC :: MSVC
set cl_common= /I..\src\ /nologo /FC /Z7 /I%third_party_includes% set cl_common= /I..\src\ /nologo /FC /Z7 /I%third_party_includes%
@ -97,7 +97,7 @@ popd
:: Get Current SVN/Git Commit ID :: Get Current SVN/Git Commit ID
:: SVN :: SVN
for /f "tokens=2 delims==" %%i in ('svn info --show-item revision') do set compile=%compile% -DBUILD_SVN_REVISION=\"%%i\" :: for /f "tokens=2 delims==" %%i in ('svn info --show-item revision') do set compile=%compile% -DBUILD_SVN_REVISION=\"%%i\"
:: Git :: Git
:: for /f %%i in ('call git describe --always --dirty') do set compile=%compile% -DBUILD_GIT_HASH=\"%%i\" :: for /f %%i in ('call git describe --always --dirty') do set compile=%compile% -DBUILD_GIT_HASH=\"%%i\"

View File

@ -1,320 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_assert_h_
#define SDL_assert_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SDL_ASSERT_LEVEL
#ifdef SDL_DEFAULT_ASSERT_LEVEL
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
#elif defined(_DEBUG) || defined(DEBUG) || (defined(__GNUC__) && !defined(__OPTIMIZE__))
#define SDL_ASSERT_LEVEL 2
#else
#define SDL_ASSERT_LEVEL 1
#endif
#endif /* SDL_ASSERT_LEVEL */
/*
These are macros and not first class functions so that the debugger breaks
on the assertion line and not in some random guts of SDL, and so each
assert can have unique static variables associated with it.
*/
#if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif _SDL_HAS_BUILTIN(__builtin_debugtrap)
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif ((!defined(__NACL__)) && \
((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))))
#define SDL_TriggerBreakpoint() __asm__ __volatile__("int $3\n\t")
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
#define SDL_TriggerBreakpoint() __asm__ __volatile__("ebreak\n\t")
#elif (defined(__APPLE__) && \
(defined(__arm64__) || \
defined(__aarch64__))) /* this might work on other ARM targets, but this is a known quantity... */
#define SDL_TriggerBreakpoint() __asm__ __volatile__("brk #22\n\t")
#elif defined(__APPLE__) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__("bkpt #22\n\t")
#elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() \
{ \
_asm { int 0x03 } \
}
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
#endif
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
#define SDL_FUNCTION __func__
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined(__WATCOMC__))
#define SDL_FUNCTION __FUNCTION__
#else
#define SDL_FUNCTION "???"
#endif
#define SDL_FILE __FILE__
#define SDL_LINE __LINE__
/*
sizeof (x) makes the compiler still parse the expression even without
assertions enabled, so the code is always checked at compile time, but
doesn't actually generate code for it, so there are no side effects or
expensive checks at run time, just the constant size of what x WOULD be,
which presumably gets optimized out as unused.
This also solves the problem of...
int somevalue = blah();
SDL_assert(somevalue == 1);
...which would cause compiles to complain that somevalue is unused if we
disable assertions.
*/
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
this condition isn't constant. And looks like an owl's face! */
#ifdef _MSC_VER /* stupid /W4 warnings. */
#define SDL_NULL_WHILE_LOOP_CONDITION (0, 0)
#else
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif
#define SDL_disabled_assert(condition) \
do { \
(void)sizeof((condition)); \
} while (SDL_NULL_WHILE_LOOP_CONDITION)
typedef enum {
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
SDL_ASSERTION_ABORT, /**< Terminate the program. */
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
} SDL_AssertState;
typedef struct SDL_AssertData {
int always_ignore;
unsigned int trigger_count;
const char *condition;
const char *filename;
int linenum;
const char *function;
const struct SDL_AssertData *next;
} SDL_AssertData;
/* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, const char *, const char *, int)
#if defined(__clang__)
#if __has_feature(attribute_analyzer_noreturn)
/* this tells Clang's static analysis that we're a custom assert function,
and that the analyzer should assume the condition was always true past this
SDL_assert test. */
__attribute__((analyzer_noreturn))
#endif
#endif
;
/* the do {} while(0) avoids dangling else problems:
if (x) SDL_assert(y); else blah();
... without the do/while, the "else" could attach to this macro's "if".
We try to handle just the minimum we need here in a macro...the loop,
the static vars, and break points. The heavy lifting is handled in
SDL_ReportAssertion(), in SDL_assert.c.
*/
#define SDL_enabled_assert(condition) \
do { \
while (!(condition)) { \
static struct SDL_AssertData sdl_assert_data = {0, 0, #condition, 0, 0, 0, 0}; \
const SDL_AssertState sdl_assert_state = \
SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
SDL_TriggerBreakpoint(); \
} \
break; /* not retrying. */ \
} \
} while (SDL_NULL_WHILE_LOOP_CONDITION)
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
#define SDL_assert(condition) SDL_disabled_assert(condition)
#define SDL_assert_release(condition) SDL_disabled_assert(condition)
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
#define SDL_assert(condition) SDL_disabled_assert(condition)
#define SDL_assert_release(condition) SDL_enabled_assert(condition)
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
#define SDL_assert(condition) SDL_enabled_assert(condition)
#define SDL_assert_release(condition) SDL_enabled_assert(condition)
#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
#define SDL_assert(condition) SDL_enabled_assert(condition)
#define SDL_assert_release(condition) SDL_enabled_assert(condition)
#define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
#else
#error Unknown assertion level.
#endif
/* this assertion is never disabled at any level. */
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
/**
* A callback that fires when an SDL assertion fails.
*
* \param data a pointer to the SDL_AssertData structure corresponding to the
* current assertion
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
* \returns an SDL_AssertState value indicating how to handle the failure.
*/
typedef SDL_AssertState(SDLCALL *SDL_AssertionHandler)(const SDL_AssertData *data, void *userdata);
/**
* Set an application-defined assertion handler.
*
* This function allows an application to show its own assertion UI and/or
* force the response to an assertion failure. If the application doesn't
* provide this, SDL will try to do the right thing, popping up a
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
*
* This callback may fire from any thread, but it runs wrapped in a mutex, so
* it will only fire from one thread at a time.
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
* \param handler the SDL_AssertionHandler function to call when an assertion
* fails or NULL for the default handler
* \param userdata a pointer that is passed to `handler`
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetAssertionHandler
*/
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata);
/**
* Get the default assertion handler.
*
* This returns the function pointer that is called by default when an
* assertion is triggered. This is an internal function provided by SDL, that
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
* provide a different function.
*
* \returns the default SDL_AssertionHandler that is called when an assert
* triggers.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_GetAssertionHandler
*/
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
/**
* Get the current assertion handler.
*
* This returns the function pointer that is called when an assertion is
* triggered. This is either the value last passed to
* SDL_SetAssertionHandler(), or if no application-specified function is set,
* is equivalent to calling SDL_GetDefaultAssertionHandler().
*
* The parameter `puserdata` is a pointer to a void*, which will store the
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
* will always be NULL for the default handler. If you don't care about this
* data, it is safe to pass a NULL pointer to this function to ignore it.
*
* \param puserdata pointer which is filled with the "userdata" pointer that
* was passed to SDL_SetAssertionHandler()
* \returns the SDL_AssertionHandler that is called when an assert triggers.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_SetAssertionHandler
*/
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
/**
* Get a list of all assertion failures.
*
* This function gets all assertions triggered since the last call to
* SDL_ResetAssertionReport(), or the start of the program.
*
* The proper way to examine this data looks something like this:
*
* ```c
* const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) {
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
* item->condition, item->function, item->filename,
* item->linenum, item->trigger_count,
* item->always_ignore ? "yes" : "no");
* item = item->next;
* }
* ```
*
* \returns a list of all failed assertions or NULL if the list is empty. This
* memory should not be modified or freed by the application.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_ResetAssertionReport
*/
extern DECLSPEC const SDL_AssertData *SDLCALL SDL_GetAssertionReport(void);
/**
* Clear the list of all assertion failures.
*
* This function will clear the list of all assertions triggered up to that
* point. Immediately following this call, SDL_GetAssertionReport will return
* no items. In addition, any previously-triggered assertions will be reset to
* a trigger_count of zero, and their always_ignore state will be false.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetAssertionReport
*/
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
/* these had wrong naming conventions until 2.0.4. Please update your app! */
#define SDL_assert_state SDL_AssertState
#define SDL_assert_data SDL_AssertData
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

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

View File

@ -1,333 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_windows_h_
#define SDL_config_windows_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK,
* but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence.
* If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */
#if !defined(HAVE_WINSDKVER_H) && defined(__has_include)
#if __has_include(<winsdkver.h>)
#define HAVE_WINSDKVER_H 1
#endif
#endif
#ifdef HAVE_WINSDKVER_H
#include <winsdkver.h>
#endif
/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the
* Windows 10 SDK have broken declarations for the C API for DirectX 12. */
#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include)
#if __has_include(<sdkddkver.h>)
#define HAVE_SDKDDKVER_H 1
#endif
#endif
#ifdef HAVE_SDKDDKVER_H
#include <sdkddkver.h>
#endif
/* This is a set of defines to configure the SDL features */
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#else
#define HAVE_STDINT_H 1
#endif /* Visual Studio 2008 */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef _WIN64
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
#define HAVE_GCC_ATOMICS 1
#endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#ifndef __WATCOMC__
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
#define HAVE_D3D11_H 1
#define HAVE_ROAPI_H 1
#endif
#if defined(__has_include)
#if __has_include(<d3d12.h>) && __has_include(<d3d12sdklayers.h>)
#define HAVE_D3D12_H 1
#endif
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */
#define HAVE_SHELLSCALINGAPI_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_SENSORSAPI_H 1
#endif
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_IMMINTRIN_H 1
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
#if __has_include(<immintrin.h>)
#define HAVE_IMMINTRIN_H 1
#endif
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
/* OpenWatcom requires specific calling conventions for qsort and bsearch */
#ifndef __WATCOMC__
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#endif
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE__WCSDUP 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_FMOD 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#ifndef __WATCOMC__
#define HAVE_ACOSF 1
#define HAVE_ASINF 1
#define HAVE_ATANF 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COSF 1
#define HAVE_EXPF 1
#define HAVE_FABSF 1
#define HAVE_FLOORF 1
#define HAVE_FMODF 1
#define HAVE_LOGF 1
#define HAVE_LOG10F 1
#define HAVE_POWF 1
#define HAVE_SINF 1
#define HAVE_SQRTF 1
#define HAVE_TANF 1
#endif
#if defined(_MSC_VER)
/* These functions were added with the VC++ 2013 C runtime library */
#if _MSC_VER >= 1800
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#endif
/* This function is available with at least the VC++ 2008 C runtime library */
#if _MSC_VER >= 1400
#define HAVE__FSEEKI64 1
#endif
#ifdef _USE_MATH_DEFINES
#define HAVE_M_PI 1
#endif
#elif defined(__WATCOMC__)
#define HAVE__FSEEKI64 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_ROUND 1
#define HAVE_SCALBN 1
#define HAVE_TRUNC 1
#else
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif
/* Enable various audio drivers */
#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
#endif
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#ifndef __WINRT__
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
#else
#define SDL_SENSOR_DUMMY 1
#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
#define SDL_POWER_WINDOWS 1
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
#endif /* SDL_config_windows_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@ -1,300 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_endian.h
*
* Functions for reading and writing endian-specific values
*/
#ifndef SDL_endian_h_
#define SDL_endian_h_
#include "SDL_stdinc.h"
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifdef __clang__
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__)) _m_prefetch(void *__P) {
__builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */);
}
#endif /* __PRFCHWINTRIN_H */
#endif /* __clang__ */
#include <intrin.h>
#endif
/**
* \name The two types of endianness
*/
/* @{ */
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/* @} */
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
#ifdef __linux__
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__OpenBSD__) || defined(__DragonFly__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/endian.h>
#define SDL_BYTEORDER BYTE_ORDER
/* predefs from newer gcc and clang versions: */
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#else
#if defined(__hppa__) || defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || defined(__ppc__) || defined(__POWERPC__) || \
defined(__powerpc__) || defined(__PPC__) || defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */
/* predefs from newer gcc versions: */
#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#elif defined(__MAVERICK__)
/* For Maverick, float words are always little-endian. */
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
/* For FPA, float words are always big-endian. */
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
#else
/* By default, assume that floats words follow the memory system mode. */
#define SDL_FLOATWORDORDER SDL_BYTEORDER
#endif /* __FLOAT_WORD_ORDER__ */
#endif /* !SDL_FLOATWORDORDER */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_endian.h
*/
/* various modern compilers may have builtin swap */
#if defined(__GNUC__) || defined(__clang__)
#define HAS_BUILTIN_BSWAP16 \
(_SDL_HAS_BUILTIN(__builtin_bswap16)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
#define HAS_BUILTIN_BSWAP32 \
(_SDL_HAS_BUILTIN(__builtin_bswap32)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define HAS_BUILTIN_BSWAP64 \
(_SDL_HAS_BUILTIN(__builtin_bswap64)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
/* this one is broken */
#define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
#else
#define HAS_BUILTIN_BSWAP16 0
#define HAS_BUILTIN_BSWAP32 0
#define HAS_BUILTIN_BSWAP64 0
#define HAS_BROKEN_BSWAP 0
#endif
#if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) {
__asm__("xchgb %b0,%h0" : "=q"(x) : "0"(x));
return x;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) {
__asm__("xchgb %b0,%h0" : "=Q"(x) : "0"(x));
return x;
}
#elif (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) {
int result;
__asm__("rlwimi %0,%2,8,16,23" : "=&r"(result) : "0"(x >> 8), "r"(x));
return (Uint16)result;
}
#elif (defined(__m68k__) && !defined(__mcoldfire__))
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) {
__asm__("rorw #8,%0" : "=d"(x) : "0"(x) : "cc");
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint16 SDL_Swap16(Uint16);
#pragma aux SDL_Swap16 = "xchg al, ah" parm[ax] modify[ax];
#else
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); }
#endif
#if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) {
__asm__("bswap %0" : "=r"(x) : "0"(x));
return x;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) {
__asm__("bswapl %0" : "=r"(x) : "0"(x));
return x;
}
#elif (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) {
Uint32 result;
__asm__("rlwimi %0,%2,24,16,23" : "=&r"(result) : "0"(x >> 24), "r"(x));
__asm__("rlwimi %0,%2,8,8,15" : "=&r"(result) : "0"(result), "r"(x));
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result) : "0"(result), "r"(x));
return result;
}
#elif (defined(__m68k__) && !defined(__mcoldfire__))
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) {
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d"(x) : "0"(x) : "cc");
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint32 SDL_Swap32(Uint32);
#pragma aux SDL_Swap32 = "bswap eax" parm[eax] modify[eax];
#else
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) {
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x >> 24)));
}
#endif
#if HAS_BUILTIN_BSWAP64
#define SDL_Swap64(x) __builtin_bswap64(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) {
union {
struct {
Uint32 a, b;
} s;
Uint64 u;
} v;
v.u = x;
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" : "=r"(v.s.a), "=r"(v.s.b) : "0"(v.s.a), "1"(v.s.b));
return v.u;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) {
__asm__("bswapq %0" : "=r"(x) : "0"(x));
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint64 SDL_Swap64(Uint64);
#pragma aux SDL_Swap64 = "bswap eax" \
"bswap edx" \
"xchg eax,edx" parm[eax edx] modify[eax edx];
#else
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) {
Uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x >>= 32;
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x = SDL_Swap32(lo);
x <<= 32;
x |= SDL_Swap32(hi);
return (x);
}
#endif
SDL_FORCE_INLINE float SDL_SwapFloat(float x) {
union {
float f;
Uint32 ui32;
} swapper;
swapper.f = x;
swapper.ui32 = SDL_Swap32(swapper.ui32);
return swapper.f;
}
/* remove extra macros */
#undef HAS_BROKEN_BSWAP
#undef HAS_BUILTIN_BSWAP16
#undef HAS_BUILTIN_BSWAP32
#undef HAS_BUILTIN_BSWAP64
/**
* \name Swap to native
* Byteswap item from the specified endianness to the native endianness.
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
#define SDL_SwapFloatLE(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
#define SDL_SwapFloatBE(X) (X)
#endif
/* @} */ /* Swap to native */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_endian_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,344 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_keycode.h
*
* Defines constants which identify keyboard keys and modifiers.
*/
#ifndef SDL_keycode_h_
#define SDL_keycode_h_
#include "SDL_scancode.h"
#include "SDL_stdinc.h"
/**
* \brief The SDL virtual key representation.
*
* Values of this type are used to represent keyboard keys using the current
* layout of the keyboard. These values include Unicode values representing
* the unmodified character that would be generated by pressing the key, or
* an SDLK_* constant for those keys that do not generate characters.
*
* A special exception is the number keys at the top of the keyboard which
* map to SDLK_0...SDLK_9 on AZERTY layouts.
*/
typedef Sint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1 << 30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
typedef enum {
SDLK_UNKNOWN = 0,
SDLK_RETURN = '\r',
SDLK_ESCAPE = '\x1B',
SDLK_BACKSPACE = '\b',
SDLK_TAB = '\t',
SDLK_SPACE = ' ',
SDLK_EXCLAIM = '!',
SDLK_QUOTEDBL = '"',
SDLK_HASH = '#',
SDLK_PERCENT = '%',
SDLK_DOLLAR = '$',
SDLK_AMPERSAND = '&',
SDLK_QUOTE = '\'',
SDLK_LEFTPAREN = '(',
SDLK_RIGHTPAREN = ')',
SDLK_ASTERISK = '*',
SDLK_PLUS = '+',
SDLK_COMMA = ',',
SDLK_MINUS = '-',
SDLK_PERIOD = '.',
SDLK_SLASH = '/',
SDLK_0 = '0',
SDLK_1 = '1',
SDLK_2 = '2',
SDLK_3 = '3',
SDLK_4 = '4',
SDLK_5 = '5',
SDLK_6 = '6',
SDLK_7 = '7',
SDLK_8 = '8',
SDLK_9 = '9',
SDLK_COLON = ':',
SDLK_SEMICOLON = ';',
SDLK_LESS = '<',
SDLK_EQUALS = '=',
SDLK_GREATER = '>',
SDLK_QUESTION = '?',
SDLK_AT = '@',
/*
Skip uppercase letters
*/
SDLK_LEFTBRACKET = '[',
SDLK_BACKSLASH = '\\',
SDLK_RIGHTBRACKET = ']',
SDLK_CARET = '^',
SDLK_UNDERSCORE = '_',
SDLK_BACKQUOTE = '`',
SDLK_a = 'a',
SDLK_b = 'b',
SDLK_c = 'c',
SDLK_d = 'd',
SDLK_e = 'e',
SDLK_f = 'f',
SDLK_g = 'g',
SDLK_h = 'h',
SDLK_i = 'i',
SDLK_j = 'j',
SDLK_k = 'k',
SDLK_l = 'l',
SDLK_m = 'm',
SDLK_n = 'n',
SDLK_o = 'o',
SDLK_p = 'p',
SDLK_q = 'q',
SDLK_r = 'r',
SDLK_s = 's',
SDLK_t = 't',
SDLK_u = 'u',
SDLK_v = 'v',
SDLK_w = 'w',
SDLK_x = 'x',
SDLK_y = 'y',
SDLK_z = 'z',
SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
SDLK_DELETE = '\x7F',
SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
SDLK_KP_EQUALSAS400 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
SDLK_THOUSANDSSEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
SDLK_DECIMALSEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
SDLK_CURRENCYSUBUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
SDLK_KP_DBLAMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
SDLK_KP_VERTICALBAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
SDLK_KP_DBLVERTICALBAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
SDLK_KP_MEMSUBTRACT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
SDLK_KP_MEMMULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
SDLK_KP_HEXADECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
SDLK_BRIGHTNESSDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
SDLK_KBDILLUMTOGGLE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD),
SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT),
SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT),
SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL),
SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL)
} SDL_KeyCode;
/**
* \brief Enumeration of valid key mods (possibly OR'd together).
*/
typedef enum {
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LGUI = 0x0400,
KMOD_RGUI = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_SCROLL = 0x8000,
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
KMOD_ALT = KMOD_LALT | KMOD_RALT,
KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
KMOD_RESERVED = KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */
} SDL_Keymod;
#endif /* SDL_keycode_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,704 +0,0 @@
#ifndef __gles2_gl2_h_
#define __gles2_gl2_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright 2013-2020 The Khronos Group Inc.
** SPDX-License-Identifier: MIT
**
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** https://github.com/KhronosGroup/OpenGL-Registry
*/
/*#include <GLES2/gl2platform.h>*/
#ifndef GL_APIENTRYP
#define GL_APIENTRYP GL_APIENTRY *
#endif
#ifndef GL_GLES_PROTOTYPES
#define GL_GLES_PROTOTYPES 1
#endif
/* Generated on date 20220530 */
/* Generated C header for:
* API: gles2
* Profile: common
* Versions considered: 2\.[0-9]
* Versions emitted: .*
* Default extensions included: None
* Additional extensions included: _nomatch_^
* Extensions removed: _nomatch_^
*/
#ifndef GL_ES_VERSION_2_0
#define GL_ES_VERSION_2_0 1
/*#include <KHR/khrplatform.h>*/
typedef khronos_int8_t GLbyte;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
typedef khronos_int16_t GLshort;
typedef khronos_uint16_t GLushort;
typedef void GLvoid;
typedef struct __GLsync *GLsync;
typedef khronos_int64_t GLint64;
typedef khronos_uint64_t GLuint64;
typedef unsigned int GLenum;
typedef unsigned int GLuint;
typedef char GLchar;
typedef khronos_float_t GLfloat;
typedef khronos_ssize_t GLsizeiptr;
typedef khronos_intptr_t GLintptr;
typedef unsigned int GLbitfield;
typedef int GLint;
typedef unsigned char GLboolean;
typedef int GLsizei;
typedef khronos_uint8_t GLubyte;
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
#define GL_FALSE 0
#define GL_TRUE 1
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
#define GL_FUNC_ADD 0x8006
#define GL_BLEND_EQUATION 0x8009
#define GL_BLEND_EQUATION_RGB 0x8009
#define GL_BLEND_EQUATION_ALPHA 0x883D
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_COLOR 0x8005
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_STREAM_DRAW 0x88E0
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_BLEND 0x0BE2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
#define GL_SCISSOR_TEST 0x0C11
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_COVERAGE 0x80A0
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_OUT_OF_MEMORY 0x0505
#define GL_CW 0x0900
#define GL_CCW 0x0901
#define GL_LINE_WIDTH 0x0B21
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_CULL_FACE_MODE 0x0B45
#define GL_FRONT_FACE 0x0B46
#define GL_DEPTH_RANGE 0x0B70
#define GL_DEPTH_WRITEMASK 0x0B72
#define GL_DEPTH_CLEAR_VALUE 0x0B73
#define GL_DEPTH_FUNC 0x0B74
#define GL_STENCIL_CLEAR_VALUE 0x0B91
#define GL_STENCIL_FUNC 0x0B92
#define GL_STENCIL_FAIL 0x0B94
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GL_STENCIL_REF 0x0B97
#define GL_STENCIL_VALUE_MASK 0x0B93
#define GL_STENCIL_WRITEMASK 0x0B98
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
#define GL_STENCIL_BACK_REF 0x8CA3
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#define GL_VIEWPORT 0x0BA2
#define GL_SCISSOR_BOX 0x0C10
#define GL_COLOR_CLEAR_VALUE 0x0C22
#define GL_COLOR_WRITEMASK 0x0C23
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
#define GL_BLUE_BITS 0x0D54
#define GL_ALPHA_BITS 0x0D55
#define GL_DEPTH_BITS 0x0D56
#define GL_STENCIL_BITS 0x0D57
#define GL_POLYGON_OFFSET_UNITS 0x2A00
#define GL_POLYGON_OFFSET_FACTOR 0x8038
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
#define GL_GENERATE_MIPMAP_HINT 0x8192
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
#define GL_DEPTH_COMPONENT 0x1902
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190A
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define GL_MAX_VARYING_VECTORS 0x8DFC
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#define GL_SHADER_TYPE 0x8B4F
#define GL_DELETE_STATUS 0x8B80
#define GL_LINK_STATUS 0x8B82
#define GL_VALIDATE_STATUS 0x8B83
#define GL_ATTACHED_SHADERS 0x8B85
#define GL_ACTIVE_UNIFORMS 0x8B86
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#define GL_ACTIVE_ATTRIBUTES 0x8B89
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GL_CURRENT_PROGRAM 0x8B8D
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
#define GL_INVERT 0x150A
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
#define GL_TEXTURE 0x1702
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
#define GL_MIRRORED_REPEAT 0x8370
#define GL_FLOAT_VEC2 0x8B50
#define GL_FLOAT_VEC3 0x8B51
#define GL_FLOAT_VEC4 0x8B52
#define GL_INT_VEC2 0x8B53
#define GL_INT_VEC3 0x8B54
#define GL_INT_VEC4 0x8B55
#define GL_BOOL 0x8B56
#define GL_BOOL_VEC2 0x8B57
#define GL_BOOL_VEC3 0x8B58
#define GL_BOOL_VEC4 0x8B59
#define GL_FLOAT_MAT2 0x8B5A
#define GL_FLOAT_MAT3 0x8B5B
#define GL_FLOAT_MAT4 0x8B5C
#define GL_SAMPLER_2D 0x8B5E
#define GL_SAMPLER_CUBE 0x8B60
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
#define GL_COMPILE_STATUS 0x8B81
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_SHADER_SOURCE_LENGTH 0x8B88
#define GL_SHADER_COMPILER 0x8DFA
#define GL_SHADER_BINARY_FORMATS 0x8DF8
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
#define GL_LOW_FLOAT 0x8DF0
#define GL_MEDIUM_FLOAT 0x8DF1
#define GL_HIGH_FLOAT 0x8DF2
#define GL_LOW_INT 0x8DF3
#define GL_MEDIUM_INT 0x8DF4
#define GL_HIGH_INT 0x8DF5
#define GL_FRAMEBUFFER 0x8D40
#define GL_RENDERBUFFER 0x8D41
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#define GL_RGB565 0x8D62
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_STENCIL_INDEX8 0x8D48
#define GL_RENDERBUFFER_WIDTH 0x8D42
#define GL_RENDERBUFFER_HEIGHT 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_DEPTH_ATTACHMENT 0x8D00
#define GL_STENCIL_ATTACHMENT 0x8D20
#define GL_NONE 0
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
#define GL_FRAMEBUFFER_BINDING 0x8CA6
#define GL_RENDERBUFFER_BINDING 0x8CA7
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
typedef void(GL_APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture);
typedef void(GL_APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader);
typedef void(GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name);
typedef void(GL_APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer);
typedef void(GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
typedef void(GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer);
typedef void(GL_APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture);
typedef void(GL_APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void(GL_APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode);
typedef void(GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha);
typedef void(GL_APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);
typedef void(GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha,
GLenum dfactorAlpha);
typedef void(GL_APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
typedef void(GL_APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
typedef GLenum(GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target);
typedef void(GL_APIENTRYP PFNGLCLEARPROC)(GLbitfield mask);
typedef void(GL_APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void(GL_APIENTRYP PFNGLCLEARDEPTHFPROC)(GLfloat d);
typedef void(GL_APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s);
typedef void(GL_APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
typedef void(GL_APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader);
typedef void(GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLint border, GLsizei imageSize,
const void *data);
typedef void(GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format,
GLsizei imageSize, const void *data);
typedef void(GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border);
typedef void(GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x,
GLint y, GLsizei width, GLsizei height);
typedef GLuint(GL_APIENTRYP PFNGLCREATEPROGRAMPROC)(void);
typedef GLuint(GL_APIENTRYP PFNGLCREATESHADERPROC)(GLenum type);
typedef void(GL_APIENTRYP PFNGLCULLFACEPROC)(GLenum mode);
typedef void(GL_APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers);
typedef void(GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers);
typedef void(GL_APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program);
typedef void(GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers);
typedef void(GL_APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader);
typedef void(GL_APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures);
typedef void(GL_APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func);
typedef void(GL_APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag);
typedef void(GL_APIENTRYP PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f);
typedef void(GL_APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader);
typedef void(GL_APIENTRYP PFNGLDISABLEPROC)(GLenum cap);
typedef void(GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index);
typedef void(GL_APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count);
typedef void(GL_APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices);
typedef void(GL_APIENTRYP PFNGLENABLEPROC)(GLenum cap);
typedef void(GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index);
typedef void(GL_APIENTRYP PFNGLFINISHPROC)(void);
typedef void(GL_APIENTRYP PFNGLFLUSHPROC)(void);
typedef void(GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget,
GLuint renderbuffer);
typedef void(GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget,
GLuint texture, GLint level);
typedef void(GL_APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode);
typedef void(GL_APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers);
typedef void(GL_APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target);
typedef void(GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers);
typedef void(GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers);
typedef void(GL_APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures);
typedef void(GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length,
GLint *size, GLenum *type, GLchar *name);
typedef void(GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length,
GLint *size, GLenum *type, GLchar *name);
typedef void(GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count,
GLuint *shaders);
typedef GLint(GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name);
typedef void(GL_APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data);
typedef void(GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params);
typedef GLenum(GL_APIENTRYP PFNGLGETERRORPROC)(void);
typedef void(GL_APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data);
typedef void(GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname,
GLint *params);
typedef void(GL_APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data);
typedef void(GL_APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params);
typedef void(GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length,
GLchar *infoLog);
typedef void(GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params);
typedef void(GL_APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params);
typedef void(GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void(GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range,
GLint *precision);
typedef void(GL_APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC)(GLenum name);
typedef void(GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params);
typedef void(GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params);
typedef void(GL_APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params);
typedef void(GL_APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params);
typedef GLint(GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name);
typedef void(GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params);
typedef void(GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params);
typedef void(GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer);
typedef void(GL_APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode);
typedef GLboolean(GL_APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer);
typedef GLboolean(GL_APIENTRYP PFNGLISENABLEDPROC)(GLenum cap);
typedef GLboolean(GL_APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer);
typedef GLboolean(GL_APIENTRYP PFNGLISPROGRAMPROC)(GLuint program);
typedef GLboolean(GL_APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer);
typedef GLboolean(GL_APIENTRYP PFNGLISSHADERPROC)(GLuint shader);
typedef GLboolean(GL_APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture);
typedef void(GL_APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width);
typedef void(GL_APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program);
typedef void(GL_APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);
typedef void(GL_APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units);
typedef void(GL_APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
GLenum type, void *pixels);
typedef void(GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC)(void);
typedef void(GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width,
GLsizei height);
typedef void(GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert);
typedef void(GL_APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
typedef void(GL_APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryFormat,
const void *binary, GLsizei length);
typedef void(GL_APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const *string,
const GLint *length);
typedef void(GL_APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);
typedef void(GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask);
typedef void(GL_APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask);
typedef void(GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask);
typedef void(GL_APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);
typedef void(GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
typedef void(GL_APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width,
GLsizei height, GLint border, GLenum format, GLenum type,
const void *pixels);
typedef void(GL_APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);
typedef void(GL_APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params);
typedef void(GL_APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);
typedef void(GL_APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params);
typedef void(GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format, GLenum type,
const void *pixels);
typedef void(GL_APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0);
typedef void(GL_APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0);
typedef void(GL_APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1);
typedef void(GL_APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1);
typedef void(GL_APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef void(GL_APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2);
typedef void(GL_APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
typedef void(GL_APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
typedef void(GL_APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value);
typedef void(GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
typedef void(GL_APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program);
typedef void(GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v);
typedef void(GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized,
GLsizei stride, const void *pointer);
typedef void(GL_APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
#if GL_GLES_PROTOTYPES
GL_APICALL void GL_APIENTRY glActiveTexture(GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShader(GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
GL_APICALL void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer);
GL_APICALL void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer);
GL_APICALL void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glBindTexture(GLenum target, GLuint texture);
GL_APICALL void GL_APIENTRY glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GL_APICALL void GL_APIENTRY glBlendEquation(GLenum mode);
GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
GL_APICALL void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor);
GL_APICALL void GL_APIENTRY glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha,
GLenum dfactorAlpha);
GL_APICALL void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
GL_APICALL void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target);
GL_APICALL void GL_APIENTRY glClear(GLbitfield mask);
GL_APICALL void GL_APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
GL_APICALL void GL_APIENTRY glClearDepthf(GLfloat d);
GL_APICALL void GL_APIENTRY glClearStencil(GLint s);
GL_APICALL void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_APICALL void GL_APIENTRY glCompileShader(GLuint shader);
GL_APICALL void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
GLsizei height, GLint border, GLsizei imageSize, const void *data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format, GLsizei imageSize,
const void *data);
GL_APICALL void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border);
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x,
GLint y, GLsizei width, GLsizei height);
GL_APICALL GLuint GL_APIENTRY glCreateProgram(void);
GL_APICALL GLuint GL_APIENTRY glCreateShader(GLenum type);
GL_APICALL void GL_APIENTRY glCullFace(GLenum mode);
GL_APICALL void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers);
GL_APICALL void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
GL_APICALL void GL_APIENTRY glDeleteProgram(GLuint program);
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
GL_APICALL void GL_APIENTRY glDeleteShader(GLuint shader);
GL_APICALL void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures);
GL_APICALL void GL_APIENTRY glDepthFunc(GLenum func);
GL_APICALL void GL_APIENTRY glDepthMask(GLboolean flag);
GL_APICALL void GL_APIENTRY glDepthRangef(GLfloat n, GLfloat f);
GL_APICALL void GL_APIENTRY glDetachShader(GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glDisable(GLenum cap);
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray(GLuint index);
GL_APICALL void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count);
GL_APICALL void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
GL_APICALL void GL_APIENTRY glEnable(GLenum cap);
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray(GLuint index);
GL_APICALL void GL_APIENTRY glFinish(void);
GL_APICALL void GL_APIENTRY glFlush(void);
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget,
GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
GLint level);
GL_APICALL void GL_APIENTRY glFrontFace(GLenum mode);
GL_APICALL void GL_APIENTRY glGenBuffers(GLsizei n, GLuint *buffers);
GL_APICALL void GL_APIENTRY glGenerateMipmap(GLenum target);
GL_APICALL void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint *framebuffers);
GL_APICALL void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
GL_APICALL void GL_APIENTRY glGenTextures(GLsizei n, GLuint *textures);
GL_APICALL void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length,
GLint *size, GLenum *type, GLchar *name);
GL_APICALL void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length,
GLint *size, GLenum *type, GLchar *name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
GL_APICALL GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar *name);
GL_APICALL void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean *data);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
GL_APICALL GLenum GL_APIENTRY glGetError(void);
GL_APICALL void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat *data);
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname,
GLint *params);
GL_APICALL void GL_APIENTRY glGetIntegerv(GLenum pname, GLint *data);
GL_APICALL void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range,
GLint *precision);
GL_APICALL void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
GL_APICALL const GLubyte *GL_APIENTRY glGetString(GLenum name);
GL_APICALL void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint *params);
GL_APICALL GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar *name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);
GL_APICALL void GL_APIENTRY glHint(GLenum target, GLenum mode);
GL_APICALL GLboolean GL_APIENTRY glIsBuffer(GLuint buffer);
GL_APICALL GLboolean GL_APIENTRY glIsEnabled(GLenum cap);
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer);
GL_APICALL GLboolean GL_APIENTRY glIsProgram(GLuint program);
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer);
GL_APICALL GLboolean GL_APIENTRY glIsShader(GLuint shader);
GL_APICALL GLboolean GL_APIENTRY glIsTexture(GLuint texture);
GL_APICALL void GL_APIENTRY glLineWidth(GLfloat width);
GL_APICALL void GL_APIENTRY glLinkProgram(GLuint program);
GL_APICALL void GL_APIENTRY glPixelStorei(GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units);
GL_APICALL void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
void *pixels);
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler(void);
GL_APICALL void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSampleCoverage(GLfloat value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryFormat,
const void *binary, GLsizei length);
GL_APICALL void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string,
const GLint *length);
GL_APICALL void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMask(GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width,
GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
GL_APICALL void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param);
GL_APICALL void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
GL_APICALL void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint *params);
GL_APICALL void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type, const void *pixels);
GL_APICALL void GL_APIENTRY glUniform1f(GLint location, GLfloat v0);
GL_APICALL void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform1i(GLint location, GLint v0);
GL_APICALL void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniform2f(GLint location, GLfloat v0, GLfloat v1);
GL_APICALL void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform2i(GLint location, GLint v0, GLint v1);
GL_APICALL void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
GL_APICALL void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
GL_APICALL void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
GL_APICALL void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
GL_APICALL void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint *value);
GL_APICALL void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
GL_APICALL void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
GL_APICALL void GL_APIENTRY glUseProgram(GLuint program);
GL_APICALL void GL_APIENTRY glValidateProgram(GLuint program);
GL_APICALL void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x);
GL_APICALL void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat *v);
GL_APICALL void GL_APIENTRY glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized,
GLsizei stride, const void *pointer);
GL_APICALL void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
#endif
#endif /* GL_ES_VERSION_2_0 */
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,579 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_pixels.h
*
* Header for the enumerated pixel format definitions.
*/
#ifndef SDL_pixels_h_
#define SDL_pixels_h_
#include "SDL_endian.h"
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \name Transparency definitions
*
* These define alpha as the opacity of a surface.
*/
/* @{ */
#define SDL_ALPHA_OPAQUE 255
#define SDL_ALPHA_TRANSPARENT 0
/* @} */
/** Pixel type. */
typedef enum {
SDL_PIXELTYPE_UNKNOWN,
SDL_PIXELTYPE_INDEX1,
SDL_PIXELTYPE_INDEX4,
SDL_PIXELTYPE_INDEX8,
SDL_PIXELTYPE_PACKED8,
SDL_PIXELTYPE_PACKED16,
SDL_PIXELTYPE_PACKED32,
SDL_PIXELTYPE_ARRAYU8,
SDL_PIXELTYPE_ARRAYU16,
SDL_PIXELTYPE_ARRAYU32,
SDL_PIXELTYPE_ARRAYF16,
SDL_PIXELTYPE_ARRAYF32,
/* This must be at the end of the list to avoid breaking the existing ABI */
SDL_PIXELTYPE_INDEX2
} SDL_PixelType;
/** Bitmap pixel order, high bit -> low bit. */
typedef enum { SDL_BITMAPORDER_NONE, SDL_BITMAPORDER_4321, SDL_BITMAPORDER_1234 } SDL_BitmapOrder;
/** Packed component order, high bit -> low bit. */
typedef enum {
SDL_PACKEDORDER_NONE,
SDL_PACKEDORDER_XRGB,
SDL_PACKEDORDER_RGBX,
SDL_PACKEDORDER_ARGB,
SDL_PACKEDORDER_RGBA,
SDL_PACKEDORDER_XBGR,
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 */
typedef enum {
SDL_ARRAYORDER_NONE,
SDL_ARRAYORDER_RGB,
SDL_ARRAYORDER_RGBA,
SDL_ARRAYORDER_ARGB,
SDL_ARRAYORDER_BGR,
SDL_ARRAYORDER_BGRA,
SDL_ARRAYORDER_ABGR
} SDL_ArrayOrder;
/** Packed component layout. */
typedef enum {
SDL_PACKEDLAYOUT_NONE,
SDL_PACKEDLAYOUT_332,
SDL_PACKEDLAYOUT_4444,
SDL_PACKEDLAYOUT_1555,
SDL_PACKEDLAYOUT_5551,
SDL_PACKEDLAYOUT_565,
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)
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | ((bits) << 8) | ((bytes) << 0))
#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F)
#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F)
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
#define SDL_BYTESPERPIXEL(X) \
(SDL_ISPIXELFORMAT_FOURCC(X) \
? ((((X) == SDL_PIXELFORMAT_YUY2) || ((X) == SDL_PIXELFORMAT_UYVY) || ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) \
: (((X) >> 0) & 0xFF))
#define SDL_ISPIXELFORMAT_INDEXED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
#define SDL_ISPIXELFORMAT_PACKED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32)))
#define SDL_ISPIXELFORMAT_ARRAY(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32)))
#define SDL_ISPIXELFORMAT_ALPHA(format) \
((SDL_ISPIXELFORMAT_PACKED(format) && \
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \
(SDL_ISPIXELFORMAT_ARRAY(format) && \
((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA))))
/* The flag is set to 1 because 0x1? is not in the printable ASCII range */
#define SDL_ISPIXELFORMAT_FOURCC(format) ((format) && (SDL_PIXELFLAG(format) != 1))
/* Note: If you modify this list, update SDL_GetPixelFormatName() */
typedef enum {
SDL_PIXELFORMAT_UNKNOWN,
SDL_PIXELFORMAT_INDEX1LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, 1, 0),
SDL_PIXELFORMAT_INDEX1MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0),
SDL_PIXELFORMAT_INDEX2LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0, 2, 0),
SDL_PIXELFORMAT_INDEX2MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0, 2, 0),
SDL_PIXELFORMAT_INDEX4LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0),
SDL_PIXELFORMAT_INDEX4MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, 4, 0),
SDL_PIXELFORMAT_INDEX8 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1),
SDL_PIXELFORMAT_RGB332 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_332, 8, 1),
SDL_PIXELFORMAT_XRGB4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444,
SDL_PIXELFORMAT_XBGR4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_4444, 12, 2),
SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444,
SDL_PIXELFORMAT_XRGB1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_1555, 15, 2),
SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555,
SDL_PIXELFORMAT_XBGR1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_1555, 15, 2),
SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555,
SDL_PIXELFORMAT_ARGB4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_RGBA4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_ABGR4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_BGRA4444 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_4444, 16, 2),
SDL_PIXELFORMAT_ARGB1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_1555, 16, 2),
SDL_PIXELFORMAT_RGBA5551 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_5551, 16, 2),
SDL_PIXELFORMAT_ABGR1555 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1555, 16, 2),
SDL_PIXELFORMAT_BGRA5551 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_5551, 16, 2),
SDL_PIXELFORMAT_RGB565 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_565, 16, 2),
SDL_PIXELFORMAT_BGR565 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_565, 16, 2),
SDL_PIXELFORMAT_RGB24 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, 24, 3),
SDL_PIXELFORMAT_BGR24 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, 24, 3),
SDL_PIXELFORMAT_XRGB8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_RGBX8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_XBGR8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888,
SDL_PIXELFORMAT_BGRX8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, SDL_PACKEDLAYOUT_8888, 24, 4),
SDL_PIXELFORMAT_ARGB8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_RGBA8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_ABGR8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_BGRA8888 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_8888, 32, 4),
SDL_PIXELFORMAT_ARGB2101010 =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4),
/* Aliases for RGBA byte arrays of color data, for the current platform */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR8888,
#else
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888,
#endif
SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'),
SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */
SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'),
SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'),
SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'),
SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'),
SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'),
SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */
SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'),
SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */
SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ')
} SDL_PixelFormatEnum;
/**
* The bits of this structure can be directly reinterpreted as an integer-packed
* color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
* on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
*/
typedef struct SDL_Color {
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 a;
} SDL_Color;
#define SDL_Colour SDL_Color
typedef struct SDL_Palette {
int ncolors;
SDL_Color *colors;
Uint32 version;
int refcount;
} SDL_Palette;
/**
* \note Everything in the pixel format structure is read-only.
*/
typedef struct SDL_PixelFormat {
Uint32 format;
SDL_Palette *palette;
Uint8 BitsPerPixel;
Uint8 BytesPerPixel;
Uint8 padding[2];
Uint32 Rmask;
Uint32 Gmask;
Uint32 Bmask;
Uint32 Amask;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
Uint8 Aloss;
Uint8 Rshift;
Uint8 Gshift;
Uint8 Bshift;
Uint8 Ashift;
int refcount;
struct SDL_PixelFormat *next;
} SDL_PixelFormat;
/**
* Get the human readable name of a pixel format.
*
* \param format the pixel format to query
* \returns the human readable name of the specified pixel format or
* `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC const char *SDLCALL SDL_GetPixelFormatName(Uint32 format);
/**
* Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
*
* \param format one of the SDL_PixelFormatEnum values
* \param bpp a bits per pixel value; usually 15, 16, or 32
* \param Rmask a pointer filled in with the red mask for the format
* \param Gmask a pointer filled in with the green mask for the format
* \param Bmask a pointer filled in with the blue mask for the format
* \param Amask a pointer filled in with the alpha mask for the format
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
* possible; call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_MasksToPixelFormatEnum
*/
extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask,
Uint32 *Bmask, Uint32 *Amask);
/**
* Convert a bpp value and RGBA masks to an enumerated pixel format.
*
* This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
* possible.
*
* \param bpp a bits per pixel value; usually 15, 16, or 32
* \param Rmask the red mask for the format
* \param Gmask the green mask for the format
* \param Bmask the blue mask for the format
* \param Amask the alpha mask for the format
* \returns one of the SDL_PixelFormatEnum values
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_PixelFormatEnumToMasks
*/
extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
Uint32 Amask);
/**
* Create an SDL_PixelFormat structure corresponding to a pixel format.
*
* Returned structure may come from a shared global cache (i.e. not newly
* allocated), and hence should not be modified, especially the palette. Weird
* errors such as `Blit combination not supported` may occur.
*
* \param pixel_format one of the SDL_PixelFormatEnum values
* \returns the new SDL_PixelFormat structure or NULL on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_FreeFormat
*/
extern DECLSPEC SDL_PixelFormat *SDLCALL SDL_AllocFormat(Uint32 pixel_format);
/**
* Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().
*
* \param format the SDL_PixelFormat structure to free
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AllocFormat
*/
extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
/**
* Create a palette structure with the specified number of color entries.
*
* The palette entries are initialized to white.
*
* \param ncolors represents the number of color entries in the color palette
* \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
* there wasn't enough memory); call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_FreePalette
*/
extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
/**
* Set the palette for a pixel format structure.
*
* \param format the SDL_PixelFormat structure that will use the palette
* \param palette the SDL_Palette structure that will be used
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AllocPalette
* \sa SDL_FreePalette
*/
extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette);
/**
* Set a range of colors in a palette.
*
* \param palette the SDL_Palette structure to modify
* \param colors an array of SDL_Color structures to copy into the palette
* \param firstcolor the index of the first palette entry to modify
* \param ncolors the number of entries to modify
* \returns 0 on success or a negative error code if not all of the colors
* could be set; call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AllocPalette
* \sa SDL_CreateRGBSurface
*/
extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor,
int ncolors);
/**
* Free a palette created with SDL_AllocPalette().
*
* \param palette the SDL_Palette structure to be freed
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AllocPalette
*/
extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette *palette);
/**
* Map an RGB triple to an opaque pixel value for a given pixel format.
*
* This function maps the RGB color value to the specified pixel format and
* returns the pixel value best approximating the given RGB color value for
* the given pixel format.
*
* If the format has a palette (8-bit) the index of the closest matching color
* in the palette will be returned.
*
* If the specified pixel format has an alpha component it will be returned as
* all 1 bits (fully opaque).
*
* If the pixel format bpp (color depth) is less than 32-bpp then the unused
* upper bits of the return value can safely be ignored (e.g., with a 16-bpp
* format the return value can be assigned to a Uint16, and similarly a Uint8
* for an 8-bpp format).
*
* \param format an SDL_PixelFormat structure describing the pixel format
* \param r the red component of the pixel in the range 0-255
* \param g the green component of the pixel in the range 0-255
* \param b the blue component of the pixel in the range 0-255
* \returns a pixel value
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetRGB
* \sa SDL_GetRGBA
* \sa SDL_MapRGBA
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
/**
* Map an RGBA quadruple to a pixel value for a given pixel format.
*
* This function maps the RGBA color value to the specified pixel format and
* returns the pixel value best approximating the given RGBA color value for
* the given pixel format.
*
* If the specified pixel format has no alpha component the alpha value will
* be ignored (as it will be in formats with a palette).
*
* If the format has a palette (8-bit) the index of the closest matching color
* in the palette will be returned.
*
* If the pixel format bpp (color depth) is less than 32-bpp then the unused
* upper bits of the return value can safely be ignored (e.g., with a 16-bpp
* format the return value can be assigned to a Uint16, and similarly a Uint8
* for an 8-bpp format).
*
* \param format an SDL_PixelFormat structure describing the format of the
* pixel
* \param r the red component of the pixel in the range 0-255
* \param g the green component of the pixel in the range 0-255
* \param b the blue component of the pixel in the range 0-255
* \param a the alpha component of the pixel in the range 0-255
* \returns a pixel value
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetRGB
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/**
* Get RGB values from a pixel in the specified format.
*
* This function uses the entire 8-bit [0..255] range when converting color
* components from pixel formats with less than 8-bits per RGB component
* (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
*
* \param pixel a pixel value
* \param format an SDL_PixelFormat structure describing the format of the
* pixel
* \param r a pointer filled in with the red component
* \param g a pointer filled in with the green component
* \param b a pointer filled in with the blue component
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapRGBA
*/
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b);
/**
* Get RGBA values from a pixel in the specified format.
*
* This function uses the entire 8-bit [0..255] range when converting color
* components from pixel formats with less than 8-bits per RGB component
* (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
*
* If the surface has no alpha component, the alpha will be returned as 0xff
* (100% opaque).
*
* \param pixel a pixel value
* \param format an SDL_PixelFormat structure describing the format of the
* pixel
* \param r a pointer filled in with the red component
* \param g a pointer filled in with the green component
* \param b a pointer filled in with the blue component
* \param a a pointer filled in with the alpha component
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetRGB
* \sa SDL_MapRGB
* \sa SDL_MapRGBA
*/
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b,
Uint8 *a);
/**
* Calculate a 256 entry gamma ramp for a gamma value.
*
* \param gamma a gamma value where 0.0 is black and 1.0 is identity
* \param ramp an array of 256 values filled in with the gamma ramp
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_SetWindowGammaRamp
*/
extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 *ramp);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_pixels_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,276 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_platform.h
*
* Try to get a standard set of platform defines.
*/
#ifndef SDL_platform_h_
#define SDL_platform_h_
#if defined(_AIX)
#undef __AIX__
#define __AIX__ 1
#endif
#if defined(__HAIKU__)
#undef __HAIKU__
#define __HAIKU__ 1
#endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
#undef __BSDI__
#define __BSDI__ 1
#endif
#if defined(_arch_dreamcast)
#undef __DREAMCAST__
#define __DREAMCAST__ 1
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#undef __FREEBSD__
#define __FREEBSD__ 1
#endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
#undef __HPUX__
#define __HPUX__ 1
#endif
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
#undef __IRIX__
#define __IRIX__ 1
#endif
#if (defined(linux) || defined(__linux) || defined(__linux__))
#undef __LINUX__
#define __LINUX__ 1
#endif
#if defined(ANDROID) || defined(__ANDROID__)
#undef __ANDROID__
#undef __LINUX__ /* do we need to do this? */
#define __ANDROID__ 1
#endif
#if defined(__NGAGE__)
#undef __NGAGE__
#define __NGAGE__ 1
#endif
#if defined(__APPLE__)
/* lets us know what version of Mac OS X we're compiling on */
#include <AvailabilityMacros.h>
#ifndef __has_extension /* Older compilers don't support this */
#define __has_extension(x) 0
#include <TargetConditionals.h>
#undef __has_extension
#else
#include <TargetConditionals.h>
#endif
/* Fix building with older SDKs that don't define these
See this for more information:
https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets
*/
#ifndef TARGET_OS_MACCATALYST
#define TARGET_OS_MACCATALYST 0
#endif
#ifndef TARGET_OS_IOS
#define TARGET_OS_IOS 0
#endif
#ifndef TARGET_OS_IPHONE
#define TARGET_OS_IPHONE 0
#endif
#ifndef TARGET_OS_TV
#define TARGET_OS_TV 0
#endif
#ifndef TARGET_OS_SIMULATOR
#define TARGET_OS_SIMULATOR 0
#endif
#if TARGET_OS_TV
#undef __TVOS__
#define __TVOS__ 1
#endif
#if TARGET_OS_IPHONE
/* if compiling for iOS */
#undef __IPHONEOS__
#define __IPHONEOS__ 1
#undef __MACOSX__
#else
/* if not compiling for iOS */
#undef __MACOSX__
#define __MACOSX__ 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
#error SDL for Mac OS X only supports deploying on 10.7 and above.
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */
#endif /* TARGET_OS_IPHONE */
#endif /* defined(__APPLE__) */
#if defined(__NetBSD__)
#undef __NETBSD__
#define __NETBSD__ 1
#endif
#if defined(__OpenBSD__)
#undef __OPENBSD__
#define __OPENBSD__ 1
#endif
#if defined(__OS2__) || defined(__EMX__)
#undef __OS2__
#define __OS2__ 1
#endif
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
#undef __OSF__
#define __OSF__ 1
#endif
#if defined(__QNXNTO__)
#undef __QNXNTO__
#define __QNXNTO__ 1
#endif
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
#undef __RISCOS__
#define __RISCOS__ 1
#endif
#if defined(__sun) && defined(__SVR4)
#undef __SOLARIS__
#define __SOLARIS__ 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */
#if defined(_MSC_VER) && defined(__has_include)
#if __has_include(<winapifamily.h>)
#define HAVE_WINAPIFAMILY_H 1
#else
#define HAVE_WINAPIFAMILY_H 0
#endif
/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */
#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */
#define HAVE_WINAPIFAMILY_H 1
#else
#define HAVE_WINAPIFAMILY_H 0
#endif
#if HAVE_WINAPIFAMILY_H
#include <winapifamily.h>
#define WINAPI_FAMILY_WINRT \
(!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP))
#else
#define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */
#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0
#endif
#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
#undef __WINGDK__
#define __WINGDK__ 1
#elif defined(_GAMING_XBOX_XBOXONE)
#undef __XBOXONE__
#define __XBOXONE__ 1
#elif defined(_GAMING_XBOX_SCARLETT)
#undef __XBOXSERIES__
#define __XBOXSERIES__ 1
#else
#undef __WINDOWS__
#define __WINDOWS__ 1
#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#if defined(__WINDOWS__)
#undef __WIN32__
#define __WIN32__ 1
#endif
/* This is to support generic "any GDK" separate from a platform-specific GDK */
#if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#undef __GDK__
#define __GDK__ 1
#endif
#if defined(__PSP__) || defined(__psp__)
#ifdef __PSP__
#undef __PSP__
#endif
#define __PSP__ 1
#endif
#if defined(PS2)
#define __PS2__ 1
#endif
/* The NACL compiler defines __native_client__ and __pnacl__
* Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi
*/
#if defined(__native_client__)
#undef __LINUX__
#undef __NACL__
#define __NACL__ 1
#endif
#if defined(__pnacl__)
#undef __LINUX__
#undef __PNACL__
#define __PNACL__ 1
/* PNACL with newlib supports static linking only */
#define __SDL_NOGETPROCADDR__
#endif
#if defined(__vita__)
#define __VITA__ 1
#endif
#if defined(__3DS__)
#undef __3DS__
#define __3DS__ 1
#endif
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* Get the name of the platform.
*
* Here are the names returned for some (but not all) supported platforms:
*
* - "Windows"
* - "Mac OS X"
* - "Linux"
* - "iOS"
* - "Android"
*
* \returns the name of the platform. If the correct platform name is not
* available, returns a string beginning with the text "Unknown".
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC const char *SDLCALL SDL_GetPlatform(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_platform_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,7 +0,0 @@
/* Generated by updaterev.sh, do not edit */
#ifdef SDL_VENDOR_INFO
#define SDL_REVISION "SDL-release-2.30.5-0-g2eef7ca47 (" SDL_VENDOR_INFO ")"
#else
#define SDL_REVISION "SDL-release-2.30.5-0-g2eef7ca47"
#endif
#define SDL_REVISION_NUMBER 0

View File

@ -1,437 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_scancode.h
*
* Defines keyboard scancodes.
*/
#ifndef SDL_scancode_h_
#define SDL_scancode_h_
#include "SDL_stdinc.h"
/**
* \brief The SDL keyboard scancode representation.
*
* Values of this type are used to represent keyboard keys, among other places
* in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
* SDL_Event structure.
*
* The values in this enumeration are based on the USB usage page standard:
* https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
*/
typedef enum {
SDL_SCANCODE_UNKNOWN = 0,
/**
* \name Usage page 0x07
*
* These values are from usage page 0x07 (USB keyboard page).
*/
/* @{ */
SDL_SCANCODE_A = 4,
SDL_SCANCODE_B = 5,
SDL_SCANCODE_C = 6,
SDL_SCANCODE_D = 7,
SDL_SCANCODE_E = 8,
SDL_SCANCODE_F = 9,
SDL_SCANCODE_G = 10,
SDL_SCANCODE_H = 11,
SDL_SCANCODE_I = 12,
SDL_SCANCODE_J = 13,
SDL_SCANCODE_K = 14,
SDL_SCANCODE_L = 15,
SDL_SCANCODE_M = 16,
SDL_SCANCODE_N = 17,
SDL_SCANCODE_O = 18,
SDL_SCANCODE_P = 19,
SDL_SCANCODE_Q = 20,
SDL_SCANCODE_R = 21,
SDL_SCANCODE_S = 22,
SDL_SCANCODE_T = 23,
SDL_SCANCODE_U = 24,
SDL_SCANCODE_V = 25,
SDL_SCANCODE_W = 26,
SDL_SCANCODE_X = 27,
SDL_SCANCODE_Y = 28,
SDL_SCANCODE_Z = 29,
SDL_SCANCODE_1 = 30,
SDL_SCANCODE_2 = 31,
SDL_SCANCODE_3 = 32,
SDL_SCANCODE_4 = 33,
SDL_SCANCODE_5 = 34,
SDL_SCANCODE_6 = 35,
SDL_SCANCODE_7 = 36,
SDL_SCANCODE_8 = 37,
SDL_SCANCODE_9 = 38,
SDL_SCANCODE_0 = 39,
SDL_SCANCODE_RETURN = 40,
SDL_SCANCODE_ESCAPE = 41,
SDL_SCANCODE_BACKSPACE = 42,
SDL_SCANCODE_TAB = 43,
SDL_SCANCODE_SPACE = 44,
SDL_SCANCODE_MINUS = 45,
SDL_SCANCODE_EQUALS = 46,
SDL_SCANCODE_LEFTBRACKET = 47,
SDL_SCANCODE_RIGHTBRACKET = 48,
SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
* key on ISO keyboards and at the right end
* of the QWERTY row on ANSI keyboards.
* Produces REVERSE SOLIDUS (backslash) and
* VERTICAL LINE in a US layout, REVERSE
* SOLIDUS and VERTICAL LINE in a UK Mac
* layout, NUMBER SIGN and TILDE in a UK
* Windows layout, DOLLAR SIGN and POUND SIGN
* in a Swiss German layout, NUMBER SIGN and
* APOSTROPHE in a German layout, GRAVE
* ACCENT and POUND SIGN in a French Mac
* layout, and ASTERISK and MICRO SIGN in a
* French Windows layout.
*/
SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
* instead of 49 for the same key, but all
* OSes I've seen treat the two codes
* identically. So, as an implementor, unless
* your keyboard generates both of those
* codes and your OS treats them differently,
* you should generate SDL_SCANCODE_BACKSLASH
* instead of this code. As a user, you
* should not rely on this code because SDL
* will never generate it with most (all?)
* keyboards.
*/
SDL_SCANCODE_SEMICOLON = 51,
SDL_SCANCODE_APOSTROPHE = 52,
SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
* and ISO keyboards). Produces GRAVE ACCENT and
* TILDE in a US Windows layout and in US and UK
* Mac layouts on ANSI keyboards, GRAVE ACCENT
* and NOT SIGN in a UK Windows layout, SECTION
* SIGN and PLUS-MINUS SIGN in US and UK Mac
* layouts on ISO keyboards, SECTION SIGN and
* DEGREE SIGN in a Swiss German layout (Mac:
* only on ISO keyboards), CIRCUMFLEX ACCENT and
* DEGREE SIGN in a German layout (Mac: only on
* ISO keyboards), SUPERSCRIPT TWO and TILDE in a
* French Windows layout, COMMERCIAL AT and
* NUMBER SIGN in a French Mac layout on ISO
* keyboards, and LESS-THAN SIGN and GREATER-THAN
* SIGN in a Swiss German, German, or French Mac
* layout on ANSI keyboards.
*/
SDL_SCANCODE_COMMA = 54,
SDL_SCANCODE_PERIOD = 55,
SDL_SCANCODE_SLASH = 56,
SDL_SCANCODE_CAPSLOCK = 57,
SDL_SCANCODE_F1 = 58,
SDL_SCANCODE_F2 = 59,
SDL_SCANCODE_F3 = 60,
SDL_SCANCODE_F4 = 61,
SDL_SCANCODE_F5 = 62,
SDL_SCANCODE_F6 = 63,
SDL_SCANCODE_F7 = 64,
SDL_SCANCODE_F8 = 65,
SDL_SCANCODE_F9 = 66,
SDL_SCANCODE_F10 = 67,
SDL_SCANCODE_F11 = 68,
SDL_SCANCODE_F12 = 69,
SDL_SCANCODE_PRINTSCREEN = 70,
SDL_SCANCODE_SCROLLLOCK = 71,
SDL_SCANCODE_PAUSE = 72,
SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
does send code 73, not 117) */
SDL_SCANCODE_HOME = 74,
SDL_SCANCODE_PAGEUP = 75,
SDL_SCANCODE_DELETE = 76,
SDL_SCANCODE_END = 77,
SDL_SCANCODE_PAGEDOWN = 78,
SDL_SCANCODE_RIGHT = 79,
SDL_SCANCODE_LEFT = 80,
SDL_SCANCODE_DOWN = 81,
SDL_SCANCODE_UP = 82,
SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
*/
SDL_SCANCODE_KP_DIVIDE = 84,
SDL_SCANCODE_KP_MULTIPLY = 85,
SDL_SCANCODE_KP_MINUS = 86,
SDL_SCANCODE_KP_PLUS = 87,
SDL_SCANCODE_KP_ENTER = 88,
SDL_SCANCODE_KP_1 = 89,
SDL_SCANCODE_KP_2 = 90,
SDL_SCANCODE_KP_3 = 91,
SDL_SCANCODE_KP_4 = 92,
SDL_SCANCODE_KP_5 = 93,
SDL_SCANCODE_KP_6 = 94,
SDL_SCANCODE_KP_7 = 95,
SDL_SCANCODE_KP_8 = 96,
SDL_SCANCODE_KP_9 = 97,
SDL_SCANCODE_KP_0 = 98,
SDL_SCANCODE_KP_PERIOD = 99,
SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
* keyboards have over ANSI ones,
* located between left shift and Y.
* Produces GRAVE ACCENT and TILDE in a
* US or UK Mac layout, REVERSE SOLIDUS
* (backslash) and VERTICAL LINE in a
* US or UK Windows layout, and
* LESS-THAN SIGN and GREATER-THAN SIGN
* in a Swiss German, German, or French
* layout. */
SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
* not a physical key - but some Mac keyboards
* do have a power key. */
SDL_SCANCODE_KP_EQUALS = 103,
SDL_SCANCODE_F13 = 104,
SDL_SCANCODE_F14 = 105,
SDL_SCANCODE_F15 = 106,
SDL_SCANCODE_F16 = 107,
SDL_SCANCODE_F17 = 108,
SDL_SCANCODE_F18 = 109,
SDL_SCANCODE_F19 = 110,
SDL_SCANCODE_F20 = 111,
SDL_SCANCODE_F21 = 112,
SDL_SCANCODE_F22 = 113,
SDL_SCANCODE_F23 = 114,
SDL_SCANCODE_F24 = 115,
SDL_SCANCODE_EXECUTE = 116,
SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */
SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */
SDL_SCANCODE_SELECT = 119,
SDL_SCANCODE_STOP = 120, /**< AC Stop */
SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */
SDL_SCANCODE_UNDO = 122, /**< AC Undo */
SDL_SCANCODE_CUT = 123, /**< AC Cut */
SDL_SCANCODE_COPY = 124, /**< AC Copy */
SDL_SCANCODE_PASTE = 125, /**< AC Paste */
SDL_SCANCODE_FIND = 126, /**< AC Find */
SDL_SCANCODE_MUTE = 127,
SDL_SCANCODE_VOLUMEUP = 128,
SDL_SCANCODE_VOLUMEDOWN = 129,
/* not sure whether there's a reason to enable these */
/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
SDL_SCANCODE_KP_COMMA = 133,
SDL_SCANCODE_KP_EQUALSAS400 = 134,
SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
footnotes in USB doc */
SDL_SCANCODE_INTERNATIONAL2 = 136,
SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
SDL_SCANCODE_INTERNATIONAL4 = 138,
SDL_SCANCODE_INTERNATIONAL5 = 139,
SDL_SCANCODE_INTERNATIONAL6 = 140,
SDL_SCANCODE_INTERNATIONAL7 = 141,
SDL_SCANCODE_INTERNATIONAL8 = 142,
SDL_SCANCODE_INTERNATIONAL9 = 143,
SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
SDL_SCANCODE_LANG3 = 146, /**< Katakana */
SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
SDL_SCANCODE_LANG6 = 149, /**< reserved */
SDL_SCANCODE_LANG7 = 150, /**< reserved */
SDL_SCANCODE_LANG8 = 151, /**< reserved */
SDL_SCANCODE_LANG9 = 152, /**< reserved */
SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
SDL_SCANCODE_SYSREQ = 154,
SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */
SDL_SCANCODE_CLEAR = 156,
SDL_SCANCODE_PRIOR = 157,
SDL_SCANCODE_RETURN2 = 158,
SDL_SCANCODE_SEPARATOR = 159,
SDL_SCANCODE_OUT = 160,
SDL_SCANCODE_OPER = 161,
SDL_SCANCODE_CLEARAGAIN = 162,
SDL_SCANCODE_CRSEL = 163,
SDL_SCANCODE_EXSEL = 164,
SDL_SCANCODE_KP_00 = 176,
SDL_SCANCODE_KP_000 = 177,
SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
SDL_SCANCODE_DECIMALSEPARATOR = 179,
SDL_SCANCODE_CURRENCYUNIT = 180,
SDL_SCANCODE_CURRENCYSUBUNIT = 181,
SDL_SCANCODE_KP_LEFTPAREN = 182,
SDL_SCANCODE_KP_RIGHTPAREN = 183,
SDL_SCANCODE_KP_LEFTBRACE = 184,
SDL_SCANCODE_KP_RIGHTBRACE = 185,
SDL_SCANCODE_KP_TAB = 186,
SDL_SCANCODE_KP_BACKSPACE = 187,
SDL_SCANCODE_KP_A = 188,
SDL_SCANCODE_KP_B = 189,
SDL_SCANCODE_KP_C = 190,
SDL_SCANCODE_KP_D = 191,
SDL_SCANCODE_KP_E = 192,
SDL_SCANCODE_KP_F = 193,
SDL_SCANCODE_KP_XOR = 194,
SDL_SCANCODE_KP_POWER = 195,
SDL_SCANCODE_KP_PERCENT = 196,
SDL_SCANCODE_KP_LESS = 197,
SDL_SCANCODE_KP_GREATER = 198,
SDL_SCANCODE_KP_AMPERSAND = 199,
SDL_SCANCODE_KP_DBLAMPERSAND = 200,
SDL_SCANCODE_KP_VERTICALBAR = 201,
SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
SDL_SCANCODE_KP_COLON = 203,
SDL_SCANCODE_KP_HASH = 204,
SDL_SCANCODE_KP_SPACE = 205,
SDL_SCANCODE_KP_AT = 206,
SDL_SCANCODE_KP_EXCLAM = 207,
SDL_SCANCODE_KP_MEMSTORE = 208,
SDL_SCANCODE_KP_MEMRECALL = 209,
SDL_SCANCODE_KP_MEMCLEAR = 210,
SDL_SCANCODE_KP_MEMADD = 211,
SDL_SCANCODE_KP_MEMSUBTRACT = 212,
SDL_SCANCODE_KP_MEMMULTIPLY = 213,
SDL_SCANCODE_KP_MEMDIVIDE = 214,
SDL_SCANCODE_KP_PLUSMINUS = 215,
SDL_SCANCODE_KP_CLEAR = 216,
SDL_SCANCODE_KP_CLEARENTRY = 217,
SDL_SCANCODE_KP_BINARY = 218,
SDL_SCANCODE_KP_OCTAL = 219,
SDL_SCANCODE_KP_DECIMAL = 220,
SDL_SCANCODE_KP_HEXADECIMAL = 221,
SDL_SCANCODE_LCTRL = 224,
SDL_SCANCODE_LSHIFT = 225,
SDL_SCANCODE_LALT = 226, /**< alt, option */
SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
SDL_SCANCODE_RCTRL = 228,
SDL_SCANCODE_RSHIFT = 229,
SDL_SCANCODE_RALT = 230, /**< alt gr, option */
SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
* by any of the above, but since there's a
* special KMOD_MODE for it I'm adding it here
*/
/* @} */ /* Usage page 0x07 */
/**
* \name Usage page 0x0C
*
* These values are mapped from usage page 0x0C (USB consumer page).
* See https://usb.org/sites/default/files/hut1_2.pdf
*
* There are way more keys in the spec than we can represent in the
* current scancode range, so pick the ones that commonly come up in
* real world usage.
*/
/* @{ */
SDL_SCANCODE_AUDIONEXT = 258,
SDL_SCANCODE_AUDIOPREV = 259,
SDL_SCANCODE_AUDIOSTOP = 260,
SDL_SCANCODE_AUDIOPLAY = 261,
SDL_SCANCODE_AUDIOMUTE = 262,
SDL_SCANCODE_MEDIASELECT = 263,
SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */
SDL_SCANCODE_MAIL = 265,
SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */
SDL_SCANCODE_COMPUTER = 267,
SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */
SDL_SCANCODE_AC_HOME = 269, /**< AC Home */
SDL_SCANCODE_AC_BACK = 270, /**< AC Back */
SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */
SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */
SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */
SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */
/* @} */ /* Usage page 0x0C */
/**
* \name Walther keys
*
* These are values that Christian Walther added (for mac keyboard?).
*/
/* @{ */
SDL_SCANCODE_BRIGHTNESSDOWN = 275,
SDL_SCANCODE_BRIGHTNESSUP = 276,
SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
switch, video mode switch */
SDL_SCANCODE_KBDILLUMTOGGLE = 278,
SDL_SCANCODE_KBDILLUMDOWN = 279,
SDL_SCANCODE_KBDILLUMUP = 280,
SDL_SCANCODE_EJECT = 281,
SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */
SDL_SCANCODE_APP1 = 283,
SDL_SCANCODE_APP2 = 284,
/* @} */ /* Walther keys */
/**
* \name Usage page 0x0C (additional media keys)
*
* These values are mapped from usage page 0x0C (USB consumer page).
*/
/* @{ */
SDL_SCANCODE_AUDIOREWIND = 285,
SDL_SCANCODE_AUDIOFASTFORWARD = 286,
/* @} */ /* Usage page 0x0C (additional media keys) */
/**
* \name Mobile keys
*
* These are values that are often used on mobile phones.
*/
/* @{ */
SDL_SCANCODE_SOFTLEFT = 287, /**< Usually situated below the display on phones and
used as a multi-function feature key for selecting
a software defined function shown on the bottom left
of the display. */
SDL_SCANCODE_SOFTRIGHT = 288, /**< Usually situated below the display on phones and
used as a multi-function feature key for selecting
a software defined function shown on the bottom right
of the display. */
SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */
SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */
/* @} */ /* Mobile keys */
/* Add any other keys here. */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
} SDL_Scancode;
#endif /* SDL_scancode_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,829 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_stdinc.h
*
* This is a general header that includes C language support.
*/
#ifndef SDL_stdinc_h_
#define SDL_stdinc_h_
#include "SDL_config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#if defined(STDC_HEADERS)
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#else
#if defined(HAVE_STDLIB_H)
#include <stdlib.h>
#elif defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#if defined(HAVE_STDDEF_H)
#include <stddef.h>
#endif
#if defined(HAVE_STDARG_H)
#include <stdarg.h>
#endif
#endif
#ifdef HAVE_STRING_H
#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
#include <memory.h>
#endif
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif
#if defined(HAVE_INTTYPES_H)
#include <inttypes.h>
#elif defined(HAVE_STDINT_H)
#include <stdint.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifdef HAVE_MATH_H
#if defined(_MSC_VER)
/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
for more information.
*/
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#endif
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#if defined(HAVE_ALLOCA) && !defined(alloca)
#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#elif defined(__GNUC__)
#define alloca __builtin_alloca
#elif defined(_MSC_VER)
#include <malloc.h>
#define alloca _alloca
#elif defined(__WATCOMC__)
#include <malloc.h>
#elif defined(__BORLANDC__)
#include <malloc.h>
#elif defined(__DMC__)
#include <stdlib.h>
#elif defined(__AIX__)
#pragma alloca
#elif defined(__MRC__)
void *alloca(unsigned);
#else
void *alloca(size_t);
#endif
#endif
#ifdef SIZE_MAX
#define SDL_SIZE_MAX SIZE_MAX
#else
#define SDL_SIZE_MAX ((size_t) - 1)
#endif
/**
* Check if the compiler supports a given builtin.
* Supported by virtually all clang versions and recent gcc. Use this
* instead of checking the clang version if possible.
*/
#ifdef __has_builtin
#define _SDL_HAS_BUILTIN(x) __has_builtin(x)
#else
#define _SDL_HAS_BUILTIN(x) 0
#endif
/**
* The number of elements in an array.
*/
#define SDL_arraysize(array) (sizeof(array) / sizeof(array[0]))
#define SDL_TABLESIZE(table) SDL_arraysize(table)
/**
* Macro useful for building other macros with strings in them
*
* e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
*/
#define SDL_STRINGIFY_ARG(arg) #arg
/**
* \name Cast operators
*
* Use proper C++ casts when compiled as C++ to be compatible with the option
* -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
*/
/* @{ */
#ifdef __cplusplus
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
#define SDL_static_cast(type, expression) static_cast<type>(expression)
#define SDL_const_cast(type, expression) const_cast<type>(expression)
#else
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
#define SDL_static_cast(type, expression) ((type)(expression))
#define SDL_const_cast(type, expression) ((type)(expression))
#endif
/* @} */ /* Cast operators */
/* Define a four character code as a Uint32 */
#define SDL_FOURCC(A, B, C, D) \
((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
/**
* \name Basic data types
*/
/* @{ */
#ifdef __CC_ARM
/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
#define SDL_FALSE 0
#define SDL_TRUE 1
typedef int SDL_bool;
#else
typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool;
#endif
/**
* \brief A signed 8-bit integer type.
*/
#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
typedef int8_t Sint8;
/**
* \brief An unsigned 8-bit integer type.
*/
#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
typedef uint8_t Uint8;
/**
* \brief A signed 16-bit integer type.
*/
#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
typedef int16_t Sint16;
/**
* \brief An unsigned 16-bit integer type.
*/
#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
typedef uint16_t Uint16;
/**
* \brief A signed 32-bit integer type.
*/
#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
typedef int32_t Sint32;
/**
* \brief An unsigned 32-bit integer type.
*/
#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
typedef uint32_t Uint32;
/**
* \brief A signed 64-bit integer type.
*/
#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
typedef int64_t Sint64;
/**
* \brief An unsigned 64-bit integer type.
*/
#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
typedef uint64_t Uint64;
/* @} */ /* Basic data types */
/**
* \name Floating-point constants
*/
/* @{ */
#ifdef FLT_EPSILON
#define SDL_FLT_EPSILON FLT_EPSILON
#else
#define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */
#endif
/* @} */ /* Floating-point constants */
/* Make sure we have macros for printing width-based integers.
* <stdint.h> should define these but this is not true all platforms.
* (for example win32) */
#ifndef SDL_PRIs64
#if defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIs64 "I64d"
#elif defined(PRIs64)
#define SDL_PRIs64 PRIs64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIs64 "ld"
#else
#define SDL_PRIs64 "lld"
#endif
#endif
#ifndef SDL_PRIu64
#if defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIu64 "I64u"
#elif defined(PRIu64)
#define SDL_PRIu64 PRIu64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIu64 "lu"
#else
#define SDL_PRIu64 "llu"
#endif
#endif
#ifndef SDL_PRIx64
#if defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIx64 "I64x"
#elif defined(PRIx64)
#define SDL_PRIx64 PRIx64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIx64 "lx"
#else
#define SDL_PRIx64 "llx"
#endif
#endif
#ifndef SDL_PRIX64
#if defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIX64 "I64X"
#elif defined(PRIX64)
#define SDL_PRIX64 PRIX64
#elif defined(__LP64__) && !defined(__APPLE__)
#define SDL_PRIX64 "lX"
#else
#define SDL_PRIX64 "llX"
#endif
#endif
#ifndef SDL_PRIs32
#ifdef PRId32
#define SDL_PRIs32 PRId32
#else
#define SDL_PRIs32 "d"
#endif
#endif
#ifndef SDL_PRIu32
#ifdef PRIu32
#define SDL_PRIu32 PRIu32
#else
#define SDL_PRIu32 "u"
#endif
#endif
#ifndef SDL_PRIx32
#ifdef PRIx32
#define SDL_PRIx32 PRIx32
#else
#define SDL_PRIx32 "x"
#endif
#endif
#ifndef SDL_PRIX32
#ifdef PRIX32
#define SDL_PRIX32 PRIX32
#else
#define SDL_PRIX32 "X"
#endif
#endif
/* Annotations to help code analysis tools */
#ifdef SDL_DISABLE_ANALYZE_MACROS
#define SDL_IN_BYTECAP(x)
#define SDL_INOUT_Z_CAP(x)
#define SDL_OUT_Z_CAP(x)
#define SDL_OUT_CAP(x)
#define SDL_OUT_BYTECAP(x)
#define SDL_OUT_Z_BYTECAP(x)
#define SDL_PRINTF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber)
#define SDL_PRINTF_VARARG_FUNCV(fmtargnumber)
#define SDL_SCANF_VARARG_FUNC(fmtargnumber)
#define SDL_SCANF_VARARG_FUNCV(fmtargnumber)
#else
#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
#include <sal.h>
#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
#define SDL_OUT_CAP(x) _Out_cap_(x)
#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
#else
#define SDL_IN_BYTECAP(x)
#define SDL_INOUT_Z_CAP(x)
#define SDL_OUT_Z_CAP(x)
#define SDL_OUT_CAP(x)
#define SDL_OUT_BYTECAP(x)
#define SDL_OUT_Z_BYTECAP(x)
#define SDL_PRINTF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING
#endif
#if defined(__GNUC__)
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber) __attribute__((format(__printf__, fmtargnumber, fmtargnumber + 1)))
#define SDL_PRINTF_VARARG_FUNCV(fmtargnumber) __attribute__((format(__printf__, fmtargnumber, 0)))
#define SDL_SCANF_VARARG_FUNC(fmtargnumber) __attribute__((format(__scanf__, fmtargnumber, fmtargnumber + 1)))
#define SDL_SCANF_VARARG_FUNCV(fmtargnumber) __attribute__((format(__scanf__, fmtargnumber, 0)))
#else
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber)
#define SDL_PRINTF_VARARG_FUNCV(fmtargnumber)
#define SDL_SCANF_VARARG_FUNC(fmtargnumber)
#define SDL_SCANF_VARARG_FUNCV(fmtargnumber)
#endif
#endif /* SDL_DISABLE_ANALYZE_MACROS */
#ifndef SDL_COMPILE_TIME_ASSERT
#if defined(__cplusplus)
#if (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#endif
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
#endif
#endif /* !SDL_COMPILE_TIME_ASSERT */
#ifndef SDL_COMPILE_TIME_ASSERT
/* universal, but may trigger -Wunused-local-typedefs */
#define SDL_COMPILE_TIME_ASSERT(name, x) typedef int SDL_compile_time_assert_##name[(x) * 2 - 1]
#endif
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/** \endcond */
/* Check to make sure enums are the size of ints, for structure packing.
For both Watcom C/C++ and Borland C/C++ the compiler option that makes
enums having the size of an int must be enabled.
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
*/
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__)
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum { DUMMY_ENUM_VALUE } SDL_DUMMY_ENUM;
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/** \endcond */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_ALLOCA
#define SDL_stack_alloc(type, count) (type *)alloca(sizeof(type) * (count))
#define SDL_stack_free(data)
#else
#define SDL_stack_alloc(type, count) (type *)SDL_malloc(sizeof(type) * (count))
#define SDL_stack_free(data) SDL_free(data)
#endif
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
extern DECLSPEC void SDLCALL SDL_free(void *mem);
typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
typedef void(SDLCALL *SDL_free_func)(void *mem);
/**
* Get the original set of SDL memory functions
*
* \since This function is available since SDL 2.24.0.
*/
extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func,
SDL_realloc_func *realloc_func, SDL_free_func *free_func);
/**
* Get the current set of SDL memory functions
*
* \since This function is available since SDL 2.0.7.
*/
extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func,
SDL_realloc_func *realloc_func, SDL_free_func *free_func);
/**
* Replace SDL's memory allocation functions with a custom set
*
* \since This function is available since SDL 2.0.7.
*/
extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func, SDL_free_func free_func);
/**
* Get the number of outstanding (unfreed) allocations
*
* \since This function is available since SDL 2.0.7.
*/
extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
int(SDLCALL *compare)(const void *, const void *));
extern DECLSPEC void *SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size,
int(SDLCALL *compare)(const void *, const void *));
extern DECLSPEC int SDLCALL SDL_abs(int x);
/* NOTE: these double-evaluate their arguments, so you should never have side effects in the parameters */
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
#define SDL_clamp(x, a, b) (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x)))
extern DECLSPEC int SDLCALL SDL_isalpha(int x);
extern DECLSPEC int SDLCALL SDL_isalnum(int x);
extern DECLSPEC int SDLCALL SDL_isblank(int x);
extern DECLSPEC int SDLCALL SDL_iscntrl(int x);
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
extern DECLSPEC int SDLCALL SDL_isxdigit(int x);
extern DECLSPEC int SDLCALL SDL_ispunct(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_isprint(int x);
extern DECLSPEC int SDLCALL SDL_isgraph(int x);
extern DECLSPEC int SDLCALL SDL_toupper(int x);
extern DECLSPEC int SDLCALL SDL_tolower(int x);
extern DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len);
extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
#define SDL_copyp(dst, src) \
{ SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof(*(dst)) == sizeof(*(src))); } \
SDL_memcpy((dst), (src), sizeof(*(src)))
/* 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__)
int u0, u1, u2;
__asm__ __volatile__("cld \n\t"
"rep ; stosl \n\t"
: "=&D"(u0), "=&a"(u1), "=&c"(u2)
: "0"(dst), "1"(val), "2"(SDL_static_cast(Uint32, dwords))
: "memory");
#else
size_t _n = (dwords + 3) / 4;
Uint32 *_p = SDL_static_cast(Uint32 *, dst);
Uint32 _val = (val);
if (dwords == 0) {
return;
}
switch (dwords % 4) {
case 0:
do {
*_p++ = _val;
SDL_FALLTHROUGH;
case 3:
*_p++ = _val;
SDL_FALLTHROUGH;
case 2:
*_p++ = _val;
SDL_FALLTHROUGH;
case 1:
*_p++ = _val;
} while (--_n);
}
#endif
}
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src,
size_t len);
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 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 int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2);
extern DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len);
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 size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
extern DECLSPEC char *SDLCALL SDL_strcasestr(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 size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes);
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
extern DECLSPEC double SDLCALL SDL_atof(const char *str);
extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...)
SDL_SCANF_VARARG_FUNC(2);
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap)
SDL_SCANF_VARARG_FUNCV(2);
extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen,
SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen,
SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
SDL_PRINTF_VARARG_FUNCV(3);
extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
SDL_PRINTF_VARARG_FUNC(2);
extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
SDL_PRINTF_VARARG_FUNCV(2);
#ifndef HAVE_M_PI
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288 /**< pi */
#endif
#endif
/**
* Use this function to compute arc cosine of `x`.
*
* The definition of `y = acos(x)` is `x = cos(y)`.
*
* Domain: `-1 <= x <= 1`
*
* Range: `0 <= y <= Pi`
*
* \param x floating point value, in radians.
* \returns arc cosine of `x`.
*
* \since This function is available since SDL 2.0.2.
*/
extern DECLSPEC double SDLCALL SDL_acos(double x);
extern DECLSPEC float SDLCALL SDL_acosf(float x);
extern DECLSPEC double SDLCALL SDL_asin(double x);
extern DECLSPEC float SDLCALL SDL_asinf(float x);
extern DECLSPEC double SDLCALL SDL_atan(double x);
extern DECLSPEC float SDLCALL SDL_atanf(float x);
extern DECLSPEC double SDLCALL SDL_atan2(double y, double x);
extern DECLSPEC float SDLCALL SDL_atan2f(float y, float x);
extern DECLSPEC double SDLCALL SDL_ceil(double x);
extern DECLSPEC float SDLCALL SDL_ceilf(float x);
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
extern DECLSPEC double SDLCALL SDL_cos(double x);
extern DECLSPEC float SDLCALL SDL_cosf(float x);
extern DECLSPEC double SDLCALL SDL_exp(double x);
extern DECLSPEC float SDLCALL SDL_expf(float x);
extern DECLSPEC double SDLCALL SDL_fabs(double x);
extern DECLSPEC float SDLCALL SDL_fabsf(float x);
extern DECLSPEC double SDLCALL SDL_floor(double x);
extern DECLSPEC float SDLCALL SDL_floorf(float x);
extern DECLSPEC double SDLCALL SDL_trunc(double x);
extern DECLSPEC float SDLCALL SDL_truncf(float x);
extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
extern DECLSPEC double SDLCALL SDL_log(double x);
extern DECLSPEC float SDLCALL SDL_logf(float x);
extern DECLSPEC double SDLCALL SDL_log10(double x);
extern DECLSPEC float SDLCALL SDL_log10f(float x);
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
extern DECLSPEC double SDLCALL SDL_round(double x);
extern DECLSPEC float SDLCALL SDL_roundf(float x);
extern DECLSPEC long SDLCALL SDL_lround(double x);
extern DECLSPEC long SDLCALL SDL_lroundf(float x);
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
extern DECLSPEC double SDLCALL SDL_sin(double x);
extern DECLSPEC float SDLCALL SDL_sinf(float x);
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
extern DECLSPEC double SDLCALL SDL_tan(double x);
extern DECLSPEC float SDLCALL SDL_tanf(float x);
/* The SDL implementation of iconv() returns these error codes */
#define SDL_ICONV_ERROR (size_t) - 1
#define SDL_ICONV_E2BIG (size_t) - 2
#define SDL_ICONV_EILSEQ (size_t) - 3
#define SDL_ICONV_EINVAL (size_t) - 4
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
typedef struct _SDL_iconv_t *SDL_iconv_t;
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
size_t *outbytesleft);
/**
* This function converts a buffer or string between encodings in one pass,
* returning a string that must be freed with SDL_free() or NULL on error.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
size_t inbytesleft);
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S) + 1)
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S) + 1)
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S) + 1)
#define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S) + 1) * sizeof(wchar_t))
/* force builds using Clang's static analysis tools to use literal C runtime
here, since there are possibly tests that are ineffective otherwise. */
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
/* The analyzer knows about strlcpy even when the system doesn't provide it */
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size);
#endif
/* The analyzer knows about strlcat even when the system doesn't provide it */
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t size);
#endif
#ifndef HAVE_WCSLCPY
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
#endif
#ifndef HAVE_WCSLCAT
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
#endif
/* Starting LLVM 16, the analyser errors out if these functions do not have
their prototype defined (clang-diagnostic-implicit-function-declaration) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SDL_malloc malloc
#define SDL_calloc calloc
#define SDL_realloc realloc
#define SDL_free free
#define SDL_memset memset
#define SDL_memcpy memcpy
#define SDL_memmove memmove
#define SDL_memcmp memcmp
#define SDL_strlcpy strlcpy
#define SDL_strlcat strlcat
#define SDL_strlen strlen
#define SDL_wcslen wcslen
#define SDL_wcslcpy wcslcpy
#define SDL_wcslcat wcslcat
#define SDL_strdup strdup
#define SDL_wcsdup wcsdup
#define SDL_strchr strchr
#define SDL_strrchr strrchr
#define SDL_strstr strstr
#define SDL_wcsstr wcsstr
#define SDL_strtokr strtok_r
#define SDL_strcmp strcmp
#define SDL_wcscmp wcscmp
#define SDL_strncmp strncmp
#define SDL_wcsncmp wcsncmp
#define SDL_strcasecmp strcasecmp
#define SDL_strncasecmp strncasecmp
#define SDL_sscanf sscanf
#define SDL_vsscanf vsscanf
#define SDL_snprintf snprintf
#define SDL_vsnprintf vsnprintf
#endif
SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords * 4) void *dst, SDL_IN_BYTECAP(dwords * 4) const void *src,
size_t dwords) {
return SDL_memcpy(dst, src, dwords * 4);
}
/**
* If a * b would overflow, return -1. Otherwise store a * b via ret
* and return 0.
*
* \since This function is available since SDL 2.24.0.
*/
SDL_FORCE_INLINE int SDL_size_mul_overflow(size_t a, size_t b, size_t *ret) {
if (a != 0 && b > SDL_SIZE_MAX / a) {
return -1;
}
*ret = a * b;
return 0;
}
#if _SDL_HAS_BUILTIN(__builtin_mul_overflow)
/* This needs to be wrapped in an inline rather than being a direct #define,
* because __builtin_mul_overflow() is type-generic, but we want to be
* consistent about interpreting a and b as size_t. */
SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin(size_t a, size_t b, size_t *ret) {
return __builtin_mul_overflow(a, b, ret) == 0 ? 0 : -1;
}
#define SDL_size_mul_overflow(a, b, ret) (_SDL_size_mul_overflow_builtin(a, b, ret))
#endif
/**
* If a + b would overflow, return -1. Otherwise store a + b via ret
* and return 0.
*
* \since This function is available since SDL 2.24.0.
*/
SDL_FORCE_INLINE int SDL_size_add_overflow(size_t a, size_t b, size_t *ret) {
if (b > SDL_SIZE_MAX - a) {
return -1;
}
*ret = a + b;
return 0;
}
#if _SDL_HAS_BUILTIN(__builtin_add_overflow)
/* This needs to be wrapped in an inline rather than being a direct #define,
* the same as the call to __builtin_mul_overflow() above. */
SDL_FORCE_INLINE int _SDL_size_add_overflow_builtin(size_t a, size_t b, size_t *ret) {
return __builtin_add_overflow(a, b, ret) == 0 ? 0 : -1;
}
#define SDL_size_add_overflow(a, b, ret) (_SDL_size_add_overflow_builtin(a, b, ret))
#endif
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_stdinc_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,364 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_syswm.h
*
* Include file for SDL custom system window manager hooks.
*/
#ifndef SDL_syswm_h_
#define SDL_syswm_h_
#include "SDL_error.h"
#include "SDL_stdinc.h"
#include "SDL_version.h"
#include "SDL_video.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().
*/
struct SDL_SysWMinfo;
#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_WINRT)
#include <Inspectable.h>
#endif
/* This is the structure for custom window manager events */
#if defined(SDL_VIDEO_DRIVER_X11)
#if defined(__APPLE__) && defined(__MACH__)
/* conflicts with Quickdraw.h */
#define Cursor X11Cursor
#endif
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#if defined(__APPLE__) && defined(__MACH__)
/* matches the re-define above */
#undef Cursor
#endif
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
#include <directfb.h>
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef __OBJC__
@class NSWindow;
#else
typedef struct _NSWindow NSWindow;
#endif
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
#ifdef __OBJC__
#include <UIKit/UIKit.h>
#else
typedef struct _UIWindow UIWindow;
typedef struct _UIViewController UIViewController;
#endif
typedef Uint32 GLuint;
#endif
#if defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)
#define SDL_METALVIEW_TAG 255
#endif
#if defined(SDL_VIDEO_DRIVER_ANDROID)
typedef struct ANativeWindow ANativeWindow;
typedef void *EGLSurface;
#endif
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
#include "SDL_egl.h"
#endif
#if defined(SDL_VIDEO_DRIVER_OS2)
#define INCL_WIN
#include <os2.h>
#endif
#endif /* SDL_PROTOTYPES_ONLY */
#if defined(SDL_VIDEO_DRIVER_KMSDRM)
struct gbm_device;
#endif
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(SDL_PROTOTYPES_ONLY)
/**
* These are the various supported windowing subsystems
*/
typedef enum {
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND,
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_HAIKU,
SDL_SYSWM_KMSDRM,
SDL_SYSWM_RISCOS
} SDL_SYSWM_TYPE;
/**
* The custom event structure.
*/
struct SDL_SysWMmsg {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
struct {
HWND hwnd; /**< The window for the message */
UINT msg; /**< The type of message */
WPARAM wParam; /**< WORD message parameter */
LPARAM lParam; /**< LONG message parameter */
} win;
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
struct {
XEvent event;
} x11;
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
struct {
DFBEvent event;
} dfb;
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
struct {
/* Latest version of Xcode clang complains about empty structs in C v. C++:
error: empty struct has size 0 in C, size 1 in C++
*/
int dummy;
/* No Cocoa window events yet */
} cocoa;
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
struct {
int dummy;
/* No UIKit window events yet */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
struct {
int dummy;
/* No Vivante window events yet */
} vivante;
#endif
#if defined(SDL_VIDEO_DRIVER_OS2)
struct {
BOOL fFrame; /**< TRUE if hwnd is a frame window */
HWND hwnd; /**< The window receiving the message */
ULONG msg; /**< The message identifier */
MPARAM mp1; /**< The first first message parameter */
MPARAM mp2; /**< The second first message parameter */
} os2;
#endif
/* Can't have an empty union */
int dummy;
} msg;
};
/**
* The custom window manager information structure.
*
* When this structure is returned, it holds information about which
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
*/
struct SDL_SysWMinfo {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
struct {
HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
HINSTANCE hinstance; /**< The instance handle */
} win;
#endif
#if defined(SDL_VIDEO_DRIVER_WINRT)
struct {
IInspectable *window; /**< The WinRT CoreWindow */
} winrt;
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
struct {
Display *display; /**< The X11 display */
Window window; /**< The X11 window */
} x11;
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
struct {
IDirectFB *dfb; /**< The directfb main interface */
IDirectFBWindow *window; /**< The directfb window handle */
IDirectFBSurface *surface; /**< The directfb client surface */
} dfb;
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
struct {
#if defined(__OBJC__) && defined(__has_feature)
#if __has_feature(objc_arc)
NSWindow __unsafe_unretained *window; /**< The Cocoa window */
#else
NSWindow *window; /**< The Cocoa window */
#endif
#else
NSWindow *window; /**< The Cocoa window */
#endif
} cocoa;
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
struct {
#if defined(__OBJC__) && defined(__has_feature)
#if __has_feature(objc_arc)
UIWindow __unsafe_unretained *window; /**< The UIKit window */
#else
UIWindow *window; /**< The UIKit window */
#endif
#else
UIWindow *window; /**< The UIKit window */
#endif
GLuint
framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is
called. */
GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is
used. */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
struct {
struct wl_display *display; /**< Wayland display */
struct wl_surface *surface; /**< Wayland surface */
void *shell_surface; /**< DEPRECATED Wayland shell_surface (window manager handle) */
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */
struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */
} wl;
#endif
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
struct {
void *connection; /**< Mir display server connection */
void *surface; /**< Mir surface */
} mir;
#endif
#if defined(SDL_VIDEO_DRIVER_ANDROID)
struct {
ANativeWindow *window;
EGLSurface surface;
} android;
#endif
#if defined(SDL_VIDEO_DRIVER_OS2)
struct {
HWND hwnd; /**< The window handle */
HWND hwndFrame; /**< The frame window handle */
} os2;
#endif
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
struct {
EGLNativeDisplayType display;
EGLNativeWindowType window;
} vivante;
#endif
#if defined(SDL_VIDEO_DRIVER_KMSDRM)
struct {
int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */
int drm_fd; /**< DRM FD (unavailable on Vulkan windows) */
struct gbm_device *gbm_dev; /**< GBM device (unavailable on Vulkan windows) */
} kmsdrm;
#endif
/* Make sure this union is always 64 bytes (8 64-bit pointers). */
/* Be careful not to overflow this if you add a new target! */
Uint8 dummy[64];
} info;
};
#endif /* SDL_PROTOTYPES_ONLY */
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
/**
* Get driver-specific information about a window.
*
* You must include SDL_syswm.h for the declaration of SDL_SysWMinfo.
*
* The caller must initialize the `info` structure's version by using
* `SDL_VERSION(&info.version)`, and then this function will fill in the rest
* of the structure with information about the given window.
*
* \param window the window about which information is being requested
* \param info an SDL_SysWMinfo structure filled in with window information
* \returns SDL_TRUE if the function is implemented and the `version` member
* of the `info` struct is valid, or SDL_FALSE if the information
* could not be retrieved; call SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_syswm_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -1,187 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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 begin_code.h
*
* This file sets things up for C dynamic library function definitions,
* static inlined functions, and structures aligned at 4-byte alignment.
* If you don't like ugly C preprocessor code, don't look at this file. :)
*/
/* This shouldn't be nested -- included it around code only. */
#ifdef SDL_begin_code_h
#error Nested inclusion of begin_code.h
#endif
#define SDL_begin_code_h
#ifndef SDL_DEPRECATED
#if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
#define SDL_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define SDL_DEPRECATED __declspec(deprecated)
#else
#define SDL_DEPRECATED
#endif
#endif
#ifndef SDL_UNUSED
#ifdef __GNUC__
#define SDL_UNUSED __attribute__((unused))
#else
#define SDL_UNUSED
#endif
#endif
/* Some compilers use a special export keyword */
#ifndef DECLSPEC
#if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) || defined(__GDK__)
#ifdef DLL_EXPORT
#define DECLSPEC __declspec(dllexport)
#else
#define DECLSPEC
#endif
#elif defined(__OS2__)
#ifdef BUILD_SDL
#define DECLSPEC __declspec(dllexport)
#else
#define DECLSPEC
#endif
#else
#if defined(__GNUC__) && __GNUC__ >= 4
#define DECLSPEC __attribute__((visibility("default")))
#else
#define DECLSPEC
#endif
#endif
#endif
/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__)
#define SDLCALL __cdecl
#elif defined(__OS2__) || defined(__EMX__)
#define SDLCALL _System
#if defined(__GNUC__) && !defined(_System)
#define _System /* for old EMX/GCC compat. */
#endif
#else
#define SDLCALL
#endif
#endif /* SDLCALL */
/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
#ifdef __SYMBIAN32__
#undef DECLSPEC
#define DECLSPEC
#endif /* __SYMBIAN32__ */
/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from disk.
The packing is reset to the previous value in close_code.h
*/
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef _MSC_VER
#pragma warning(disable : 4103)
#endif
#ifdef __clang__
#pragma clang diagnostic ignored "-Wpragma-pack"
#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#ifdef _WIN64
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
#pragma pack(push, 8)
#else
#pragma pack(push, 4)
#endif
#endif /* Compiler needs structure packing set */
#ifndef SDL_INLINE
#if defined(__GNUC__)
#define SDL_INLINE __inline__
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) || defined(__SC__) || defined(__WATCOMC__) || \
defined(__LCC__) || defined(__DECC) || defined(__CC_ARM)
#define SDL_INLINE __inline
#ifndef __inline__
#define __inline__ __inline
#endif
#else
#define SDL_INLINE inline
#ifndef __inline__
#define __inline__ inline
#endif
#endif
#endif /* SDL_INLINE not defined */
#ifndef SDL_FORCE_INLINE
#if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline
#elif ((defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__))
#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
#else
#define SDL_FORCE_INLINE static SDL_INLINE
#endif
#endif /* SDL_FORCE_INLINE not defined */
#ifndef SDL_NORETURN
#if defined(__GNUC__)
#define SDL_NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER)
#define SDL_NORETURN __declspec(noreturn)
#else
#define SDL_NORETURN
#endif
#endif /* SDL_NORETURN not defined */
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif /* NULL */
#endif /* ! Mac OS X - breaks precompiled headers */
#ifndef SDL_FALLTHROUGH
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
#define SDL_FALLTHROUGH [[fallthrough]]
#else
#if defined(__has_attribute)
#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__)
#else
#define SDL_HAS_FALLTHROUGH 0
#endif /* __has_attribute */
#if SDL_HAS_FALLTHROUGH && \
((defined(__GNUC__) && __GNUC__ >= 7) || (defined(__clang_major__) && __clang_major__ >= 10))
#define SDL_FALLTHROUGH __attribute__((__fallthrough__))
#else
#define SDL_FALLTHROUGH \
do { \
} while (0) /* fallthrough */
#endif /* SDL_HAS_FALLTHROUGH */
#undef SDL_HAS_FALLTHROUGH
#endif /* C++17 or C2x */
#endif /* SDL_FALLTHROUGH not defined */

Binary file not shown.

Binary file not shown.

View File

@ -261,10 +261,10 @@ Some things that may be of interest about how it all works...
## Working directory ## Working directory
In SDL 1.2, the working directory of your SDL app is by default set to its In SDL 1.2, the working directory of your SDL app is by default set to its
parent, but this is no longer the case in SDL 2.0. SDL2 does change the parent, but this is no longer the case in SDL 2.0 and later. SDL2 does not
working directory, which means it'll be whatever the command line prompt change the working directory, which means it'll be whatever the command line
that launched the program was using, or if launched by double-clicking in prompt that launched the program was using, or if launched by double-clicking
the finger, it will be "/", the _root of the filesystem_. Plan accordingly! in the Finder, it will be "/", the _root of the filesystem_. Plan accordingly!
You can use SDL_GetBasePath() to find where the program is running from and You can use SDL_GetBasePath() to find where the program is running from and
chdir() there directly. chdir() there directly.

View File

@ -25,71 +25,73 @@
* Main include header for the SDL library * Main include header for the SDL library
*/ */
#ifndef SDL_h_ #ifndef SDL_h_
#define SDL_h_ #define SDL_h_
#include "SDL_assert.h" #include "SDL_main.h"
#include "SDL_atomic.h" #include "SDL_stdinc.h"
#include "SDL_audio.h" #include "SDL_assert.h"
#include "SDL_clipboard.h" #include "SDL_atomic.h"
#include "SDL_cpuinfo.h" #include "SDL_audio.h"
#include "SDL_endian.h" #include "SDL_clipboard.h"
#include "SDL_error.h" #include "SDL_cpuinfo.h"
#include "SDL_events.h" #include "SDL_endian.h"
#include "SDL_filesystem.h" #include "SDL_error.h"
#include "SDL_gamecontroller.h" #include "SDL_events.h"
#include "SDL_guid.h" #include "SDL_filesystem.h"
#include "SDL_haptic.h" #include "SDL_gamecontroller.h"
#include "SDL_hidapi.h" #include "SDL_guid.h"
#include "SDL_hints.h" #include "SDL_haptic.h"
#include "SDL_joystick.h" #include "SDL_hidapi.h"
#include "SDL_loadso.h" #include "SDL_hints.h"
#include "SDL_locale.h" #include "SDL_joystick.h"
#include "SDL_log.h" #include "SDL_loadso.h"
#include "SDL_main.h" #include "SDL_log.h"
#include "SDL_messagebox.h" #include "SDL_messagebox.h"
#include "SDL_metal.h" #include "SDL_metal.h"
#include "SDL_misc.h" #include "SDL_mutex.h"
#include "SDL_mutex.h" #include "SDL_power.h"
#include "SDL_power.h" #include "SDL_render.h"
#include "SDL_render.h" #include "SDL_rwops.h"
#include "SDL_rwops.h" #include "SDL_sensor.h"
#include "SDL_sensor.h" #include "SDL_shape.h"
#include "SDL_shape.h" #include "SDL_system.h"
#include "SDL_stdinc.h" #include "SDL_thread.h"
#include "SDL_system.h" #include "SDL_timer.h"
#include "SDL_thread.h" #include "SDL_version.h"
#include "SDL_timer.h" #include "SDL_video.h"
#include "SDL_version.h" #include "SDL_locale.h"
#include "SDL_video.h" #include "SDL_misc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* As of version 0.5, SDL is loaded dynamically into the application */ /* As of version 0.5, SDL is loaded dynamically into the application */
/** /**
* \name SDL_INIT_* * \name SDL_INIT_*
* *
* These are the flags which may be passed to SDL_Init(). You should * These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application. * specify the subsystems which you will be using in your application.
*/ */
/* @{ */ /* @{ */
#define SDL_INIT_TIMER 0x00000001u #define SDL_INIT_TIMER 0x00000001u
#define SDL_INIT_AUDIO 0x00000010u #define SDL_INIT_AUDIO 0x00000010u
#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ #define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ #define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000u #define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u #define SDL_INIT_EVENTS 0x00004000u
#define SDL_INIT_SENSOR 0x00008000u #define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#define SDL_INIT_EVERYTHING \ #define SDL_INIT_EVERYTHING ( \
(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR) SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */ /* @} */
/** /**
@ -220,11 +222,11 @@ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
*/ */
extern DECLSPEC void SDLCALL SDL_Quit(void); extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_h_ */ #endif /* SDL_h_ */

322
third_party/SDL2/include/SDL_assert.h vendored Normal file
View File

@ -0,0 +1,322 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_assert_h_
#define SDL_assert_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SDL_ASSERT_LEVEL
#ifdef SDL_DEFAULT_ASSERT_LEVEL
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
#elif defined(_DEBUG) || defined(DEBUG) || \
(defined(__GNUC__) && !defined(__OPTIMIZE__))
#define SDL_ASSERT_LEVEL 2
#else
#define SDL_ASSERT_LEVEL 1
#endif
#endif /* SDL_ASSERT_LEVEL */
/*
These are macros and not first class functions so that the debugger breaks
on the assertion line and not in some random guts of SDL, and so each
assert can have unique static variables associated with it.
*/
#if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif _SDL_HAS_BUILTIN(__builtin_debugtrap)
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
#elif defined(__APPLE__) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
#elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
#endif
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
#endif
#define SDL_FILE __FILE__
#define SDL_LINE __LINE__
/*
sizeof (x) makes the compiler still parse the expression even without
assertions enabled, so the code is always checked at compile time, but
doesn't actually generate code for it, so there are no side effects or
expensive checks at run time, just the constant size of what x WOULD be,
which presumably gets optimized out as unused.
This also solves the problem of...
int somevalue = blah();
SDL_assert(somevalue == 1);
...which would cause compiles to complain that somevalue is unused if we
disable assertions.
*/
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
this condition isn't constant. And looks like an owl's face! */
#ifdef _MSC_VER /* stupid /W4 warnings. */
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
#else
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif
#define SDL_disabled_assert(condition) \
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
typedef enum
{
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
SDL_ASSERTION_ABORT, /**< Terminate the program. */
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
} SDL_AssertState;
typedef struct SDL_AssertData
{
int always_ignore;
unsigned int trigger_count;
const char *condition;
const char *filename;
int linenum;
const char *function;
const struct SDL_AssertData *next;
} SDL_AssertData;
/* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
const char *,
const char *, int)
#if defined(__clang__)
#if __has_feature(attribute_analyzer_noreturn)
/* this tells Clang's static analysis that we're a custom assert function,
and that the analyzer should assume the condition was always true past this
SDL_assert test. */
__attribute__((analyzer_noreturn))
#endif
#endif
;
/* the do {} while(0) avoids dangling else problems:
if (x) SDL_assert(y); else blah();
... without the do/while, the "else" could attach to this macro's "if".
We try to handle just the minimum we need here in a macro...the loop,
the static vars, and break points. The heavy lifting is handled in
SDL_ReportAssertion(), in SDL_assert.c.
*/
#define SDL_enabled_assert(condition) \
do { \
while ( !(condition) ) { \
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
SDL_TriggerBreakpoint(); \
} \
break; /* not retrying. */ \
} \
} while (SDL_NULL_WHILE_LOOP_CONDITION)
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
# define SDL_assert(condition) SDL_enabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
# define SDL_assert(condition) SDL_enabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
#else
# error Unknown assertion level.
#endif
/* this assertion is never disabled at any level. */
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
/**
* A callback that fires when an SDL assertion fails.
*
* \param data a pointer to the SDL_AssertData structure corresponding to the
* current assertion
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
* \returns an SDL_AssertState value indicating how to handle the failure.
*/
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
const SDL_AssertData* data, void* userdata);
/**
* Set an application-defined assertion handler.
*
* This function allows an application to show its own assertion UI and/or
* force the response to an assertion failure. If the application doesn't
* provide this, SDL will try to do the right thing, popping up a
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
*
* This callback may fire from any thread, but it runs wrapped in a mutex, so
* it will only fire from one thread at a time.
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
* \param handler the SDL_AssertionHandler function to call when an assertion
* fails or NULL for the default handler
* \param userdata a pointer that is passed to `handler`
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetAssertionHandler
*/
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
SDL_AssertionHandler handler,
void *userdata);
/**
* Get the default assertion handler.
*
* This returns the function pointer that is called by default when an
* assertion is triggered. This is an internal function provided by SDL, that
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
* provide a different function.
*
* \returns the default SDL_AssertionHandler that is called when an assert
* triggers.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_GetAssertionHandler
*/
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
/**
* Get the current assertion handler.
*
* This returns the function pointer that is called when an assertion is
* triggered. This is either the value last passed to
* SDL_SetAssertionHandler(), or if no application-specified function is set,
* is equivalent to calling SDL_GetDefaultAssertionHandler().
*
* The parameter `puserdata` is a pointer to a void*, which will store the
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
* will always be NULL for the default handler. If you don't care about this
* data, it is safe to pass a NULL pointer to this function to ignore it.
*
* \param puserdata pointer which is filled with the "userdata" pointer that
* was passed to SDL_SetAssertionHandler()
* \returns the SDL_AssertionHandler that is called when an assert triggers.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_SetAssertionHandler
*/
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
/**
* Get a list of all assertion failures.
*
* This function gets all assertions triggered since the last call to
* SDL_ResetAssertionReport(), or the start of the program.
*
* The proper way to examine this data looks something like this:
*
* ```c
* const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) {
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
* item->condition, item->function, item->filename,
* item->linenum, item->trigger_count,
* item->always_ignore ? "yes" : "no");
* item = item->next;
* }
* ```
*
* \returns a list of all failed assertions or NULL if the list is empty. This
* memory should not be modified or freed by the application.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_ResetAssertionReport
*/
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
/**
* Clear the list of all assertion failures.
*
* This function will clear the list of all assertions triggered up to that
* point. Immediately following this call, SDL_GetAssertionReport will return
* no items. In addition, any previously-triggered assertions will be reset to
* a trigger_count of zero, and their always_ignore state will be false.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetAssertionReport
*/
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
/* these had wrong naming conventions until 2.0.4. Please update your app! */
#define SDL_assert_state SDL_AssertState
#define SDL_assert_data SDL_AssertData
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -57,17 +57,17 @@
*/ */
#ifndef SDL_atomic_h_ #ifndef SDL_atomic_h_
#define SDL_atomic_h_ #define SDL_atomic_h_
#include "SDL_platform.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_platform.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \name SDL AtomicLock * \name SDL AtomicLock
@ -137,30 +137,27 @@ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
*/ */
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
/* @} */ /* SDL AtomicLock */ /* @} *//* SDL AtomicLock */
/**
* The compiler barrier prevents the compiler from reordering /**
* reads and writes to globally visible variables across the call. * The compiler barrier prevents the compiler from reordering
*/ * reads and writes to globally visible variables across the call.
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) */
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
void _ReadWriteBarrier(void); void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier) #pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier() #define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__("" : : : "memory") #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
extern __inline void SDL_CompilerBarrier(void); extern __inline void SDL_CompilerBarrier(void);
#pragma aux SDL_CompilerBarrier = "" parm[] modify exact[]; #pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
#else #else
#define SDL_CompilerBarrier() \ #define SDL_CompilerBarrier() \
{ \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
SDL_SpinLock _tmp = 0; \ #endif
SDL_AtomicLock(&_tmp); \
SDL_AtomicUnlock(&_tmp); \
}
#endif
/** /**
* Memory barriers are designed to prevent reads and writes from being * Memory barriers are designed to prevent reads and writes from being
@ -186,14 +183,14 @@ extern __inline void SDL_CompilerBarrier(void);
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
#define SDL_MemoryBarrierRelease() __asm__ __volatile__("lwsync" : : : "memory") #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
#elif defined(__GNUC__) && defined(__aarch64__) #elif defined(__GNUC__) && defined(__aarch64__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__("dmb ish" : : : "memory") #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__GNUC__) && defined(__arm__) #elif defined(__GNUC__) && defined(__arm__)
#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */ #if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
/* Information from: /* Information from:
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19 https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
@ -201,76 +198,69 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
hard-coded at address 0xffff0fa0 hard-coded at address 0xffff0fa0
*/ */
typedef void (*SDL_KernelMemoryBarrierFunc)(); typedef void (*SDL_KernelMemoryBarrierFunc)();
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() #define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() #define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
#elif 0 /* defined(__QNXNTO__) */ #elif 0 /* defined(__QNXNTO__) */
#include <sys/cpuinline.h> #include <sys/cpuinline.h>
#define SDL_MemoryBarrierRelease() __cpu_membarrier() #define SDL_MemoryBarrierRelease() __cpu_membarrier()
#define SDL_MemoryBarrierAcquire() __cpu_membarrier() #define SDL_MemoryBarrierAcquire() __cpu_membarrier()
#else #else
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || \ #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__)
defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierRelease() __asm__ __volatile__("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __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__)
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \ #ifdef __thumb__
defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) /* The mcr instruction isn't available in thumb mode, use real functions */
#ifdef __thumb__ #define SDL_MEMORY_BARRIER_USES_FUNCTION
/* The mcr instruction isn't available in thumb mode, use real functions */ #define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
#define SDL_MEMORY_BARRIER_USES_FUNCTION #define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() #else
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#else #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#define SDL_MemoryBarrierRelease() __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #endif /* __thumb__ */
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #else
#endif /* __thumb__ */ #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#else #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierRelease() __asm__ __volatile__("" : : : "memory") #endif /* __LINUX__ || __ANDROID__ */
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__("" : : : "memory") #endif /* __GNUC__ && __arm__ */
#endif /* __LINUX__ || __ANDROID__ */ #else
#endif /* __GNUC__ && __arm__ */ #if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
#else /* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) #include <mbarrier.h>
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */ #define SDL_MemoryBarrierRelease() __machine_rel_barrier()
#include <mbarrier.h> #define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
#define SDL_MemoryBarrierRelease() __machine_rel_barrier() #else
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier() /* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
#else #define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ #define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() #endif
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() #endif
#endif
#endif /* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__)
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
#elif (defined(__powerpc__) || defined(__powerpc64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
#define SDL_CPUPauseInstruction() __yield()
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline void SDL_CPUPauseInstruction(void);
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause"
#else
#define SDL_CPUPauseInstruction()
#endif
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
#define SDL_CPUPauseInstruction() \
__asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__)
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
#elif (defined(__powerpc__) || defined(__powerpc64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#define SDL_CPUPauseInstruction() \
_mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
#define SDL_CPUPauseInstruction() __yield()
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline void SDL_CPUPauseInstruction(void);
#pragma aux SDL_CPUPauseInstruction = ".686p" \
".xmm2" \
"pause"
#else
#define SDL_CPUPauseInstruction()
#endif
/** /**
* \brief A type representing an atomic integer value. It is a struct * \brief A type representing an atomic integer value. It is a struct
* so people don't accidentally use numeric operations on it. * so people don't accidentally use numeric operations on it.
*/ */
typedef struct { typedef struct { int value; } SDL_atomic_t;
int value;
} SDL_atomic_t;
/** /**
* Set an atomic variable to a new value if it is currently an old value. * Set an atomic variable to a new value if it is currently an old value.
@ -343,22 +333,22 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
*/ */
extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v); extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
/** /**
* \brief Increment an atomic variable used as a reference count. * \brief Increment an atomic variable used as a reference count.
*/ */
#ifndef SDL_AtomicIncRef #ifndef SDL_AtomicIncRef
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) #define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
#endif #endif
/** /**
* \brief Decrement an atomic variable used as a reference count. * \brief Decrement an atomic variable used as a reference count.
* *
* \return SDL_TRUE if the variable reached zero after decrementing, * \return SDL_TRUE if the variable reached zero after decrementing,
* SDL_FALSE otherwise * SDL_FALSE otherwise
*/ */
#ifndef SDL_AtomicDecRef #ifndef SDL_AtomicDecRef
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) #define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
#endif #endif
/** /**
* Set a pointer to a new value if it is currently an old value. * Set a pointer to a new value if it is currently an old value.
@ -394,7 +384,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *
* \sa SDL_AtomicCASPtr * \sa SDL_AtomicCASPtr
* \sa SDL_AtomicGetPtr * \sa SDL_AtomicGetPtr
*/ */
extern DECLSPEC void *SDLCALL SDL_AtomicSetPtr(void **a, void *v); extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
/** /**
* Get the value of a pointer atomically. * Get the value of a pointer atomically.
@ -410,14 +400,14 @@ extern DECLSPEC void *SDLCALL SDL_AtomicSetPtr(void **a, void *v);
* \sa SDL_AtomicCASPtr * \sa SDL_AtomicCASPtr
* \sa SDL_AtomicSetPtr * \sa SDL_AtomicSetPtr
*/ */
extern DECLSPEC void *SDLCALL SDL_AtomicGetPtr(void **a); extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_atomic_h_ */ #endif /* SDL_atomic_h_ */

View File

@ -28,20 +28,20 @@
*/ */
#ifndef SDL_audio_h_ #ifndef SDL_audio_h_
#define SDL_audio_h_ #define SDL_audio_h_
#include "SDL_endian.h" #include "SDL_stdinc.h"
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_mutex.h" #include "SDL_endian.h"
#include "SDL_rwops.h" #include "SDL_mutex.h"
#include "SDL_stdinc.h" #include "SDL_thread.h"
#include "SDL_thread.h" #include "SDL_rwops.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \brief Audio format flags. * \brief Audio format flags.
@ -70,85 +70,83 @@ typedef Uint16 SDL_AudioFormat;
*/ */
/* @{ */ /* @{ */
#define SDL_AUDIO_MASK_BITSIZE (0xFF) #define SDL_AUDIO_MASK_BITSIZE (0xFF)
#define SDL_AUDIO_MASK_DATATYPE (1 << 8) #define SDL_AUDIO_MASK_DATATYPE (1<<8)
#define SDL_AUDIO_MASK_ENDIAN (1 << 12) #define SDL_AUDIO_MASK_ENDIAN (1<<12)
#define SDL_AUDIO_MASK_SIGNED (1 << 15) #define SDL_AUDIO_MASK_SIGNED (1<<15)
#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) #define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) #define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) #define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) #define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) #define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) #define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
/** /**
* \name Audio format flags * \name Audio format flags
* *
* Defaults to LSB byte order. * Defaults to LSB byte order.
*/ */
/* @{ */ /* @{ */
#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */
#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */
#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ #define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */
#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ #define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */
#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */
#define AUDIO_U16 AUDIO_U16LSB #define AUDIO_U16 AUDIO_U16LSB
#define AUDIO_S16 AUDIO_S16LSB #define AUDIO_S16 AUDIO_S16LSB
/* @} */
/**
* \name int32 support
*/
/* @{ */
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
#define AUDIO_S32 AUDIO_S32LSB
/* @} */
/**
* \name float32 support
*/
/* @{ */
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
#define AUDIO_F32 AUDIO_F32LSB
/* @} */
/**
* \name Native audio byte ordering
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define AUDIO_U16SYS AUDIO_U16LSB
#define AUDIO_S16SYS AUDIO_S16LSB
#define AUDIO_S32SYS AUDIO_S32LSB
#define AUDIO_F32SYS AUDIO_F32LSB
#else
#define AUDIO_U16SYS AUDIO_U16MSB
#define AUDIO_S16SYS AUDIO_S16MSB
#define AUDIO_S32SYS AUDIO_S32MSB
#define AUDIO_F32SYS AUDIO_F32MSB
#endif
/* @} */
/**
* \name Allow change flags
*
* Which audio format changes are allowed when opening a device.
*/
/* @{ */
#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008
#define SDL_AUDIO_ALLOW_ANY_CHANGE \
(SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_FORMAT_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE | \
SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
/* @} */ /* @} */
/* @} */ /* Audio flags */ /**
* \name int32 support
*/
/* @{ */
#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */
#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */
#define AUDIO_S32 AUDIO_S32LSB
/* @} */
/**
* \name float32 support
*/
/* @{ */
#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */
#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */
#define AUDIO_F32 AUDIO_F32LSB
/* @} */
/**
* \name Native audio byte ordering
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define AUDIO_U16SYS AUDIO_U16LSB
#define AUDIO_S16SYS AUDIO_S16LSB
#define AUDIO_S32SYS AUDIO_S32LSB
#define AUDIO_F32SYS AUDIO_F32LSB
#else
#define AUDIO_U16SYS AUDIO_U16MSB
#define AUDIO_S16SYS AUDIO_S16MSB
#define AUDIO_S32SYS AUDIO_S32MSB
#define AUDIO_F32SYS AUDIO_F32MSB
#endif
/* @} */
/**
* \name Allow change flags
*
* Which audio format changes are allowed when opening a device.
*/
/* @{ */
#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008
#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
/* @} */
/* @} *//* Audio flags */
/** /**
* This function is called when the audio device needs more data. * This function is called when the audio device needs more data.
@ -164,7 +162,8 @@ typedef Uint16 SDL_AudioFormat;
* You can choose to avoid callbacks and use SDL_QueueAudio() instead, if * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
* you like. Just open your audio device with a NULL callback. * you like. Just open your audio device with a NULL callback.
*/ */
typedef void(SDLCALL *SDL_AudioCallback)(void *userdata, Uint8 *stream, int len); typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
int len);
/** /**
* The calculated values in this structure are calculated by SDL_OpenAudio(). * The calculated values in this structure are calculated by SDL_OpenAudio().
@ -178,68 +177,73 @@ typedef void(SDLCALL *SDL_AudioCallback)(void *userdata, Uint8 *stream, int len)
* 7: FL FR FC LFE BC SL SR (6.1 surround) * 7: FL FR FC LFE BC SL SR (6.1 surround)
* 8: FL FR FC LFE BL BR SL SR (7.1 surround) * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
*/ */
typedef struct SDL_AudioSpec { typedef struct SDL_AudioSpec
int freq; /**< DSP frequency -- samples per second */ {
SDL_AudioFormat format; /**< Audio data format */ int freq; /**< DSP frequency -- samples per second */
Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ SDL_AudioFormat format; /**< Audio data format */
Uint8 silence; /**< Audio buffer silence value (calculated) */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */
Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ Uint8 silence; /**< Audio buffer silence value (calculated) */
Uint16 padding; /**< Necessary for some compile environments */ Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */
Uint32 size; /**< Audio buffer size in bytes (calculated) */ Uint16 padding; /**< Necessary for some compile environments */
SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ Uint32 size; /**< Audio buffer size in bytes (calculated) */
void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */
void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */
} SDL_AudioSpec; } SDL_AudioSpec;
struct SDL_AudioCVT; struct SDL_AudioCVT;
typedef void(SDLCALL *SDL_AudioFilter)(struct SDL_AudioCVT *cvt, SDL_AudioFormat format); typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
SDL_AudioFormat format);
/** /**
* \brief Upper limit of filters in SDL_AudioCVT * \brief Upper limit of filters in SDL_AudioCVT
* *
* The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
* currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
* one of which is the terminating NULL pointer. * one of which is the terminating NULL pointer.
*/ */
#define SDL_AUDIOCVT_MAX_FILTERS 9 #define SDL_AUDIOCVT_MAX_FILTERS 9
/** /**
* \struct SDL_AudioCVT * \struct SDL_AudioCVT
* \brief A structure to hold a set of audio conversion filters and buffers. * \brief A structure to hold a set of audio conversion filters and buffers.
* *
* Note that various parts of the conversion pipeline can take advantage * Note that various parts of the conversion pipeline can take advantage
* of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require
* you to pass it aligned data, but can possibly run much faster if you * you to pass it aligned data, but can possibly run much faster if you
* set both its (buf) field to a pointer that is aligned to 16 bytes, and its * set both its (buf) field to a pointer that is aligned to 16 bytes, and its
* (len) field to something that's a multiple of 16, if possible. * (len) field to something that's a multiple of 16, if possible.
*/ */
#if defined(__GNUC__) && !defined(__CHERI_PURE_CAPABILITY__) #if defined(__GNUC__) && !defined(__CHERI_PURE_CAPABILITY__)
/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't
pad it out to 88 bytes to guarantee ABI compatibility between compilers. pad it out to 88 bytes to guarantee ABI compatibility between compilers.
This is not a concern on CHERI architectures, where pointers must be stored This is not a concern on CHERI architectures, where pointers must be stored
at aligned locations otherwise they will become invalid, and thus structs at aligned locations otherwise they will become invalid, and thus structs
containing pointers cannot be packed without giving a warning or error. containing pointers cannot be packed without giving a warning or error.
vvv vvv
The next time we rev the ABI, make sure to size the ints and add padding. The next time we rev the ABI, make sure to size the ints and add padding.
*/ */
#define SDL_AUDIOCVT_PACKED __attribute__((packed)) #define SDL_AUDIOCVT_PACKED __attribute__((packed))
#else #else
#define SDL_AUDIOCVT_PACKED #define SDL_AUDIOCVT_PACKED
#endif #endif
/* */ /* */
typedef struct SDL_AudioCVT { typedef struct SDL_AudioCVT
int needed; /**< Set to 1 if conversion possible */ {
SDL_AudioFormat src_format; /**< Source audio format */ int needed; /**< Set to 1 if conversion possible */
SDL_AudioFormat dst_format; /**< Target audio format */ SDL_AudioFormat src_format; /**< Source audio format */
double rate_incr; /**< Rate conversion increment */ SDL_AudioFormat dst_format; /**< Target audio format */
Uint8 *buf; /**< Buffer to hold entire audio data */ double rate_incr; /**< Rate conversion increment */
int len; /**< Length of original audio buffer */ Uint8 *buf; /**< Buffer to hold entire audio data */
int len_cvt; /**< Length of converted audio buffer */ int len; /**< Length of original audio buffer */
int len_mult; /**< buffer must be len*len_mult big */ int len_cvt; /**< Length of converted audio buffer */
double len_ratio; /**< Given len, final size is len*len_ratio */ int len_mult; /**< buffer must be len*len_mult big */
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ double len_ratio; /**< Given len, final size is len*len_ratio */
int filter_index; /**< Current audio conversion function */ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */
int filter_index; /**< Current audio conversion function */
} SDL_AUDIOCVT_PACKED SDL_AudioCVT; } SDL_AUDIOCVT_PACKED SDL_AudioCVT;
/* Function prototypes */ /* Function prototypes */
/** /**
@ -400,7 +404,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
* \sa SDL_PauseAudio * \sa SDL_PauseAudio
* \sa SDL_UnlockAudio * \sa SDL_UnlockAudio
*/ */
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
SDL_AudioSpec * obtained);
/** /**
* SDL Audio Device IDs. * SDL Audio Device IDs.
@ -484,7 +489,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
* \sa SDL_GetNumAudioDevices * \sa SDL_GetNumAudioDevices
* \sa SDL_GetDefaultAudioInfo * \sa SDL_GetDefaultAudioInfo
*/ */
extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, int iscapture); extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
int iscapture);
/** /**
* Get the preferred audio format of a specific audio device. * Get the preferred audio format of a specific audio device.
@ -509,7 +515,10 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, int iscapt
* \sa SDL_GetNumAudioDevices * \sa SDL_GetNumAudioDevices
* \sa SDL_GetDefaultAudioInfo * \sa SDL_GetDefaultAudioInfo
*/ */
extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, int iscapture, SDL_AudioSpec *spec); extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
int iscapture,
SDL_AudioSpec *spec);
/** /**
* Get the name and preferred format of the default audio device. * Get the name and preferred format of the default audio device.
@ -541,7 +550,10 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, int iscapture, SDL
* \sa SDL_GetAudioDeviceSpec * \sa SDL_GetAudioDeviceSpec
* \sa SDL_OpenAudioDevice * \sa SDL_OpenAudioDevice
*/ */
extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture); extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
SDL_AudioSpec *spec,
int iscapture);
/** /**
* Open a specific audio device. * Open a specific audio device.
@ -654,9 +666,14 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, SDL_AudioSpec *
* \sa SDL_PauseAudioDevice * \sa SDL_PauseAudioDevice
* \sa SDL_UnlockAudioDevice * \sa SDL_UnlockAudioDevice
*/ */
extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char *device, int iscapture, extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(
const SDL_AudioSpec *desired, SDL_AudioSpec *obtained, const char *device,
int allowed_changes); int iscapture,
const SDL_AudioSpec *desired,
SDL_AudioSpec *obtained,
int allowed_changes);
/** /**
* \name Audio state * \name Audio state
@ -664,7 +681,12 @@ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char *device
* Get the current audio state. * Get the current audio state.
*/ */
/* @{ */ /* @{ */
typedef enum { SDL_AUDIO_STOPPED = 0, SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED } SDL_AudioStatus; typedef enum
{
SDL_AUDIO_STOPPED = 0,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED
} SDL_AudioStatus;
/** /**
* This function is a legacy means of querying the audio device. * This function is a legacy means of querying the audio device.
@ -698,7 +720,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
* \sa SDL_PauseAudioDevice * \sa SDL_PauseAudioDevice
*/ */
extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
/* @} */ /* Audio State */ /* @} *//* Audio State */
/** /**
* \name Pause audio functions * \name Pause audio functions
@ -760,8 +782,9 @@ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
* *
* \sa SDL_LockAudioDevice * \sa SDL_LockAudioDevice
*/ */
extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, int pause_on); extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
/* @} */ /* Pause audio functions */ int pause_on);
/* @} *//* Pause audio functions */
/** /**
* Load the audio data of a WAVE file into memory. * Load the audio data of a WAVE file into memory.
@ -844,15 +867,18 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, int pau
* \sa SDL_FreeWAV * \sa SDL_FreeWAV
* \sa SDL_LoadWAV * \sa SDL_LoadWAV
*/ */
extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
Uint8 **audio_buf, Uint32 *audio_len); int freesrc,
SDL_AudioSpec * spec,
Uint8 ** audio_buf,
Uint32 * audio_len);
/** /**
* Loads a WAV from a file. * Loads a WAV from a file.
* Compatibility convenience function. * Compatibility convenience function.
*/ */
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1, spec, audio_buf, audio_len) SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
/** /**
* Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW().
@ -869,7 +895,7 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesr
* \sa SDL_LoadWAV * \sa SDL_LoadWAV
* \sa SDL_LoadWAV_RW * \sa SDL_LoadWAV_RW
*/ */
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf); extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
/** /**
* Initialize an SDL_AudioCVT structure for conversion. * Initialize an SDL_AudioCVT structure for conversion.
@ -903,8 +929,12 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
* *
* \sa SDL_ConvertAudio * \sa SDL_ConvertAudio
*/ */
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, SDL_AudioFormat src_format, Uint8 src_channels, extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
int src_rate, SDL_AudioFormat dst_format, Uint8 dst_channels, SDL_AudioFormat src_format,
Uint8 src_channels,
int src_rate,
SDL_AudioFormat dst_format,
Uint8 dst_channels,
int dst_rate); int dst_rate);
/** /**
@ -945,7 +975,7 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, SDL_AudioFormat
* *
* \sa SDL_BuildAudioCVT * \sa SDL_BuildAudioCVT
*/ */
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt); extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
/* SDL_AudioStream is a new audio conversion interface. /* SDL_AudioStream is a new audio conversion interface.
The benefits vs SDL_AudioCVT: The benefits vs SDL_AudioCVT:
@ -978,9 +1008,12 @@ typedef struct _SDL_AudioStream SDL_AudioStream;
* \sa SDL_AudioStreamClear * \sa SDL_AudioStreamClear
* \sa SDL_FreeAudioStream * \sa SDL_FreeAudioStream
*/ */
extern DECLSPEC SDL_AudioStream *SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format,
const int src_rate, const SDL_AudioFormat dst_format, const Uint8 src_channels,
const Uint8 dst_channels, const int dst_rate); const int src_rate,
const SDL_AudioFormat dst_format,
const Uint8 dst_channels,
const int dst_rate);
/** /**
* Add data to be converted/resampled to the stream. * Add data to be converted/resampled to the stream.
@ -1085,7 +1118,7 @@ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
*/ */
extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
#define SDL_MIX_MAXVOLUME 128 #define SDL_MIX_MAXVOLUME 128
/** /**
* This function is a legacy means of mixing audio. * This function is a legacy means of mixing audio.
@ -1109,7 +1142,8 @@ extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
* *
* \sa SDL_MixAudioFormat * \sa SDL_MixAudioFormat
*/ */
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
Uint32 len, int volume);
/** /**
* Mix audio data in a specified format. * Mix audio data in a specified format.
@ -1141,8 +1175,10 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 l
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
int volume); const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, int volume);
/** /**
* Queue more audio on non-callback devices. * Queue more audio on non-callback devices.
@ -1308,6 +1344,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
*/ */
extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev); extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev);
/** /**
* \name Audio lock functions * \name Audio lock functions
* *
@ -1409,7 +1446,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
* \sa SDL_LockAudioDevice * \sa SDL_LockAudioDevice
*/ */
extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
/* @} */ /* Audio lock functions */ /* @} *//* Audio lock functions */
/** /**
* This function is a legacy means of closing the audio device. * This function is a legacy means of closing the audio device.
@ -1452,11 +1489,11 @@ extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
*/ */
extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_audio_h_ */ #endif /* SDL_audio_h_ */

126
third_party/SDL2/include/SDL_bits.h vendored Normal file
View File

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

View File

@ -26,63 +26,66 @@
*/ */
#ifndef SDL_blendmode_h_ #ifndef SDL_blendmode_h_
#define SDL_blendmode_h_ #define SDL_blendmode_h_
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \brief The blend mode used in SDL_RenderCopy() and drawing operations. * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
*/ */
typedef enum { typedef enum
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending {
dstRGBA = srcRGBA */ SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending dstRGBA = srcRGBA */
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
dstA = srcA + (dstA * (1-srcA)) */ dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending dstA = srcA + (dstA * (1-srcA)) */
dstRGB = (srcRGB * srcA) + dstRGB SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstA = dstA */ dstRGB = (srcRGB * srcA) + dstRGB
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate dstA = dstA */
dstRGB = srcRGB * dstRGB SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
dstA = dstA */ dstRGB = srcRGB * dstRGB
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply dstA = dstA */
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
dstA = dstA */ dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
SDL_BLENDMODE_INVALID = 0x7FFFFFFF dstA = dstA */
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
} SDL_BlendMode; } SDL_BlendMode;
/** /**
* \brief The blend operation used when combining source and destination pixel components * \brief The blend operation used when combining source and destination pixel components
*/ */
typedef enum { typedef enum
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ {
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */
} SDL_BlendOperation; } SDL_BlendOperation;
/** /**
* \brief The normalized factor used to multiply pixel components * \brief The normalized factor used to multiply pixel components
*/ */
typedef enum { typedef enum
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ {
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
} SDL_BlendFactor; } SDL_BlendFactor;
/** /**
@ -177,15 +180,18 @@ typedef enum {
* \sa SDL_SetTextureBlendMode * \sa SDL_SetTextureBlendMode
* \sa SDL_GetTextureBlendMode * \sa SDL_GetTextureBlendMode
*/ */
extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode( extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, SDL_BlendOperation colorOperation, SDL_BlendFactor dstColorFactor,
SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, SDL_BlendOperation alphaOperation); SDL_BlendOperation colorOperation,
SDL_BlendFactor srcAlphaFactor,
SDL_BlendFactor dstAlphaFactor,
SDL_BlendOperation alphaOperation);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_blendmode_h_ */ #endif /* SDL_blendmode_h_ */

View File

@ -26,15 +26,15 @@
*/ */
#ifndef SDL_clipboard_h_ #ifndef SDL_clipboard_h_
#define SDL_clipboard_h_ #define SDL_clipboard_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Function prototypes */ /* Function prototypes */
@ -68,7 +68,7 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
* \sa SDL_HasClipboardText * \sa SDL_HasClipboardText
* \sa SDL_SetClipboardText * \sa SDL_SetClipboardText
*/ */
extern DECLSPEC char *SDLCALL SDL_GetClipboardText(void); extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
/** /**
* Query whether the clipboard exists and contains a non-empty text string. * Query whether the clipboard exists and contains a non-empty text string.
@ -113,7 +113,7 @@ extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text);
* \sa SDL_HasPrimarySelectionText * \sa SDL_HasPrimarySelectionText
* \sa SDL_SetPrimarySelectionText * \sa SDL_SetPrimarySelectionText
*/ */
extern DECLSPEC char *SDLCALL SDL_GetPrimarySelectionText(void); extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void);
/** /**
* Query whether the primary selection exists and contains a non-empty text * Query whether the primary selection exists and contains a non-empty text
@ -129,11 +129,12 @@ extern DECLSPEC char *SDLCALL SDL_GetPrimarySelectionText(void);
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void); extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus /* Ends C function definitions when using C++ */
#ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_clipboard_h_ */ #endif /* SDL_clipboard_h_ */

333
third_party/SDL2/include/SDL_config.h vendored Normal file
View File

@ -0,0 +1,333 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_windows_h_
#define SDL_config_windows_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK,
* but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence.
* If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */
#if !defined(HAVE_WINSDKVER_H) && defined(__has_include)
#if __has_include(<winsdkver.h>)
#define HAVE_WINSDKVER_H 1
#endif
#endif
#ifdef HAVE_WINSDKVER_H
#include <winsdkver.h>
#endif
/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the
* Windows 10 SDK have broken declarations for the C API for DirectX 12. */
#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include)
#if __has_include(<sdkddkver.h>)
#define HAVE_SDKDDKVER_H 1
#endif
#endif
#ifdef HAVE_SDKDDKVER_H
#include <sdkddkver.h>
#endif
/* This is a set of defines to configure the SDL features */
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#else
#define HAVE_STDINT_H 1
#endif /* Visual Studio 2008 */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef _WIN64
# define SIZEOF_VOIDP 8
#else
# define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#ifndef __WATCOMC__
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
#define HAVE_D3D11_H 1
#define HAVE_ROAPI_H 1
#endif
#if defined(__has_include)
#if __has_include(<d3d12.h>) && __has_include(<d3d12sdklayers.h>)
#define HAVE_D3D12_H 1
#endif
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */
#define HAVE_SHELLSCALINGAPI_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_SENSORSAPI_H 1
#endif
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_IMMINTRIN_H 1
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
/* OpenWatcom requires specific calling conventions for qsort and bsearch */
#ifndef __WATCOMC__
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#endif
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE__WCSDUP 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_FMOD 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#ifndef __WATCOMC__
#define HAVE_ACOSF 1
#define HAVE_ASINF 1
#define HAVE_ATANF 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COSF 1
#define HAVE_EXPF 1
#define HAVE_FABSF 1
#define HAVE_FLOORF 1
#define HAVE_FMODF 1
#define HAVE_LOGF 1
#define HAVE_LOG10F 1
#define HAVE_POWF 1
#define HAVE_SINF 1
#define HAVE_SQRTF 1
#define HAVE_TANF 1
#endif
#if defined(_MSC_VER)
/* These functions were added with the VC++ 2013 C runtime library */
#if _MSC_VER >= 1800
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#endif
/* This function is available with at least the VC++ 2008 C runtime library */
#if _MSC_VER >= 1400
#define HAVE__FSEEKI64 1
#endif
#ifdef _USE_MATH_DEFINES
#define HAVE_M_PI 1
#endif
#elif defined(__WATCOMC__)
#define HAVE__FSEEKI64 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_ROUND 1
#define HAVE_SCALBN 1
#define HAVE_TRUNC 1
#else
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif
/* Enable various audio drivers */
#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
#endif
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#ifndef __WINRT__
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
#else
#define SDL_SENSOR_DUMMY 1
#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
#define SDL_POWER_WINDOWS 1
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
#endif /* SDL_config_windows_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -26,115 +26,116 @@
*/ */
#ifndef SDL_cpuinfo_h_ #ifndef SDL_cpuinfo_h_
#define SDL_cpuinfo_h_ #define SDL_cpuinfo_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
/* Need to do this here because intrin.h has C++ code in it */ /* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
#ifdef __clang__ #ifdef __clang__
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version, /* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */ so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifndef __PRFCHWINTRIN_H #ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H #define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__)) _m_prefetch(void *__P) { static __inline__ void __attribute__((__always_inline__, __nodebug__))
__builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */); _m_prefetch(void *__P)
{
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
} }
#endif /* __PRFCHWINTRIN_H */ #endif /* __PRFCHWINTRIN_H */
#endif /* __clang__ */ #endif /* __clang__ */
#include <intrin.h> #include <intrin.h>
#ifndef _WIN64 #ifndef _WIN64
#ifndef __MMX__ #ifndef __MMX__
#define __MMX__ #define __MMX__
#endif #endif
#ifndef __3dNOW__ #ifndef __3dNOW__
#define __3dNOW__ #define __3dNOW__
#endif #endif
#endif #endif
#ifndef __SSE__ #ifndef __SSE__
#define __SSE__ #define __SSE__
#endif #endif
#ifndef __SSE2__ #ifndef __SSE2__
#define __SSE2__ #define __SSE2__
#endif #endif
#ifndef __SSE3__ #ifndef __SSE3__
#define __SSE3__ #define __SSE3__
#endif #endif
#elif defined(__MINGW64_VERSION_MAJOR) #elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h> #include <intrin.h>
#if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON) #if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
#include <arm_neon.h> # include <arm_neon.h>
#endif #endif
#else #else
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define /* 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. */
* SDL_ENABLE_ALTIVEC_H to have it included. */ #if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H) #include <altivec.h>
#include <altivec.h> #endif
#endif #if !defined(SDL_DISABLE_ARM_NEON_H)
#if !defined(SDL_DISABLE_ARM_NEON_H) # if defined(__ARM_NEON)
#if defined(__ARM_NEON) # include <arm_neon.h>
#include <arm_neon.h> # elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)
#elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__) /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
/* 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)
#if defined(_M_ARM) # include <armintr.h>
#include <arm_neon.h> # include <arm_neon.h>
#include <armintr.h> # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
#define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ # endif
#endif # if defined (_M_ARM64)
#if defined(_M_ARM64) # include <arm64intr.h>
#include <arm64_neon.h> # include <arm64_neon.h>
#include <arm64intr.h> # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
#define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ # define __ARM_ARCH 8
#define __ARM_ARCH 8 # endif
#endif # endif
#endif #endif
#endif #endif /* compiler version */
#endif /* compiler version */
#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
#include <mm3dnow.h> #include <mm3dnow.h>
#endif #endif
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H) #if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
#include <lsxintrin.h> #include <lsxintrin.h>
#define __LSX__ #define __LSX__
#endif #endif
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H) #if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H)
#include <lasxintrin.h> #include <lasxintrin.h>
#define __LASX__ #define __LASX__
#endif #endif
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) #if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
#include <immintrin.h> #include <immintrin.h>
#else #else
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
#include <mmintrin.h> #include <mmintrin.h>
#endif #endif
#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
#include <xmmintrin.h> #include <xmmintrin.h>
#endif #endif
#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
#include <emmintrin.h> #include <emmintrin.h>
#endif #endif
#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) #if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
#include <pmmintrin.h> #include <pmmintrin.h>
#endif #endif
#endif /* HAVE_IMMINTRIN_H */ #endif /* HAVE_IMMINTRIN_H */
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* This is a guess for the cacheline size used for padding. /* This is a guess for the cacheline size used for padding.
* Most x86 processors have a 64 byte cache line. * Most x86 processors have a 64 byte cache line.
* The 64-bit PowerPC processors have a 128 byte cache line. * The 64-bit PowerPC processors have a 128 byte cache line.
* We'll use the larger value to be generally safe. * We'll use the larger value to be generally safe.
*/ */
#define SDL_CACHELINE_SIZE 128 #define SDL_CACHELINE_SIZE 128
/** /**
* Get the number of CPU cores available. * Get the number of CPU cores available.
@ -532,7 +533,7 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
* \sa SDL_SIMDRealloc * \sa SDL_SIMDRealloc
* \sa SDL_SIMDFree * \sa SDL_SIMDFree
*/ */
extern DECLSPEC void *SDLCALL SDL_SIMDAlloc(const size_t len); extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
/** /**
* Reallocate memory obtained from SDL_SIMDAlloc * Reallocate memory obtained from SDL_SIMDAlloc
@ -556,7 +557,7 @@ extern DECLSPEC void *SDLCALL SDL_SIMDAlloc(const size_t len);
* \sa SDL_SIMDAlloc * \sa SDL_SIMDAlloc
* \sa SDL_SIMDFree * \sa SDL_SIMDFree
*/ */
extern DECLSPEC void *SDLCALL SDL_SIMDRealloc(void *mem, const size_t len); extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
/** /**
* Deallocate memory obtained from SDL_SIMDAlloc * Deallocate memory obtained from SDL_SIMDAlloc
@ -582,11 +583,11 @@ extern DECLSPEC void *SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
*/ */
extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr); extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_cpuinfo_h_ */ #endif /* SDL_cpuinfo_h_ */

2352
third_party/SDL2/include/SDL_egl.h vendored Normal file

File diff suppressed because it is too large Load Diff

348
third_party/SDL2/include/SDL_endian.h vendored Normal file
View File

@ -0,0 +1,348 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_endian.h
*
* Functions for reading and writing endian-specific values
*/
#ifndef SDL_endian_h_
#define SDL_endian_h_
#include "SDL_stdinc.h"
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifdef __clang__
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetch(void *__P)
{
__builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */);
}
#endif /* __PRFCHWINTRIN_H */
#endif /* __clang__ */
#include <intrin.h>
#endif
/**
* \name The two types of endianness
*/
/* @{ */
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/* @} */
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
#ifdef __linux__
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__OpenBSD__) || defined(__DragonFly__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/endian.h>
#define SDL_BYTEORDER BYTE_ORDER
/* predefs from newer gcc and clang versions: */
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#else
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */
/* predefs from newer gcc versions: */
#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#elif defined(__MAVERICK__)
/* For Maverick, float words are always little-endian. */
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
/* For FPA, float words are always big-endian. */
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
#else
/* By default, assume that floats words follow the memory system mode. */
#define SDL_FLOATWORDORDER SDL_BYTEORDER
#endif /* __FLOAT_WORD_ORDER__ */
#endif /* !SDL_FLOATWORDORDER */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_endian.h
*/
/* various modern compilers may have builtin swap */
#if defined(__GNUC__) || defined(__clang__)
# define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
# define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
/* this one is broken */
# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
#else
# define HAS_BUILTIN_BSWAP16 0
# define HAS_BUILTIN_BSWAP32 0
# define HAS_BUILTIN_BSWAP64 0
# define HAS_BROKEN_BSWAP 0
#endif
#if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
return x;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
return x;
}
#elif (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
int result;
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
return (Uint16)result;
}
#elif (defined(__m68k__) && !defined(__mcoldfire__))
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint16 SDL_Swap16(Uint16);
#pragma aux SDL_Swap16 = \
"xchg al, ah" \
parm [ax] \
modify [ax];
#else
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
}
#endif
#if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswap %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswapl %0": "=r"(x):"0"(x));
return x;
}
#elif (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
Uint32 result;
__asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x));
__asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x));
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
return result;
}
#elif (defined(__m68k__) && !defined(__mcoldfire__))
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint32 SDL_Swap32(Uint32);
#pragma aux SDL_Swap32 = \
"bswap eax" \
parm [eax] \
modify [eax];
#else
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
((x >> 8) & 0x0000FF00) | (x >> 24)));
}
#endif
#if HAS_BUILTIN_BSWAP64
#define SDL_Swap64(x) __builtin_bswap64(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
union {
struct {
Uint32 a, b;
} s;
Uint64 u;
} v;
v.u = x;
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
: "=r"(v.s.a), "=r"(v.s.b)
: "0" (v.s.a), "1"(v.s.b));
return v.u;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
__asm__("bswapq %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint64 SDL_Swap64(Uint64);
#pragma aux SDL_Swap64 = \
"bswap eax" \
"bswap edx" \
"xchg eax,edx" \
parm [eax edx] \
modify [eax edx];
#else
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
Uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x >>= 32;
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x = SDL_Swap32(lo);
x <<= 32;
x |= SDL_Swap32(hi);
return (x);
}
#endif
SDL_FORCE_INLINE float
SDL_SwapFloat(float x)
{
union {
float f;
Uint32 ui32;
} swapper;
swapper.f = x;
swapper.ui32 = SDL_Swap32(swapper.ui32);
return swapper.f;
}
/* remove extra macros */
#undef HAS_BROKEN_BSWAP
#undef HAS_BUILTIN_BSWAP16
#undef HAS_BUILTIN_BSWAP32
#undef HAS_BUILTIN_BSWAP64
/**
* \name Swap to native
* Byteswap item from the specified endianness to the native endianness.
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
#define SDL_SwapFloatLE(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
#define SDL_SwapFloatBE(X) (X)
#endif
/* @} *//* Swap to native */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_endian_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -26,18 +26,19 @@
*/ */
#ifndef SDL_error_h_ #ifndef SDL_error_h_
#define SDL_error_h_ #define SDL_error_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Public functions */ /* Public functions */
/** /**
* Set the SDL error message for the current thread. * Set the SDL error message for the current thread.
* *
@ -116,7 +117,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetError(void);
* *
* \sa SDL_GetError * \sa SDL_GetError
*/ */
extern DECLSPEC char *SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen); extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
/** /**
* Clear any previous error message for this thread. * Clear any previous error message for this thread.
@ -128,26 +129,34 @@ extern DECLSPEC char *SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
*/ */
extern DECLSPEC void SDLCALL SDL_ClearError(void); extern DECLSPEC void SDLCALL SDL_ClearError(void);
/** /**
* \name Internal error functions * \name Internal error functions
* *
* \internal * \internal
* Private error reporting function - used internally. * Private error reporting function - used internally.
*/ */
/* @{ */ /* @{ */
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
typedef enum { SDL_ENOMEM, SDL_EFREAD, SDL_EFWRITE, SDL_EFSEEK, SDL_UNSUPPORTED, SDL_LASTERROR } SDL_errorcode; typedef enum
{
SDL_ENOMEM,
SDL_EFREAD,
SDL_EFWRITE,
SDL_EFSEEK,
SDL_UNSUPPORTED,
SDL_LASTERROR
} SDL_errorcode;
/* SDL_Error() unconditionally returns -1. */ /* SDL_Error() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
/* @} */ /* Internal error functions */ /* @} *//* Internal error functions */
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_error_h_ */ #endif /* SDL_error_h_ */

1159
third_party/SDL2/include/SDL_events.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -26,16 +26,16 @@
*/ */
#ifndef SDL_filesystem_h_ #ifndef SDL_filesystem_h_
#define SDL_filesystem_h_ #define SDL_filesystem_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* Get the directory where the application was run from. * Get the directory where the application was run from.
@ -138,11 +138,11 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
*/ */
extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_filesystem_h_ */ #endif /* SDL_filesystem_h_ */

View File

@ -26,19 +26,19 @@
*/ */
#ifndef SDL_gamecontroller_h_ #ifndef SDL_gamecontroller_h_
#define SDL_gamecontroller_h_ #define SDL_gamecontroller_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_joystick.h" #include "SDL_error.h"
#include "SDL_rwops.h" #include "SDL_rwops.h"
#include "SDL_sensor.h" #include "SDL_sensor.h"
#include "SDL_stdinc.h" #include "SDL_joystick.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \file SDL_gamecontroller.h * \file SDL_gamecontroller.h
@ -58,47 +58,52 @@ extern "C" {
struct _SDL_GameController; struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController; typedef struct _SDL_GameController SDL_GameController;
typedef enum { typedef enum
SDL_CONTROLLER_TYPE_UNKNOWN = 0, {
SDL_CONTROLLER_TYPE_XBOX360, SDL_CONTROLLER_TYPE_UNKNOWN = 0,
SDL_CONTROLLER_TYPE_XBOXONE, SDL_CONTROLLER_TYPE_XBOX360,
SDL_CONTROLLER_TYPE_PS3, SDL_CONTROLLER_TYPE_XBOXONE,
SDL_CONTROLLER_TYPE_PS4, SDL_CONTROLLER_TYPE_PS3,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO, SDL_CONTROLLER_TYPE_PS4,
SDL_CONTROLLER_TYPE_VIRTUAL, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
SDL_CONTROLLER_TYPE_PS5, SDL_CONTROLLER_TYPE_VIRTUAL,
SDL_CONTROLLER_TYPE_AMAZON_LUNA, SDL_CONTROLLER_TYPE_PS5,
SDL_CONTROLLER_TYPE_GOOGLE_STADIA, SDL_CONTROLLER_TYPE_AMAZON_LUNA,
SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, SDL_CONTROLLER_TYPE_GOOGLE_STADIA,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, SDL_CONTROLLER_TYPE_NVIDIA_SHIELD,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT,
SDL_CONTROLLER_TYPE_MAX SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR,
SDL_CONTROLLER_TYPE_MAX
} SDL_GameControllerType; } SDL_GameControllerType;
typedef enum { typedef enum
SDL_CONTROLLER_BINDTYPE_NONE = 0, {
SDL_CONTROLLER_BINDTYPE_BUTTON, SDL_CONTROLLER_BINDTYPE_NONE = 0,
SDL_CONTROLLER_BINDTYPE_AXIS, SDL_CONTROLLER_BINDTYPE_BUTTON,
SDL_CONTROLLER_BINDTYPE_HAT SDL_CONTROLLER_BINDTYPE_AXIS,
SDL_CONTROLLER_BINDTYPE_HAT
} SDL_GameControllerBindType; } SDL_GameControllerBindType;
/** /**
* Get the SDL joystick layer binding for this controller button/axis mapping * Get the SDL joystick layer binding for this controller button/axis mapping
*/ */
typedef struct SDL_GameControllerButtonBind { typedef struct SDL_GameControllerButtonBind
SDL_GameControllerBindType bindType; {
union { SDL_GameControllerBindType bindType;
int button; union
int axis; {
struct { int button;
int hat; int axis;
int hat_mask; struct {
} hat; int hat;
} value; int hat_mask;
} hat;
} value;
} SDL_GameControllerButtonBind; } SDL_GameControllerButtonBind;
/** /**
* To count the number of game controllers in the system for the following: * To count the number of game controllers in the system for the following:
* *
@ -112,20 +117,21 @@ typedef struct SDL_GameControllerButtonBind {
* } * }
* ``` * ```
* *
* Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
* controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
* guid,name,mappings * guid,name,mappings
* *
* Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
* and mappings are controller mappings to joystick ones. Under Windows there is a reserved GUID of "xinput" that covers * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
* any XInput devices. The mapping format for joystick is: bX - a joystick button, index X hX.Y - hat X with value Y aX * The mapping format for joystick is:
* - axis X of the joystick Buttons can be used as a controller axis and vice versa. * bX - a joystick button, index X
* hX.Y - hat X with value Y
* aX - axis X of the joystick
* Buttons can be used as a controller axis and vice versa.
* *
* This string shows an example of a valid mapping for a controller * This string shows an example of a valid mapping for a controller
* *
* ```c * ```c
* "03000000341a00003608000000000000,PS3 * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
* Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
* ``` * ```
*/ */
@ -157,14 +163,14 @@ typedef struct SDL_GameControllerButtonBind {
* \sa SDL_GameControllerAddMappingsFromFile * \sa SDL_GameControllerAddMappingsFromFile
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw); extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
/** /**
* Load a set of mappings from a file, filtered by the current SDL_GetPlatform() * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
* *
* Convenience macro. * Convenience macro.
*/ */
#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1) #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
/** /**
* Add support for controllers that SDL is unaware of or to cause an existing * Add support for controllers that SDL is unaware of or to cause an existing
@ -181,8 +187,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, i
* This string shows an example of a valid mapping for a controller: * This string shows an example of a valid mapping for a controller:
* *
* ```c * ```c
* "341a3608000000000000504944564944,Afterglow PS3 * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
* Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
* ``` * ```
* *
* \param mappingString the mapping string * \param mappingString the mapping string
@ -194,7 +199,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, i
* \sa SDL_GameControllerMapping * \sa SDL_GameControllerMapping
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char *mappingString); extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
/** /**
* Get the number of mappings installed. * Get the number of mappings installed.
@ -213,7 +218,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void);
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index);
/** /**
* Get the game controller mapping string for a given GUID. * Get the game controller mapping string for a given GUID.
@ -229,7 +234,7 @@ extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForIndex(int mapping_inde
* \sa SDL_JoystickGetDeviceGUID * \sa SDL_JoystickGetDeviceGUID
* \sa SDL_JoystickGetGUID * \sa SDL_JoystickGetGUID
*/ */
extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid);
/** /**
* Get the current mapping of a Game Controller. * Get the current mapping of a Game Controller.
@ -248,7 +253,7 @@ extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID
* \sa SDL_GameControllerAddMapping * \sa SDL_GameControllerAddMapping
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
*/ */
extern DECLSPEC char *SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller); extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller);
/** /**
* Check if the given joystick is supported by the game controller interface. * Check if the given joystick is supported by the game controller interface.
@ -517,7 +522,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameCont
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC const char *SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
/** /**
* Get the Steam Input handle of an opened controller, if available. * Get the Steam Input handle of an opened controller, if available.
@ -532,6 +537,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerGetSerial(SDL_GameControll
*/ */
extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller); extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller);
/** /**
* Check if a controller has been opened and is currently connected. * Check if a controller has been opened and is currently connected.
* *
@ -599,6 +605,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state);
*/ */
extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
/** /**
* The list of axes available from a controller * The list of axes available from a controller
* *
@ -610,15 +617,16 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
* (fully pressed) when reported by SDL_GameControllerGetAxis(). Note that this is not the * (fully pressed) when reported by SDL_GameControllerGetAxis(). Note that this is not the
* same range that will be reported by the lower-level SDL_GetJoystickAxis(). * same range that will be reported by the lower-level SDL_GetJoystickAxis().
*/ */
typedef enum { typedef enum
SDL_CONTROLLER_AXIS_INVALID = -1, {
SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_INVALID = -1,
SDL_CONTROLLER_AXIS_LEFTY, SDL_CONTROLLER_AXIS_LEFTX,
SDL_CONTROLLER_AXIS_RIGHTX, SDL_CONTROLLER_AXIS_LEFTY,
SDL_CONTROLLER_AXIS_RIGHTY, SDL_CONTROLLER_AXIS_RIGHTX,
SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_CONTROLLER_AXIS_RIGHTY,
SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_CONTROLLER_AXIS_TRIGGERLEFT,
SDL_CONTROLLER_AXIS_MAX SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
SDL_CONTROLLER_AXIS_MAX
} SDL_GameControllerAxis; } SDL_GameControllerAxis;
/** /**
@ -657,7 +665,7 @@ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromStri
* *
* \sa SDL_GameControllerGetAxisFromString * \sa SDL_GameControllerGetAxisFromString
*/ */
extern DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis);
/** /**
* Get the SDL joystick layer binding for a controller axis mapping. * Get the SDL joystick layer binding for a controller axis mapping.
@ -673,7 +681,8 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameC
* \sa SDL_GameControllerGetBindForButton * \sa SDL_GameControllerGetBindForButton
*/ */
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
SDL_GameControllerAxis axis);
/** /**
* Query whether a game controller has a given axis. * Query whether a game controller has a given axis.
@ -687,8 +696,8 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameCon
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, extern DECLSPEC SDL_bool SDLCALL
SDL_GameControllerAxis axis); SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
/** /**
* Get the current state of an axis control on a game controller. * Get the current state of an axis control on a game controller.
@ -712,37 +721,37 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasAxis(SDL_GameController *g
* *
* \sa SDL_GameControllerGetButton * \sa SDL_GameControllerGetButton
*/ */
extern DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, extern DECLSPEC Sint16 SDLCALL
SDL_GameControllerAxis axis); SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
/** /**
* The list of buttons available from a controller * The list of buttons available from a controller
*/ */
typedef enum { typedef enum
SDL_CONTROLLER_BUTTON_INVALID = -1, {
SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_INVALID = -1,
SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_A,
SDL_CONTROLLER_BUTTON_X, SDL_CONTROLLER_BUTTON_B,
SDL_CONTROLLER_BUTTON_Y, SDL_CONTROLLER_BUTTON_X,
SDL_CONTROLLER_BUTTON_BACK, SDL_CONTROLLER_BUTTON_Y,
SDL_CONTROLLER_BUTTON_GUIDE, SDL_CONTROLLER_BUTTON_BACK,
SDL_CONTROLLER_BUTTON_START, SDL_CONTROLLER_BUTTON_GUIDE,
SDL_CONTROLLER_BUTTON_LEFTSTICK, SDL_CONTROLLER_BUTTON_START,
SDL_CONTROLLER_BUTTON_RIGHTSTICK, SDL_CONTROLLER_BUTTON_LEFTSTICK,
SDL_CONTROLLER_BUTTON_LEFTSHOULDER, SDL_CONTROLLER_BUTTON_RIGHTSTICK,
SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_UP,
SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_DOWN,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
Amazon Luna microphone button */ SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */
SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 (upper left, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 (upper left, facing the back) */
SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 (upper right, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 (upper right, facing the back) */
SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 (lower left, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 (lower left, facing the back) */
SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 (lower right, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 (lower right, facing the back) */
SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */ SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */
SDL_CONTROLLER_BUTTON_MAX SDL_CONTROLLER_BUTTON_MAX
} SDL_GameControllerButton; } SDL_GameControllerButton;
/** /**
@ -775,7 +784,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom
* *
* \sa SDL_GameControllerGetButtonFromString * \sa SDL_GameControllerGetButtonFromString
*/ */
extern DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button);
/** /**
* Get the SDL joystick layer binding for a controller button mapping. * Get the SDL joystick layer binding for a controller button mapping.
@ -791,7 +800,8 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerGetStringForButton(SDL_Gam
* \sa SDL_GameControllerGetBindForAxis * \sa SDL_GameControllerGetBindForAxis
*/ */
extern DECLSPEC SDL_GameControllerButtonBind SDLCALL extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
SDL_GameControllerButton button);
/** /**
* Query whether a game controller has a given button. * Query whether a game controller has a given button.
@ -843,9 +853,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameCont
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
int finger, Uint8 *state, float *x, float *y,
float *pressure);
/** /**
* Return whether a game controller has a particular sensor. * Return whether a game controller has a particular sensor.
@ -868,8 +876,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled);
SDL_bool enabled);
/** /**
* Query whether sensor data reporting is enabled for a game controller. * Query whether sensor data reporting is enabled for a game controller.
@ -880,8 +887,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameControlle
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type);
SDL_SensorType type);
/** /**
* Get the data rate (number of events per second) of a game controller * Get the data rate (number of events per second) of a game controller
@ -893,8 +899,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameContr
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
*/ */
extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_SensorType type);
SDL_SensorType type);
/** /**
* Get the current state of a game controller sensor. * Get the current state of a game controller sensor.
@ -910,8 +915,7 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values);
float *data, int num_values);
/** /**
* Get the current state of a game controller sensor with the timestamp of the * Get the current state of a game controller sensor with the timestamp of the
@ -930,9 +934,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *
* *
* \since This function is available since SDL 2.26.0. * \since This function is available since SDL 2.26.0.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values);
SDL_SensorType type, Uint64 *timestamp,
float *data, int num_values);
/** /**
* Start a rumble effect on a game controller. * Start a rumble effect on a game controller.
@ -952,8 +954,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_Gam
* *
* \sa SDL_GameControllerHasRumble * \sa SDL_GameControllerHasRumble
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
Uint16 high_frequency_rumble, Uint32 duration_ms);
/** /**
* Start a rumble effect in the game controller's triggers. * Start a rumble effect in the game controller's triggers.
@ -978,8 +979,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon
* *
* \sa SDL_GameControllerHasRumbleTriggers * \sa SDL_GameControllerHasRumbleTriggers
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
Uint16 right_rumble, Uint32 duration_ms);
/** /**
* Query whether a game controller has an LED. * Query whether a game controller has an LED.
@ -1029,8 +1029,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameCon
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue);
Uint8 blue);
/** /**
* Send a controller specific effect packet * Send a controller specific effect packet
@ -1043,8 +1042,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecon
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, int size);
int size);
/** /**
* Close a game controller previously opened with SDL_GameControllerOpen(). * Close a game controller previously opened with SDL_GameControllerOpen().
@ -1070,8 +1068,7 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
* *
* \sa SDL_GameControllerGetAppleSFSymbolsNameForAxis * \sa SDL_GameControllerGetAppleSFSymbolsNameForAxis
*/ */
extern DECLSPEC const char *SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button);
SDL_GameControllerButton button);
/** /**
* Return the sfSymbolsName for a given axis on a game controller on Apple * Return the sfSymbolsName for a given axis on a game controller on Apple
@ -1085,14 +1082,14 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForBu
* *
* \sa SDL_GameControllerGetAppleSFSymbolsNameForButton * \sa SDL_GameControllerGetAppleSFSymbolsNameForButton
*/ */
extern DECLSPEC const char *SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
SDL_GameControllerAxis axis);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus /* Ends C function definitions when using C++ */
#ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_gamecontroller_h_ */ #endif /* SDL_gamecontroller_h_ */

View File

@ -26,19 +26,20 @@
*/ */
#ifndef SDL_gesture_h_ #ifndef SDL_gesture_h_
#define SDL_gesture_h_ #define SDL_gesture_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_error.h"
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_touch.h" #include "SDL_touch.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ #include "begin_code.h"
#ifdef __cplusplus /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef Sint64 SDL_GestureID; typedef Sint64 SDL_GestureID;
@ -59,6 +60,7 @@ typedef Sint64 SDL_GestureID;
*/ */
extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
/** /**
* Save all currently loaded Dollar Gesture templates. * Save all currently loaded Dollar Gesture templates.
* *
@ -86,7 +88,8 @@ extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
* \sa SDL_LoadDollarTemplates * \sa SDL_LoadDollarTemplates
* \sa SDL_SaveAllDollarTemplates * \sa SDL_SaveAllDollarTemplates
*/ */
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst); extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
/** /**
* Load Dollar Gesture templates from a file. * Load Dollar Gesture templates from a file.
@ -103,11 +106,11 @@ extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_
*/ */
extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_gesture_h_ */ #endif /* SDL_gesture_h_ */

View File

@ -26,16 +26,16 @@
*/ */
#ifndef SDL_guid_h_ #ifndef SDL_guid_h_
#define SDL_guid_h_ #define SDL_guid_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_error.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* An SDL_GUID is a 128-bit identifier for an input device that * An SDL_GUID is a 128-bit identifier for an input device that
@ -53,7 +53,7 @@ extern "C" {
* different GUIDs on different operating systems). * different GUIDs on different operating systems).
*/ */
typedef struct { typedef struct {
Uint8 data[16]; Uint8 data[16];
} SDL_GUID; } SDL_GUID;
/* Function prototypes */ /* Function prototypes */
@ -89,11 +89,11 @@ extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int
*/ */
extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID); extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_guid_h_ */ #endif /* SDL_guid_h_ */

View File

@ -105,17 +105,17 @@
*/ */
#ifndef SDL_haptic_h_ #ifndef SDL_haptic_h_
#define SDL_haptic_h_ #define SDL_haptic_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_joystick.h" #include "SDL_error.h"
#include "SDL_stdinc.h" #include "SDL_joystick.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). /* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF).
* *
@ -140,222 +140,225 @@ extern "C" {
struct _SDL_Haptic; struct _SDL_Haptic;
typedef struct _SDL_Haptic SDL_Haptic; typedef struct _SDL_Haptic SDL_Haptic;
/**
* \name Haptic features
*
* Different haptic features a device can have.
*/
/* @{ */
/** /**
* \name Haptic effects * \name Haptic features
*/ *
/* @{ */ * Different haptic features a device can have.
*/
/* @{ */
/** /**
* \brief Constant effect supported. * \name Haptic effects
* */
* Constant haptic effect. /* @{ */
*
* \sa SDL_HapticCondition
*/
#define SDL_HAPTIC_CONSTANT (1u << 0)
/** /**
* \brief Sine wave effect supported. * \brief Constant effect supported.
* *
* Periodic haptic effect that simulates sine waves. * Constant haptic effect.
* *
* \sa SDL_HapticPeriodic * \sa SDL_HapticCondition
*/ */
#define SDL_HAPTIC_SINE (1u << 1) #define SDL_HAPTIC_CONSTANT (1u<<0)
/** /**
* \brief Left/Right effect supported. * \brief Sine wave effect supported.
* *
* Haptic effect for direct control over high/low frequency motors. * Periodic haptic effect that simulates sine waves.
* *
* \sa SDL_HapticLeftRight * \sa SDL_HapticPeriodic
* \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry, */
* we ran out of bits, and this is important for XInput devices. #define SDL_HAPTIC_SINE (1u<<1)
*/
#define SDL_HAPTIC_LEFTRIGHT (1u << 2)
/* !!! FIXME: put this back when we have more bits in 2.1 */ /**
/* #define SDL_HAPTIC_SQUARE (1<<2) */ * \brief Left/Right effect supported.
*
* Haptic effect for direct control over high/low frequency motors.
*
* \sa SDL_HapticLeftRight
* \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
* we ran out of bits, and this is important for XInput devices.
*/
#define SDL_HAPTIC_LEFTRIGHT (1u<<2)
/** /* !!! FIXME: put this back when we have more bits in 2.1 */
* \brief Triangle wave effect supported. /* #define SDL_HAPTIC_SQUARE (1<<2) */
*
* Periodic haptic effect that simulates triangular waves.
*
* \sa SDL_HapticPeriodic
*/
#define SDL_HAPTIC_TRIANGLE (1u << 3)
/** /**
* \brief Sawtoothup wave effect supported. * \brief Triangle wave effect supported.
* *
* Periodic haptic effect that simulates saw tooth up waves. * Periodic haptic effect that simulates triangular waves.
* *
* \sa SDL_HapticPeriodic * \sa SDL_HapticPeriodic
*/ */
#define SDL_HAPTIC_SAWTOOTHUP (1u << 4) #define SDL_HAPTIC_TRIANGLE (1u<<3)
/** /**
* \brief Sawtoothdown wave effect supported. * \brief Sawtoothup wave effect supported.
* *
* Periodic haptic effect that simulates saw tooth down waves. * Periodic haptic effect that simulates saw tooth up waves.
* *
* \sa SDL_HapticPeriodic * \sa SDL_HapticPeriodic
*/ */
#define SDL_HAPTIC_SAWTOOTHDOWN (1u << 5) #define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
/** /**
* \brief Ramp effect supported. * \brief Sawtoothdown wave effect supported.
* *
* Ramp haptic effect. * Periodic haptic effect that simulates saw tooth down waves.
* *
* \sa SDL_HapticRamp * \sa SDL_HapticPeriodic
*/ */
#define SDL_HAPTIC_RAMP (1u << 6) #define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
/** /**
* \brief Spring effect supported - uses axes position. * \brief Ramp effect supported.
* *
* Condition haptic effect that simulates a spring. Effect is based on the * Ramp haptic effect.
* axes position. *
* * \sa SDL_HapticRamp
* \sa SDL_HapticCondition */
*/ #define SDL_HAPTIC_RAMP (1u<<6)
#define SDL_HAPTIC_SPRING (1u << 7)
/** /**
* \brief Damper effect supported - uses axes velocity. * \brief Spring effect supported - uses axes position.
* *
* Condition haptic effect that simulates dampening. Effect is based on the * Condition haptic effect that simulates a spring. Effect is based on the
* axes velocity. * axes position.
* *
* \sa SDL_HapticCondition * \sa SDL_HapticCondition
*/ */
#define SDL_HAPTIC_DAMPER (1u << 8) #define SDL_HAPTIC_SPRING (1u<<7)
/** /**
* \brief Inertia effect supported - uses axes acceleration. * \brief Damper effect supported - uses axes velocity.
* *
* Condition haptic effect that simulates inertia. Effect is based on the axes * Condition haptic effect that simulates dampening. Effect is based on the
* acceleration. * axes velocity.
* *
* \sa SDL_HapticCondition * \sa SDL_HapticCondition
*/ */
#define SDL_HAPTIC_INERTIA (1u << 9) #define SDL_HAPTIC_DAMPER (1u<<8)
/** /**
* \brief Friction effect supported - uses axes movement. * \brief Inertia effect supported - uses axes acceleration.
* *
* Condition haptic effect that simulates friction. Effect is based on the * Condition haptic effect that simulates inertia. Effect is based on the axes
* axes movement. * acceleration.
* *
* \sa SDL_HapticCondition * \sa SDL_HapticCondition
*/ */
#define SDL_HAPTIC_FRICTION (1u << 10) #define SDL_HAPTIC_INERTIA (1u<<9)
/** /**
* \brief Custom effect is supported. * \brief Friction effect supported - uses axes movement.
* *
* User defined custom haptic effect. * Condition haptic effect that simulates friction. Effect is based on the
*/ * axes movement.
#define SDL_HAPTIC_CUSTOM (1u << 11) *
* \sa SDL_HapticCondition
*/
#define SDL_HAPTIC_FRICTION (1u<<10)
/* @} */ /* Haptic effects */ /**
* \brief Custom effect is supported.
*
* User defined custom haptic effect.
*/
#define SDL_HAPTIC_CUSTOM (1u<<11)
/* These last few are features the device has, not effects */ /* @} *//* Haptic effects */
/** /* These last few are features the device has, not effects */
* \brief Device can set global gain.
*
* Device supports setting the global gain.
*
* \sa SDL_HapticSetGain
*/
#define SDL_HAPTIC_GAIN (1u << 12)
/** /**
* \brief Device can set autocenter. * \brief Device can set global gain.
* *
* Device supports setting autocenter. * Device supports setting the global gain.
* *
* \sa SDL_HapticSetAutocenter * \sa SDL_HapticSetGain
*/ */
#define SDL_HAPTIC_AUTOCENTER (1u << 13) #define SDL_HAPTIC_GAIN (1u<<12)
/** /**
* \brief Device can be queried for effect status. * \brief Device can set autocenter.
* *
* Device supports querying effect status. * Device supports setting autocenter.
* *
* \sa SDL_HapticGetEffectStatus * \sa SDL_HapticSetAutocenter
*/ */
#define SDL_HAPTIC_STATUS (1u << 14) #define SDL_HAPTIC_AUTOCENTER (1u<<13)
/** /**
* \brief Device can be paused. * \brief Device can be queried for effect status.
* *
* Devices supports being paused. * Device supports querying effect status.
* *
* \sa SDL_HapticPause * \sa SDL_HapticGetEffectStatus
* \sa SDL_HapticUnpause */
*/ #define SDL_HAPTIC_STATUS (1u<<14)
#define SDL_HAPTIC_PAUSE (1u << 15)
/** /**
* \name Direction encodings * \brief Device can be paused.
*/ *
/* @{ */ * Devices supports being paused.
*
* \sa SDL_HapticPause
* \sa SDL_HapticUnpause
*/
#define SDL_HAPTIC_PAUSE (1u<<15)
/**
* \brief Uses polar coordinates for the direction.
*
* \sa SDL_HapticDirection
*/
#define SDL_HAPTIC_POLAR 0
/** /**
* \brief Uses cartesian coordinates for the direction. * \name Direction encodings
* */
* \sa SDL_HapticDirection /* @{ */
*/
#define SDL_HAPTIC_CARTESIAN 1
/** /**
* \brief Uses spherical coordinates for the direction. * \brief Uses polar coordinates for the direction.
* *
* \sa SDL_HapticDirection * \sa SDL_HapticDirection
*/ */
#define SDL_HAPTIC_SPHERICAL 2 #define SDL_HAPTIC_POLAR 0
/** /**
* \brief Use this value to play an effect on the steering wheel axis. This * \brief Uses cartesian coordinates for the direction.
* provides better compatibility across platforms and devices as SDL will guess *
* the correct axis. * \sa SDL_HapticDirection
* \sa SDL_HapticDirection */
*/ #define SDL_HAPTIC_CARTESIAN 1
#define SDL_HAPTIC_STEERING_AXIS 3
/* @} */ /* Direction encodings */ /**
* \brief Uses spherical coordinates for the direction.
*
* \sa SDL_HapticDirection
*/
#define SDL_HAPTIC_SPHERICAL 2
/* @} */ /* Haptic features */ /**
* \brief Use this value to play an effect on the steering wheel axis. This
* provides better compatibility across platforms and devices as SDL will guess
* the correct axis.
* \sa SDL_HapticDirection
*/
#define SDL_HAPTIC_STEERING_AXIS 3
/* /* @} *//* Direction encodings */
* Misc defines.
*/ /* @} *//* Haptic features */
/*
* Misc defines.
*/
/**
* \brief Used to play a device an infinite number of times.
*
* \sa SDL_HapticRunEffect
*/
#define SDL_HAPTIC_INFINITY 4294967295U
/**
* \brief Used to play a device an infinite number of times.
*
* \sa SDL_HapticRunEffect
*/
#define SDL_HAPTIC_INFINITY 4294967295U
/** /**
* \brief Structure that represents a haptic direction. * \brief Structure that represents a haptic direction.
@ -453,11 +456,13 @@ typedef struct _SDL_Haptic SDL_Haptic;
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
* \sa SDL_HapticNumAxes * \sa SDL_HapticNumAxes
*/ */
typedef struct SDL_HapticDirection { typedef struct SDL_HapticDirection
Uint8 type; /**< The type of encoding. */ {
Sint32 dir[3]; /**< The encoded direction. */ Uint8 type; /**< The type of encoding. */
Sint32 dir[3]; /**< The encoded direction. */
} SDL_HapticDirection; } SDL_HapticDirection;
/** /**
* \brief A structure containing a template for a Constant effect. * \brief A structure containing a template for a Constant effect.
* *
@ -469,27 +474,28 @@ typedef struct SDL_HapticDirection {
* \sa SDL_HAPTIC_CONSTANT * \sa SDL_HAPTIC_CONSTANT
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
*/ */
typedef struct SDL_HapticConstant { typedef struct SDL_HapticConstant
/* Header */ {
Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */ /* Header */
SDL_HapticDirection direction; /**< Direction of the effect. */ Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect. */ Uint32 length; /**< Duration of the effect. */
Uint16 delay; /**< Delay before starting the effect. */ Uint16 delay; /**< Delay before starting the effect. */
/* Trigger */ /* Trigger */
Uint16 button; /**< Button that triggers the effect. */ Uint16 button; /**< Button that triggers the effect. */
Uint16 interval; /**< How soon it can be triggered again after button. */ Uint16 interval; /**< How soon it can be triggered again after button. */
/* Constant */ /* Constant */
Sint16 level; /**< Strength of the constant effect. */ Sint16 level; /**< Strength of the constant effect. */
/* Envelope */ /* Envelope */
Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_length; /**< Duration of the attack. */
Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */
Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_length; /**< Duration of the fade. */
Uint16 fade_level; /**< Level at the end of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */
} SDL_HapticConstant; } SDL_HapticConstant;
/** /**
@ -549,32 +555,33 @@ typedef struct SDL_HapticConstant {
* \sa SDL_HAPTIC_SAWTOOTHDOWN * \sa SDL_HAPTIC_SAWTOOTHDOWN
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
*/ */
typedef struct SDL_HapticPeriodic { typedef struct SDL_HapticPeriodic
/* Header */ {
Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT, /* Header */
::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
::SDL_HAPTIC_SAWTOOTHDOWN */ ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
SDL_HapticDirection direction; /**< Direction of the effect. */ ::SDL_HAPTIC_SAWTOOTHDOWN */
SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect. */ Uint32 length; /**< Duration of the effect. */
Uint16 delay; /**< Delay before starting the effect. */ Uint16 delay; /**< Delay before starting the effect. */
/* Trigger */ /* Trigger */
Uint16 button; /**< Button that triggers the effect. */ Uint16 button; /**< Button that triggers the effect. */
Uint16 interval; /**< How soon it can be triggered again after button. */ Uint16 interval; /**< How soon it can be triggered again after button. */
/* Periodic */ /* Periodic */
Uint16 period; /**< Period of the wave. */ Uint16 period; /**< Period of the wave. */
Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */ Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
Sint16 offset; /**< Mean value of the wave. */ Sint16 offset; /**< Mean value of the wave. */
Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */ Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */
/* Envelope */ /* Envelope */
Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_length; /**< Duration of the attack. */
Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */
Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_length; /**< Duration of the fade. */
Uint16 fade_level; /**< Level at the end of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */
} SDL_HapticPeriodic; } SDL_HapticPeriodic;
/** /**
@ -601,27 +608,28 @@ typedef struct SDL_HapticPeriodic {
* \sa SDL_HAPTIC_FRICTION * \sa SDL_HAPTIC_FRICTION
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
*/ */
typedef struct SDL_HapticCondition { typedef struct SDL_HapticCondition
/* Header */ {
Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER, /* Header */
::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */ Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect. */ Uint32 length; /**< Duration of the effect. */
Uint16 delay; /**< Delay before starting the effect. */ Uint16 delay; /**< Delay before starting the effect. */
/* Trigger */ /* Trigger */
Uint16 button; /**< Button that triggers the effect. */ Uint16 button; /**< Button that triggers the effect. */
Uint16 interval; /**< How soon it can be triggered again after button. */ Uint16 interval; /**< How soon it can be triggered again after button. */
/* Condition */ /* Condition */
Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */ Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */
Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */ Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */
Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */
Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */
Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */ Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
Sint16 center[3]; /**< Position of the dead zone. */ Sint16 center[3]; /**< Position of the dead zone. */
} SDL_HapticCondition; } SDL_HapticCondition;
/** /**
@ -637,28 +645,29 @@ typedef struct SDL_HapticCondition {
* \sa SDL_HAPTIC_RAMP * \sa SDL_HAPTIC_RAMP
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
*/ */
typedef struct SDL_HapticRamp { typedef struct SDL_HapticRamp
/* Header */ {
Uint16 type; /**< ::SDL_HAPTIC_RAMP */ /* Header */
SDL_HapticDirection direction; /**< Direction of the effect. */ Uint16 type; /**< ::SDL_HAPTIC_RAMP */
SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect. */ Uint32 length; /**< Duration of the effect. */
Uint16 delay; /**< Delay before starting the effect. */ Uint16 delay; /**< Delay before starting the effect. */
/* Trigger */ /* Trigger */
Uint16 button; /**< Button that triggers the effect. */ Uint16 button; /**< Button that triggers the effect. */
Uint16 interval; /**< How soon it can be triggered again after button. */ Uint16 interval; /**< How soon it can be triggered again after button. */
/* Ramp */ /* Ramp */
Sint16 start; /**< Beginning strength level. */ Sint16 start; /**< Beginning strength level. */
Sint16 end; /**< Ending strength level. */ Sint16 end; /**< Ending strength level. */
/* Envelope */ /* Envelope */
Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_length; /**< Duration of the attack. */
Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */
Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_length; /**< Duration of the fade. */
Uint16 fade_level; /**< Level at the end of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */
} SDL_HapticRamp; } SDL_HapticRamp;
/** /**
@ -673,16 +682,17 @@ typedef struct SDL_HapticRamp {
* \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HAPTIC_LEFTRIGHT
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
*/ */
typedef struct SDL_HapticLeftRight { typedef struct SDL_HapticLeftRight
/* Header */ {
Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Header */
Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect in milliseconds. */ Uint32 length; /**< Duration of the effect in milliseconds. */
/* Rumble */ /* Rumble */
Uint16 large_magnitude; /**< Control of the large controller motor. */ Uint16 large_magnitude; /**< Control of the large controller motor. */
Uint16 small_magnitude; /**< Control of the small controller motor. */ Uint16 small_magnitude; /**< Control of the small controller motor. */
} SDL_HapticLeftRight; } SDL_HapticLeftRight;
/** /**
@ -700,30 +710,31 @@ typedef struct SDL_HapticLeftRight {
* \sa SDL_HAPTIC_CUSTOM * \sa SDL_HAPTIC_CUSTOM
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
*/ */
typedef struct SDL_HapticCustom { typedef struct SDL_HapticCustom
/* Header */ {
Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */ /* Header */
SDL_HapticDirection direction; /**< Direction of the effect. */ Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect. */ Uint32 length; /**< Duration of the effect. */
Uint16 delay; /**< Delay before starting the effect. */ Uint16 delay; /**< Delay before starting the effect. */
/* Trigger */ /* Trigger */
Uint16 button; /**< Button that triggers the effect. */ Uint16 button; /**< Button that triggers the effect. */
Uint16 interval; /**< How soon it can be triggered again after button. */ Uint16 interval; /**< How soon it can be triggered again after button. */
/* Custom */ /* Custom */
Uint8 channels; /**< Axes to use, minimum of one. */ Uint8 channels; /**< Axes to use, minimum of one. */
Uint16 period; /**< Sample periods. */ Uint16 period; /**< Sample periods. */
Uint16 samples; /**< Amount of samples. */ Uint16 samples; /**< Amount of samples. */
Uint16 *data; /**< Should contain channels*samples items. */ Uint16 *data; /**< Should contain channels*samples items. */
/* Envelope */ /* Envelope */
Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_length; /**< Duration of the attack. */
Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */
Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_length; /**< Duration of the fade. */
Uint16 fade_level; /**< Level at the end of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */
} SDL_HapticCustom; } SDL_HapticCustom;
/** /**
@ -795,17 +806,19 @@ typedef struct SDL_HapticCustom {
* \sa SDL_HapticLeftRight * \sa SDL_HapticLeftRight
* \sa SDL_HapticCustom * \sa SDL_HapticCustom
*/ */
typedef union SDL_HapticEffect { typedef union SDL_HapticEffect
/* Common for all force feedback effects */ {
Uint16 type; /**< Effect type. */ /* Common for all force feedback effects */
SDL_HapticConstant constant; /**< Constant effect. */ Uint16 type; /**< Effect type. */
SDL_HapticPeriodic periodic; /**< Periodic effect. */ SDL_HapticConstant constant; /**< Constant effect. */
SDL_HapticCondition condition; /**< Condition effect. */ SDL_HapticPeriodic periodic; /**< Periodic effect. */
SDL_HapticRamp ramp; /**< Ramp effect. */ SDL_HapticCondition condition; /**< Condition effect. */
SDL_HapticLeftRight leftright; /**< Left/Right effect. */ SDL_HapticRamp ramp; /**< Ramp effect. */
SDL_HapticCustom custom; /**< Custom effect. */ SDL_HapticLeftRight leftright; /**< Left/Right effect. */
SDL_HapticCustom custom; /**< Custom effect. */
} SDL_HapticEffect; } SDL_HapticEffect;
/* Function prototypes */ /* Function prototypes */
/** /**
@ -889,7 +902,7 @@ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
* \sa SDL_HapticOpen * \sa SDL_HapticOpen
* \sa SDL_HapticOpened * \sa SDL_HapticOpened
*/ */
extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
/** /**
* Query whether or not the current mouse has haptic capabilities. * Query whether or not the current mouse has haptic capabilities.
@ -927,7 +940,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
* *
* \sa SDL_HapticOpenFromJoystick * \sa SDL_HapticOpenFromJoystick
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick *joystick); extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
/** /**
* Open a haptic device for use from a joystick device. * Open a haptic device for use from a joystick device.
@ -950,7 +963,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick *joystick);
* \sa SDL_HapticOpen * \sa SDL_HapticOpen
* \sa SDL_JoystickIsHaptic * \sa SDL_JoystickIsHaptic
*/ */
extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *joystick); extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
joystick);
/** /**
* Close a haptic device previously opened with SDL_HapticOpen(). * Close a haptic device previously opened with SDL_HapticOpen().
@ -961,7 +975,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *joy
* *
* \sa SDL_HapticOpen * \sa SDL_HapticOpen
*/ */
extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic *haptic); extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
/** /**
* Get the number of effects a haptic device can store. * Get the number of effects a haptic device can store.
@ -979,7 +993,7 @@ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic *haptic);
* \sa SDL_HapticNumEffectsPlaying * \sa SDL_HapticNumEffectsPlaying
* \sa SDL_HapticQuery * \sa SDL_HapticQuery
*/ */
extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
/** /**
* Get the number of effects a haptic device can play at the same time. * Get the number of effects a haptic device can play at the same time.
@ -996,7 +1010,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic *haptic);
* \sa SDL_HapticNumEffects * \sa SDL_HapticNumEffects
* \sa SDL_HapticQuery * \sa SDL_HapticQuery
*/ */
extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
/** /**
* Get the haptic device's supported features in bitwise manner. * Get the haptic device's supported features in bitwise manner.
@ -1010,7 +1024,8 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic *haptic);
* \sa SDL_HapticEffectSupported * \sa SDL_HapticEffectSupported
* \sa SDL_HapticNumEffects * \sa SDL_HapticNumEffects
*/ */
extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic *haptic); extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
/** /**
* Get the number of haptic axes the device has. * Get the number of haptic axes the device has.
@ -1024,7 +1039,7 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic *haptic);
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
/** /**
* Check to see if an effect is supported by a haptic device. * Check to see if an effect is supported by a haptic device.
@ -1040,7 +1055,9 @@ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic *haptic);
* \sa SDL_HapticNewEffect * \sa SDL_HapticNewEffect
* \sa SDL_HapticQuery * \sa SDL_HapticQuery
*/ */
extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic *haptic, SDL_HapticEffect *effect); extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
SDL_HapticEffect *
effect);
/** /**
* Create a new haptic effect on a specified device. * Create a new haptic effect on a specified device.
@ -1057,7 +1074,8 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic *haptic, SDL_Ha
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
* \sa SDL_HapticUpdateEffect * \sa SDL_HapticUpdateEffect
*/ */
extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic *haptic, SDL_HapticEffect *effect); extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
SDL_HapticEffect * effect);
/** /**
* Update the properties of an effect. * Update the properties of an effect.
@ -1080,7 +1098,9 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic *haptic, SDL_HapticEf
* \sa SDL_HapticNewEffect * \sa SDL_HapticNewEffect
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
*/ */
extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic *haptic, int effect, SDL_HapticEffect *data); extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
int effect,
SDL_HapticEffect * data);
/** /**
* Run the haptic effect on its associated haptic device. * Run the haptic effect on its associated haptic device.
@ -1104,7 +1124,9 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic *haptic, int effec
* \sa SDL_HapticGetEffectStatus * \sa SDL_HapticGetEffectStatus
* \sa SDL_HapticStopEffect * \sa SDL_HapticStopEffect
*/ */
extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic *haptic, int effect, Uint32 iterations); extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
int effect,
Uint32 iterations);
/** /**
* Stop the haptic effect on its associated haptic device. * Stop the haptic effect on its associated haptic device.
@ -1121,7 +1143,8 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic *haptic, int effect,
* \sa SDL_HapticDestroyEffect * \sa SDL_HapticDestroyEffect
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
*/ */
extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic *haptic, int effect); extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
int effect);
/** /**
* Destroy a haptic effect on the device. * Destroy a haptic effect on the device.
@ -1136,7 +1159,8 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic *haptic, int effect)
* *
* \sa SDL_HapticNewEffect * \sa SDL_HapticNewEffect
*/ */
extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic *haptic, int effect); extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
int effect);
/** /**
* Get the status of the current effect on the specified haptic device. * Get the status of the current effect on the specified haptic device.
@ -1153,7 +1177,8 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic *haptic, int eff
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
* \sa SDL_HapticStopEffect * \sa SDL_HapticStopEffect
*/ */
extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect); extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
int effect);
/** /**
* Set the global gain of the specified haptic device. * Set the global gain of the specified haptic device.
@ -1174,7 +1199,7 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int ef
* *
* \sa SDL_HapticQuery * \sa SDL_HapticQuery
*/ */
extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic *haptic, int gain); extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
/** /**
* Set the global autocenter of the device. * Set the global autocenter of the device.
@ -1193,7 +1218,8 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic *haptic, int gain);
* *
* \sa SDL_HapticQuery * \sa SDL_HapticQuery
*/ */
extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic *haptic, int autocenter); extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
int autocenter);
/** /**
* Pause a haptic device. * Pause a haptic device.
@ -1212,7 +1238,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic *haptic, int auto
* *
* \sa SDL_HapticUnpause * \sa SDL_HapticUnpause
*/ */
extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
/** /**
* Unpause a haptic device. * Unpause a haptic device.
@ -1227,7 +1253,7 @@ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic *haptic);
* *
* \sa SDL_HapticPause * \sa SDL_HapticPause
*/ */
extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
/** /**
* Stop all the currently playing effects on a haptic device. * Stop all the currently playing effects on a haptic device.
@ -1238,7 +1264,7 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic *haptic);
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
/** /**
* Check whether rumble is supported on a haptic device. * Check whether rumble is supported on a haptic device.
@ -1254,7 +1280,7 @@ extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic *haptic);
* \sa SDL_HapticRumblePlay * \sa SDL_HapticRumblePlay
* \sa SDL_HapticRumbleStop * \sa SDL_HapticRumbleStop
*/ */
extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
/** /**
* Initialize a haptic device for simple rumble playback. * Initialize a haptic device for simple rumble playback.
@ -1270,7 +1296,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *haptic);
* \sa SDL_HapticRumbleStop * \sa SDL_HapticRumbleStop
* \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumbleSupported
*/ */
extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
/** /**
* Run a simple rumble effect on a haptic device. * Run a simple rumble effect on a haptic device.
@ -1287,7 +1313,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic *haptic);
* \sa SDL_HapticRumbleStop * \sa SDL_HapticRumbleStop
* \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumbleSupported
*/ */
extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic *haptic, float strength, Uint32 length); extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
/** /**
* Stop the simple rumble on a haptic device. * Stop the simple rumble on a haptic device.
@ -1302,13 +1328,13 @@ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic *haptic, float stren
* \sa SDL_HapticRumblePlay * \sa SDL_HapticRumblePlay
* \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumbleSupported
*/ */
extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic *haptic); extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_haptic_h_ */ #endif /* SDL_haptic_h_ */

View File

@ -60,15 +60,15 @@
*/ */
#ifndef SDL_hidapi_h_ #ifndef SDL_hidapi_h_
#define SDL_hidapi_h_ #define SDL_hidapi_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \brief A handle representing an open HID device * \brief A handle representing an open HID device
@ -80,46 +80,48 @@ typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
/** /**
* \brief Information about a connected HID device * \brief Information about a connected HID device
*/ */
typedef struct SDL_hid_device_info { typedef struct SDL_hid_device_info
/** Platform-specific device path */ {
char *path; /** Platform-specific device path */
/** Device Vendor ID */ char *path;
unsigned short vendor_id; /** Device Vendor ID */
/** Device Product ID */ unsigned short vendor_id;
unsigned short product_id; /** Device Product ID */
/** Serial Number */ unsigned short product_id;
wchar_t *serial_number; /** Serial Number */
/** Device Release Number in binary-coded decimal, wchar_t *serial_number;
also known as Device Version Number */ /** Device Release Number in binary-coded decimal,
unsigned short release_number; also known as Device Version Number */
/** Manufacturer String */ unsigned short release_number;
wchar_t *manufacturer_string; /** Manufacturer String */
/** Product string */ wchar_t *manufacturer_string;
wchar_t *product_string; /** Product string */
/** Usage Page for this Device/Interface wchar_t *product_string;
(Windows/Mac only). */ /** Usage Page for this Device/Interface
unsigned short usage_page; (Windows/Mac only). */
/** Usage for this Device/Interface unsigned short usage_page;
(Windows/Mac only).*/ /** Usage for this Device/Interface
unsigned short usage; (Windows/Mac only).*/
/** The USB interface which this logical device unsigned short usage;
represents. /** The USB interface which this logical device
represents.
* Valid on both Linux implementations in all cases. * Valid on both Linux implementations in all cases.
* Valid on the Windows implementation only if the device * Valid on the Windows implementation only if the device
contains more than one interface. */ contains more than one interface. */
int interface_number; int interface_number;
/** Additional information about the USB interface. /** Additional information about the USB interface.
Valid on libusb and Android implementations. */ Valid on libusb and Android implementations. */
int interface_class; int interface_class;
int interface_subclass; int interface_subclass;
int interface_protocol; int interface_protocol;
/** Pointer to the next device */ /** Pointer to the next device */
struct SDL_hid_device_info *next; struct SDL_hid_device_info *next;
} SDL_hid_device_info; } SDL_hid_device_info;
/** /**
* Initialize the HIDAPI library. * Initialize the HIDAPI library.
* *
@ -194,7 +196,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
* *
* \sa SDL_hid_device_change_count * \sa SDL_hid_device_change_count
*/ */
extern DECLSPEC SDL_hid_device_info *SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id); extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
/** /**
* Free an enumeration Linked List * Free an enumeration Linked List
@ -224,8 +226,7 @@ extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs)
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
extern DECLSPEC SDL_hid_device *SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
const wchar_t *serial_number);
/** /**
* Open a HID device by its path name. * Open a HID device by its path name.
@ -239,7 +240,7 @@ extern DECLSPEC SDL_hid_device *SDLCALL SDL_hid_open(unsigned short vendor_id, u
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
extern DECLSPEC SDL_hid_device *SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */); extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
/** /**
* Write an Output report to a HID device. * Write an Output report to a HID device.
@ -286,8 +287,7 @@ extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned ch
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
int milliseconds);
/** /**
* Read an Input report from a HID device. * Read an Input report from a HID device.
@ -429,8 +429,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
size_t maxlen);
/** /**
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers
@ -441,11 +440,11 @@ extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int
*/ */
extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active); extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_hidapi_h_ */ #endif /* SDL_hidapi_h_ */

2892
third_party/SDL2/include/SDL_hints.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,53 +24,52 @@
* *
* Include file for SDL joystick event handling * Include file for SDL joystick event handling
* *
* The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
* exact joystick behind a device_index changing as joysticks are plugged and unplugged. * behind a device_index changing as joysticks are plugged and unplugged.
* *
* The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
* and then re-inserted then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
* joystick plugged in.
* *
* The term "player_index" is the number assigned to a player on a specific * The term "player_index" is the number assigned to a player on a specific
* controller. For XInput controllers this returns the XInput user index. * controller. For XInput controllers this returns the XInput user index.
* Many joysticks will not be able to supply this information. * Many joysticks will not be able to supply this information.
* *
* The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
* identifies class of the device (a X360 wired controller for example). This identifier is platform dependent. * the device (a X360 wired controller for example). This identifier is platform dependent.
*/ */
#ifndef SDL_joystick_h_ #ifndef SDL_joystick_h_
#define SDL_joystick_h_ #define SDL_joystick_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_guid.h" #include "SDL_error.h"
#include "SDL_mutex.h" #include "SDL_guid.h"
#include "SDL_stdinc.h" #include "SDL_mutex.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \file SDL_joystick.h * \file SDL_joystick.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
* for joysticks, and load appropriate drivers. * for joysticks, and load appropriate drivers.
* *
* If you would like to receive joystick updates while the application * If you would like to receive joystick updates while the application
* is in the background, you should set the following hint before calling * is in the background, you should set the following hint before calling
* SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
*/ */
/** /**
* The joystick structure used to identify an SDL joystick * The joystick structure used to identify an SDL joystick
*/ */
#ifdef SDL_THREAD_SAFETY_ANALYSIS #ifdef SDL_THREAD_SAFETY_ANALYSIS
extern SDL_mutex *SDL_joystick_lock; extern SDL_mutex *SDL_joystick_lock;
#endif #endif
struct _SDL_Joystick; struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick;
@ -86,33 +85,36 @@ typedef SDL_GUID SDL_JoystickGUID;
*/ */
typedef Sint32 SDL_JoystickID; typedef Sint32 SDL_JoystickID;
typedef enum { typedef enum
SDL_JOYSTICK_TYPE_UNKNOWN, {
SDL_JOYSTICK_TYPE_GAMECONTROLLER, SDL_JOYSTICK_TYPE_UNKNOWN,
SDL_JOYSTICK_TYPE_WHEEL, SDL_JOYSTICK_TYPE_GAMECONTROLLER,
SDL_JOYSTICK_TYPE_ARCADE_STICK, SDL_JOYSTICK_TYPE_WHEEL,
SDL_JOYSTICK_TYPE_FLIGHT_STICK, SDL_JOYSTICK_TYPE_ARCADE_STICK,
SDL_JOYSTICK_TYPE_DANCE_PAD, SDL_JOYSTICK_TYPE_FLIGHT_STICK,
SDL_JOYSTICK_TYPE_GUITAR, SDL_JOYSTICK_TYPE_DANCE_PAD,
SDL_JOYSTICK_TYPE_DRUM_KIT, SDL_JOYSTICK_TYPE_GUITAR,
SDL_JOYSTICK_TYPE_ARCADE_PAD, SDL_JOYSTICK_TYPE_DRUM_KIT,
SDL_JOYSTICK_TYPE_THROTTLE SDL_JOYSTICK_TYPE_ARCADE_PAD,
SDL_JOYSTICK_TYPE_THROTTLE
} SDL_JoystickType; } SDL_JoystickType;
typedef enum { typedef enum
SDL_JOYSTICK_POWER_UNKNOWN = -1, {
SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ SDL_JOYSTICK_POWER_UNKNOWN = -1,
SDL_JOYSTICK_POWER_LOW, /* <= 20% */ SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */
SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ SDL_JOYSTICK_POWER_LOW, /* <= 20% */
SDL_JOYSTICK_POWER_FULL, /* <= 100% */ SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */
SDL_JOYSTICK_POWER_WIRED, SDL_JOYSTICK_POWER_FULL, /* <= 100% */
SDL_JOYSTICK_POWER_MAX SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
} SDL_JoystickPowerLevel; } SDL_JoystickPowerLevel;
/* Set max recognized G-force from accelerometer /* Set max recognized G-force from accelerometer
See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
*/ */
#define SDL_IPHONE_MAX_GFORCE 5.0 #define SDL_IPHONE_MAX_GFORCE 5.0
/* Function prototypes */ /* Function prototypes */
@ -135,6 +137,7 @@ typedef enum {
*/ */
extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock); extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock);
/** /**
* Unlocking for multi-threaded access to the joystick API * Unlocking for multi-threaded access to the joystick API
* *
@ -347,47 +350,49 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_ind
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, int nhats); extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
int naxes,
int nbuttons,
int nhats);
/** /**
* The structure that defines an extended virtual joystick description * The structure that defines an extended virtual joystick description
* *
* The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx()
* passing it to SDL_JoystickAttachVirtualEx() All other elements of this structure are optional and can be left 0. * All other elements of this structure are optional and can be left 0.
* *
* \sa SDL_JoystickAttachVirtualEx * \sa SDL_JoystickAttachVirtualEx
*/ */
typedef struct SDL_VirtualJoystickDesc { typedef struct SDL_VirtualJoystickDesc
Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */ {
Uint16 type; /**< `SDL_JoystickType` */ Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */
Uint16 naxes; /**< the number of axes on this joystick */ Uint16 type; /**< `SDL_JoystickType` */
Uint16 nbuttons; /**< the number of buttons on this joystick */ Uint16 naxes; /**< the number of axes on this joystick */
Uint16 nhats; /**< the number of hats on this joystick */ Uint16 nbuttons; /**< the number of buttons on this joystick */
Uint16 vendor_id; /**< the USB vendor ID of this joystick */ Uint16 nhats; /**< the number of hats on this joystick */
Uint16 product_id; /**< the USB product ID of this joystick */ Uint16 vendor_id; /**< the USB vendor ID of this joystick */
Uint16 padding; /**< unused */ Uint16 product_id; /**< the USB product ID of this joystick */
Uint32 button_mask; /**< A mask of which buttons are valid for this controller Uint16 padding; /**< unused */
e.g. (1 << SDL_CONTROLLER_BUTTON_A) */ Uint32 button_mask; /**< A mask of which buttons are valid for this controller
Uint32 axis_mask; /**< A mask of which axes are valid for this controller e.g. (1 << SDL_CONTROLLER_BUTTON_A) */
e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */ Uint32 axis_mask; /**< A mask of which axes are valid for this controller
const char *name; /**< the name of the joystick */ e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */
const char *name; /**< the name of the joystick */
void *userdata; /**< User data pointer passed to callbacks */ void *userdata; /**< User data pointer passed to callbacks */
void(SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */ void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */
void(SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */ void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */
int(SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */
Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */ int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */
int(SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */
Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */ int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */
int(SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */
int(SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */
} SDL_VirtualJoystickDesc; } SDL_VirtualJoystickDesc;
/** /**
* \brief The current version of the SDL_VirtualJoystickDesc structure * \brief The current version of the SDL_VirtualJoystickDesc structure
*/ */
#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1 #define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1
/** /**
* Attach a new virtual joystick with extended properties. * Attach a new virtual joystick with extended properties.
@ -605,7 +610,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joys
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC const char *SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick); extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick);
/** /**
* Get the type of an opened joystick. * Get the type of an opened joystick.
@ -667,8 +672,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
* *
* \sa SDL_JoystickGetDeviceGUID * \sa SDL_JoystickGetDeviceGUID
*/ */
extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16);
Uint16 *version, Uint16 *crc16);
/** /**
* Get the status of a specified joystick. * Get the status of a specified joystick.
@ -804,8 +808,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
#define SDL_JOYSTICK_AXIS_MAX 32767 #define SDL_JOYSTICK_AXIS_MAX 32767
#define SDL_JOYSTICK_AXIS_MIN -32768 #define SDL_JOYSTICK_AXIS_MIN -32768
/** /**
* Get the current state of an axis control on a joystick. * Get the current state of an axis control on a joystick.
@ -829,7 +833,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
* *
* \sa SDL_JoystickNumAxes * \sa SDL_JoystickNumAxes
*/ */
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
int axis);
/** /**
* Get the initial state of an axis control on a joystick. * Get the initial state of an axis control on a joystick.
@ -845,21 +850,22 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int a
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state); extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick,
int axis, Sint16 *state);
/** /**
* \name Hat positions * \name Hat positions
*/ */
/* @{ */ /* @{ */
#define SDL_HAT_CENTERED 0x00 #define SDL_HAT_CENTERED 0x00
#define SDL_HAT_UP 0x01 #define SDL_HAT_UP 0x01
#define SDL_HAT_RIGHT 0x02 #define SDL_HAT_RIGHT 0x02
#define SDL_HAT_DOWN 0x04 #define SDL_HAT_DOWN 0x04
#define SDL_HAT_LEFT 0x08 #define SDL_HAT_LEFT 0x08
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT | SDL_HAT_UP) #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT | SDL_HAT_DOWN) #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT | SDL_HAT_UP) #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT | SDL_HAT_DOWN) #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
/* @} */ /* @} */
/** /**
@ -885,7 +891,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *j
* *
* \sa SDL_JoystickNumHats * \sa SDL_JoystickNumHats
*/ */
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
int hat);
/** /**
* Get the ball axis change since the last poll. * Get the ball axis change since the last poll.
@ -906,7 +913,8 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat
* *
* \sa SDL_JoystickNumBalls * \sa SDL_JoystickNumBalls
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
int ball, int *dx, int *dy);
/** /**
* Get the current state of a button on a joystick. * Get the current state of a button on a joystick.
@ -920,7 +928,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball
* *
* \sa SDL_JoystickNumButtons * \sa SDL_JoystickNumButtons
*/ */
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
int button);
/** /**
* Start a rumble effect. * Start a rumble effect.
@ -940,8 +949,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int
* *
* \sa SDL_JoystickHasRumble * \sa SDL_JoystickHasRumble
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
Uint16 high_frequency_rumble, Uint32 duration_ms);
/** /**
* Start a rumble effect in the joystick's triggers * Start a rumble effect in the joystick's triggers
@ -966,8 +974,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo
* *
* \sa SDL_JoystickHasRumbleTriggers * \sa SDL_JoystickHasRumbleTriggers
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
Uint32 duration_ms);
/** /**
* Query whether a joystick has an LED. * Query whether a joystick has an LED.
@ -1056,11 +1063,11 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
*/ */
extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick); extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_joystick_h_ */ #endif /* SDL_joystick_h_ */

View File

@ -26,29 +26,30 @@
*/ */
#ifndef SDL_keyboard_h_ #ifndef SDL_keyboard_h_
#define SDL_keyboard_h_ #define SDL_keyboard_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_keycode.h" #include "SDL_error.h"
#include "SDL_stdinc.h" #include "SDL_keycode.h"
#include "SDL_video.h" #include "SDL_video.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* \brief The SDL keysym structure, used in key events. * \brief The SDL keysym structure, used in key events.
* *
* \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event. * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
*/ */
typedef struct SDL_Keysym { typedef struct SDL_Keysym
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ {
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
Uint16 mod; /**< current key modifiers */ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Uint32 unused; Uint16 mod; /**< current key modifiers */
Uint32 unused;
} SDL_Keysym; } SDL_Keysym;
/* Function prototypes */ /* Function prototypes */
@ -60,7 +61,7 @@ typedef struct SDL_Keysym {
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC SDL_Window *SDLCALL SDL_GetKeyboardFocus(void); extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
/** /**
* Get a snapshot of the current state of the keyboard. * Get a snapshot of the current state of the keyboard.
@ -343,11 +344,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
*/ */
extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_keyboard_h_ */ #endif /* SDL_keyboard_h_ */

358
third_party/SDL2/include/SDL_keycode.h vendored Normal file
View File

@ -0,0 +1,358 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2024 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_keycode.h
*
* Defines constants which identify keyboard keys and modifiers.
*/
#ifndef SDL_keycode_h_
#define SDL_keycode_h_
#include "SDL_stdinc.h"
#include "SDL_scancode.h"
/**
* \brief The SDL virtual key representation.
*
* Values of this type are used to represent keyboard keys using the current
* layout of the keyboard. These values include Unicode values representing
* the unmodified character that would be generated by pressing the key, or
* an SDLK_* constant for those keys that do not generate characters.
*
* A special exception is the number keys at the top of the keyboard which
* map to SDLK_0...SDLK_9 on AZERTY layouts.
*/
typedef Sint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
typedef enum
{
SDLK_UNKNOWN = 0,
SDLK_RETURN = '\r',
SDLK_ESCAPE = '\x1B',
SDLK_BACKSPACE = '\b',
SDLK_TAB = '\t',
SDLK_SPACE = ' ',
SDLK_EXCLAIM = '!',
SDLK_QUOTEDBL = '"',
SDLK_HASH = '#',
SDLK_PERCENT = '%',
SDLK_DOLLAR = '$',
SDLK_AMPERSAND = '&',
SDLK_QUOTE = '\'',
SDLK_LEFTPAREN = '(',
SDLK_RIGHTPAREN = ')',
SDLK_ASTERISK = '*',
SDLK_PLUS = '+',
SDLK_COMMA = ',',
SDLK_MINUS = '-',
SDLK_PERIOD = '.',
SDLK_SLASH = '/',
SDLK_0 = '0',
SDLK_1 = '1',
SDLK_2 = '2',
SDLK_3 = '3',
SDLK_4 = '4',
SDLK_5 = '5',
SDLK_6 = '6',
SDLK_7 = '7',
SDLK_8 = '8',
SDLK_9 = '9',
SDLK_COLON = ':',
SDLK_SEMICOLON = ';',
SDLK_LESS = '<',
SDLK_EQUALS = '=',
SDLK_GREATER = '>',
SDLK_QUESTION = '?',
SDLK_AT = '@',
/*
Skip uppercase letters
*/
SDLK_LEFTBRACKET = '[',
SDLK_BACKSLASH = '\\',
SDLK_RIGHTBRACKET = ']',
SDLK_CARET = '^',
SDLK_UNDERSCORE = '_',
SDLK_BACKQUOTE = '`',
SDLK_a = 'a',
SDLK_b = 'b',
SDLK_c = 'c',
SDLK_d = 'd',
SDLK_e = 'e',
SDLK_f = 'f',
SDLK_g = 'g',
SDLK_h = 'h',
SDLK_i = 'i',
SDLK_j = 'j',
SDLK_k = 'k',
SDLK_l = 'l',
SDLK_m = 'm',
SDLK_n = 'n',
SDLK_o = 'o',
SDLK_p = 'p',
SDLK_q = 'q',
SDLK_r = 'r',
SDLK_s = 's',
SDLK_t = 't',
SDLK_u = 'u',
SDLK_v = 'v',
SDLK_w = 'w',
SDLK_x = 'x',
SDLK_y = 'y',
SDLK_z = 'z',
SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK),
SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1),
SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2),
SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3),
SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4),
SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5),
SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6),
SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7),
SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8),
SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9),
SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10),
SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11),
SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12),
SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN),
SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK),
SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE),
SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT),
SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME),
SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP),
SDLK_DELETE = '\x7F',
SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END),
SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN),
SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT),
SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT),
SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN),
SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP),
SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR),
SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE),
SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY),
SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS),
SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS),
SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER),
SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1),
SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2),
SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3),
SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4),
SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5),
SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6),
SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7),
SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8),
SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9),
SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0),
SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD),
SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION),
SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER),
SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS),
SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13),
SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14),
SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15),
SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16),
SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17),
SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18),
SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19),
SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20),
SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21),
SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22),
SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23),
SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24),
SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE),
SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP),
SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU),
SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT),
SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP),
SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN),
SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO),
SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT),
SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY),
SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE),
SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND),
SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE),
SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP),
SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN),
SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA),
SDLK_KP_EQUALSAS400 =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400),
SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE),
SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ),
SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL),
SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR),
SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR),
SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2),
SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR),
SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT),
SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER),
SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN),
SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL),
SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL),
SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00),
SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000),
SDLK_THOUSANDSSEPARATOR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR),
SDLK_DECIMALSEPARATOR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR),
SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT),
SDLK_CURRENCYSUBUNIT =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT),
SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN),
SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN),
SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE),
SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE),
SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB),
SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE),
SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A),
SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B),
SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C),
SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D),
SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E),
SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F),
SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR),
SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER),
SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT),
SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS),
SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER),
SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND),
SDLK_KP_DBLAMPERSAND =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND),
SDLK_KP_VERTICALBAR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR),
SDLK_KP_DBLVERTICALBAR =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR),
SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON),
SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH),
SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE),
SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT),
SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM),
SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE),
SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL),
SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR),
SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD),
SDLK_KP_MEMSUBTRACT =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT),
SDLK_KP_MEMMULTIPLY =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY),
SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE),
SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS),
SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR),
SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY),
SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY),
SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL),
SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL),
SDLK_KP_HEXADECIMAL =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL),
SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL),
SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT),
SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT),
SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI),
SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL),
SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT),
SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT),
SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI),
SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE),
SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT),
SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV),
SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP),
SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY),
SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE),
SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT),
SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW),
SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL),
SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR),
SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER),
SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH),
SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME),
SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK),
SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD),
SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP),
SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH),
SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS),
SDLK_BRIGHTNESSDOWN =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN),
SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP),
SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH),
SDLK_KBDILLUMTOGGLE =
SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE),
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1),
SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2),
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD),
SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT),
SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT),
SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL),
SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL)
} SDL_KeyCode;
/**
* \brief Enumeration of valid key mods (possibly OR'd together).
*/
typedef enum
{
KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001,
KMOD_RSHIFT = 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LGUI = 0x0400,
KMOD_RGUI = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_SCROLL = 0x8000,
KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL,
KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT,
KMOD_ALT = KMOD_LALT | KMOD_RALT,
KMOD_GUI = KMOD_LGUI | KMOD_RGUI,
KMOD_RESERVED = KMOD_SCROLL /* This is for source-level compatibility with SDL 2.0.0. */
} SDL_Keymod;
#endif /* SDL_keycode_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -39,16 +39,16 @@
*/ */
#ifndef SDL_loadso_h_ #ifndef SDL_loadso_h_
#define SDL_loadso_h_ #define SDL_loadso_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_error.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* Dynamically load a shared object. * Dynamically load a shared object.
@ -89,7 +89,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
* \sa SDL_LoadObject * \sa SDL_LoadObject
* \sa SDL_UnloadObject * \sa SDL_UnloadObject
*/ */
extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, const char *name); extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
const char *name);
/** /**
* Unload a shared object from memory. * Unload a shared object from memory.
@ -103,11 +104,11 @@ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, const char *name);
*/ */
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_loadso_h_ */ #endif /* SDL_loadso_h_ */

View File

@ -26,22 +26,24 @@
*/ */
#ifndef _SDL_locale_h #ifndef _SDL_locale_h
#define _SDL_locale_h #define _SDL_locale_h
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_error.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */ /* *INDENT-OFF* */
extern "C" { extern "C" {
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif #endif
typedef struct SDL_Locale {
const char *language; /**< A language name, like "en" for English. */ typedef struct SDL_Locale
const char *country; /**< A country, like "US" for America. Can be NULL. */ {
const char *language; /**< A language name, like "en" for English. */
const char *country; /**< A country, like "US" for America. Can be NULL. */
} SDL_Locale; } SDL_Locale;
/** /**
@ -86,15 +88,15 @@ typedef struct SDL_Locale {
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
extern DECLSPEC SDL_Locale *SDLCALL SDL_GetPreferredLocales(void); extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */ /* *INDENT-OFF* */
} }
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* _SDL_locale_h */ #endif /* _SDL_locale_h */

View File

@ -35,22 +35,23 @@
*/ */
#ifndef SDL_log_h_ #ifndef SDL_log_h_
#define SDL_log_h_ #define SDL_log_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/**
* \brief The maximum size of a log message prior to SDL 2.0.24 /**
* * \brief The maximum size of a log message prior to SDL 2.0.24
* As of 2.0.24 there is no limit to the length of SDL log messages. *
*/ * As of 2.0.24 there is no limit to the length of SDL log messages.
#define SDL_MAX_LOG_MESSAGE 4096 */
#define SDL_MAX_LOG_MESSAGE 4096
/** /**
* \brief The predefined log categories * \brief The predefined log categories
@ -60,53 +61,56 @@ extern "C" {
* at the VERBOSE level and all other categories are enabled at the * at the VERBOSE level and all other categories are enabled at the
* ERROR level. * ERROR level.
*/ */
typedef enum { typedef enum
SDL_LOG_CATEGORY_APPLICATION, {
SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_APPLICATION,
SDL_LOG_CATEGORY_ASSERT, SDL_LOG_CATEGORY_ERROR,
SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_CATEGORY_ASSERT,
SDL_LOG_CATEGORY_AUDIO, SDL_LOG_CATEGORY_SYSTEM,
SDL_LOG_CATEGORY_VIDEO, SDL_LOG_CATEGORY_AUDIO,
SDL_LOG_CATEGORY_RENDER, SDL_LOG_CATEGORY_VIDEO,
SDL_LOG_CATEGORY_INPUT, SDL_LOG_CATEGORY_RENDER,
SDL_LOG_CATEGORY_TEST, SDL_LOG_CATEGORY_INPUT,
SDL_LOG_CATEGORY_TEST,
/* Reserved for future SDL library use */ /* Reserved for future SDL library use */
SDL_LOG_CATEGORY_RESERVED1, SDL_LOG_CATEGORY_RESERVED1,
SDL_LOG_CATEGORY_RESERVED2, SDL_LOG_CATEGORY_RESERVED2,
SDL_LOG_CATEGORY_RESERVED3, SDL_LOG_CATEGORY_RESERVED3,
SDL_LOG_CATEGORY_RESERVED4, SDL_LOG_CATEGORY_RESERVED4,
SDL_LOG_CATEGORY_RESERVED5, SDL_LOG_CATEGORY_RESERVED5,
SDL_LOG_CATEGORY_RESERVED6, SDL_LOG_CATEGORY_RESERVED6,
SDL_LOG_CATEGORY_RESERVED7, SDL_LOG_CATEGORY_RESERVED7,
SDL_LOG_CATEGORY_RESERVED8, SDL_LOG_CATEGORY_RESERVED8,
SDL_LOG_CATEGORY_RESERVED9, SDL_LOG_CATEGORY_RESERVED9,
SDL_LOG_CATEGORY_RESERVED10, SDL_LOG_CATEGORY_RESERVED10,
/* Beyond this point is reserved for application use, e.g. /* Beyond this point is reserved for application use, e.g.
enum { enum {
MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
MYAPP_CATEGORY_AWESOME2, MYAPP_CATEGORY_AWESOME2,
MYAPP_CATEGORY_AWESOME3, MYAPP_CATEGORY_AWESOME3,
... ...
}; };
*/ */
SDL_LOG_CATEGORY_CUSTOM SDL_LOG_CATEGORY_CUSTOM
} SDL_LogCategory; } SDL_LogCategory;
/** /**
* \brief The predefined log priorities * \brief The predefined log priorities
*/ */
typedef enum { typedef enum
SDL_LOG_PRIORITY_VERBOSE = 1, {
SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_VERBOSE = 1,
SDL_LOG_PRIORITY_INFO, SDL_LOG_PRIORITY_DEBUG,
SDL_LOG_PRIORITY_WARN, SDL_LOG_PRIORITY_INFO,
SDL_LOG_PRIORITY_ERROR, SDL_LOG_PRIORITY_WARN,
SDL_LOG_PRIORITY_CRITICAL, SDL_LOG_PRIORITY_ERROR,
SDL_NUM_LOG_PRIORITIES SDL_LOG_PRIORITY_CRITICAL,
SDL_NUM_LOG_PRIORITIES
} SDL_LogPriority; } SDL_LogPriority;
/** /**
* Set the priority of all log categories. * Set the priority of all log categories.
* *
@ -129,7 +133,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
* \sa SDL_LogGetPriority * \sa SDL_LogGetPriority
* \sa SDL_LogSetAllPriority * \sa SDL_LogSetAllPriority
*/ */
extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, SDL_LogPriority priority); extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
SDL_LogPriority priority);
/** /**
* Get the priority of a particular log category. * Get the priority of a particular log category.
@ -195,8 +200,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, .
* \sa SDL_LogMessageV * \sa SDL_LogMessageV
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
SDL_PRINTF_VARARG_FUNC(2);
/** /**
* Log a message with SDL_LOG_PRIORITY_DEBUG. * Log a message with SDL_LOG_PRIORITY_DEBUG.
@ -217,8 +221,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
SDL_PRINTF_VARARG_FUNC(2);
/** /**
* Log a message with SDL_LOG_PRIORITY_INFO. * Log a message with SDL_LOG_PRIORITY_INFO.
@ -239,8 +242,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
SDL_PRINTF_VARARG_FUNC(2);
/** /**
* Log a message with SDL_LOG_PRIORITY_WARN. * Log a message with SDL_LOG_PRIORITY_WARN.
@ -261,8 +263,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING
* \sa SDL_LogMessageV * \sa SDL_LogMessageV
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
*/ */
extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
SDL_PRINTF_VARARG_FUNC(2);
/** /**
* Log a message with SDL_LOG_PRIORITY_ERROR. * Log a message with SDL_LOG_PRIORITY_ERROR.
@ -283,8 +284,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
SDL_PRINTF_VARARG_FUNC(2);
/** /**
* Log a message with SDL_LOG_PRIORITY_CRITICAL. * Log a message with SDL_LOG_PRIORITY_CRITICAL.
@ -305,8 +305,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
SDL_PRINTF_VARARG_FUNC(2);
/** /**
* Log a message with the specified category and priority. * Log a message with the specified category and priority.
@ -328,7 +327,8 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogMessage(int category, SDL_LogPriority priority, extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
SDL_LogPriority priority,
SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3);
/** /**
@ -350,9 +350,9 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, SDL_LogPriority priori
* \sa SDL_LogVerbose * \sa SDL_LogVerbose
* \sa SDL_LogWarn * \sa SDL_LogWarn
*/ */
extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, SDL_LogPriority priority, extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_LogPriority priority,
SDL_PRINTF_VARARG_FUNCV(3); SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3);
/** /**
* The prototype for the log output callback function. * The prototype for the log output callback function.
@ -364,8 +364,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, SDL_LogPriority prior
* \param priority the priority of the message * \param priority the priority of the message
* \param message the message being output * \param message the message being output
*/ */
typedef void(SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
const char *message);
/** /**
* Get the current log output function. * Get the current log output function.
@ -393,11 +392,12 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal
*/ */
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus /* Ends C function definitions when using C++ */
#ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_log_h_ */ #endif /* SDL_log_h_ */

View File

@ -20,9 +20,9 @@
*/ */
#ifndef SDL_main_h_ #ifndef SDL_main_h_
#define SDL_main_h_ #define SDL_main_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
/** /**
* \file SDL_main.h * \file SDL_main.h
@ -30,99 +30,99 @@
* Redefine main() on some platforms so that it is called by SDL. * Redefine main() on some platforms so that it is called by SDL.
*/ */
#ifndef SDL_MAIN_HANDLED #ifndef SDL_MAIN_HANDLED
#if defined(__WIN32__) #if defined(__WIN32__)
/* On Windows SDL provides WinMain(), which parses the command line and passes /* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function. the arguments to your main function.
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
*/ */
#define SDL_MAIN_AVAILABLE #define SDL_MAIN_AVAILABLE
#elif defined(__WINRT__) #elif defined(__WINRT__)
/* On WinRT, SDL provides a main function that initializes CoreApplication, /* On WinRT, SDL provides a main function that initializes CoreApplication,
creating an instance of IFrameworkView in the process. creating an instance of IFrameworkView in the process.
Please note that #include'ing SDL_main.h is not enough to get a main() Please note that #include'ing SDL_main.h is not enough to get a main()
function working. In non-XAML apps, the file, function working. In non-XAML apps, the file,
src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be
called, with a pointer to the Direct3D-hosted XAML control passed in. called, with a pointer to the Direct3D-hosted XAML control passed in.
*/ */
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
#elif defined(__GDK__) #elif defined(__GDK__)
/* On GDK, SDL provides a main function that initializes the game runtime. /* On GDK, SDL provides a main function that initializes the game runtime.
Please note that #include'ing SDL_main.h is not enough to get a main() Please note that #include'ing SDL_main.h is not enough to get a main()
function working. You must either link against SDL2main or, if not possible, function working. You must either link against SDL2main or, if not possible,
call the SDL_GDKRunApp function from your entry point. call the SDL_GDKRunApp function from your entry point.
*/ */
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
#elif defined(__IPHONEOS__) #elif defined(__IPHONEOS__)
/* On iOS SDL provides a main function that creates an application delegate /* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop. and starts the iOS application run loop.
If you link with SDL dynamically on iOS, the main function can't be in a 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 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. stub main function that calls into the shared library to start execution.
See src/video/uikit/SDL_uikitappdelegate.m for more details. See src/video/uikit/SDL_uikitappdelegate.m for more details.
*/ */
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
/* On Android SDL provides a Java class in SDLActivity.java that is the /* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point. main activity entry point.
See docs/README-android.md for more details on extending that class. See docs/README-android.md for more details on extending that class.
*/ */
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
/* We need to export SDL_main so it can be launched from Java */ /* We need to export SDL_main so it can be launched from Java */
#define SDLMAIN_DECLSPEC DECLSPEC #define SDLMAIN_DECLSPEC DECLSPEC
#elif defined(__NACL__) #elif defined(__NACL__)
/* On NACL we use ppapi_simple to set up the application helper code, /* On NACL we use ppapi_simple to set up the application helper code,
then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before
starting the user main function. starting the user main function.
All user code is run in a separate thread by ppapi_simple, thus All user code is run in a separate thread by ppapi_simple, thus
allowing for blocking io to take place via nacl_io allowing for blocking io to take place via nacl_io
*/ */
#define SDL_MAIN_NEEDED #define SDL_MAIN_NEEDED
#elif defined(__PSP__) #elif defined(__PSP__)
/* On PSP SDL provides a main function that sets the module info, /* On PSP SDL provides a main function that sets the module info,
activates the GPU and starts the thread required to be able to exit activates the GPU and starts the thread required to be able to exit
the software. the software.
If you provide this yourself, you may define SDL_MAIN_HANDLED If you provide this yourself, you may define SDL_MAIN_HANDLED
*/ */
#define SDL_MAIN_AVAILABLE #define SDL_MAIN_AVAILABLE
#elif defined(__PS2__) #elif defined(__PS2__)
#define SDL_MAIN_AVAILABLE #define SDL_MAIN_AVAILABLE
#define SDL_PS2_SKIP_IOP_RESET() \ #define SDL_PS2_SKIP_IOP_RESET() \
void reset_IOP(); \ void reset_IOP(); \
void reset_IOP() {} void reset_IOP() {}
#elif defined(__3DS__) #elif defined(__3DS__)
/* /*
On N3DS, SDL provides a main function that sets up the screens On N3DS, SDL provides a main function that sets up the screens
and storage. and storage.
If you provide this yourself, you may define SDL_MAIN_HANDLED If you provide this yourself, you may define SDL_MAIN_HANDLED
*/ */
#define SDL_MAIN_AVAILABLE #define SDL_MAIN_AVAILABLE
#endif #endif
#endif /* SDL_MAIN_HANDLED */ #endif /* SDL_MAIN_HANDLED */
#ifndef SDLMAIN_DECLSPEC #ifndef SDLMAIN_DECLSPEC
#define SDLMAIN_DECLSPEC #define SDLMAIN_DECLSPEC
#endif #endif
/** /**
* \file SDL_main.h * \file SDL_main.h
@ -139,14 +139,14 @@
* \endcode * \endcode
*/ */
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
#define main SDL_main #define main SDL_main
#endif #endif
#include "begin_code.h" #include "begin_code.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* The prototype for the application's main() function * The prototype for the application's main() function
@ -154,6 +154,7 @@ extern "C" {
typedef int (*SDL_main_func)(int argc, char *argv[]); typedef int (*SDL_main_func)(int argc, char *argv[]);
extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
/** /**
* Circumvent failure of SDL_Init() when not using SDL_main() as an entry * Circumvent failure of SDL_Init() when not using SDL_main() as an entry
* point. * point.
@ -169,7 +170,7 @@ extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
*/ */
extern DECLSPEC void SDLCALL SDL_SetMainReady(void); extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
#if defined(__WIN32__) || defined(__GDK__) #if defined(__WIN32__) || defined(__GDK__)
/** /**
* Register a win32 window class for SDL's use. * Register a win32 window class for SDL's use.
@ -213,9 +214,10 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void
*/ */
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* defined(__WIN32__) || defined(__GDK__) */ #endif /* defined(__WIN32__) || defined(__GDK__) */
#ifdef __WINRT__
#ifdef __WINRT__
/** /**
* Initialize and launch an SDL/WinRT application. * Initialize and launch an SDL/WinRT application.
@ -227,11 +229,11 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
* *
* \since This function is available since SDL 2.0.3. * \since This function is available since SDL 2.0.3.
*/ */
extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void *reserved); extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved);
#endif /* __WINRT__ */ #endif /* __WINRT__ */
#if defined(__IPHONEOS__) #if defined(__IPHONEOS__)
/** /**
* Initializes and launches an SDL application. * Initializes and launches an SDL application.
@ -245,9 +247,9 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void *re
*/ */
extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction);
#endif /* __IPHONEOS__ */ #endif /* __IPHONEOS__ */
#ifdef __GDK__ #ifdef __GDK__
/** /**
* Initialize and launch an SDL GDK application. * Initialize and launch an SDL GDK application.
@ -268,12 +270,12 @@ extern DECLSPEC int SDLCALL SDL_GDKRunApp(SDL_main_func mainFunction, void *rese
*/ */
extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GDK__ */ #endif /* __GDK__ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_main_h_ */ #endif /* SDL_main_h_ */

View File

@ -20,81 +20,88 @@
*/ */
#ifndef SDL_messagebox_h_ #ifndef SDL_messagebox_h_
#define SDL_messagebox_h_ #define SDL_messagebox_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_video.h" /* For SDL_Window */ #include "SDL_video.h" /* For SDL_Window */
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* SDL_MessageBox flags. If supported will display warning icon, etc. * SDL_MessageBox flags. If supported will display warning icon, etc.
*/ */
typedef enum { typedef enum
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ {
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */ SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */
SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */ 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; } SDL_MessageBoxFlags;
/** /**
* Flags for SDL_MessageBoxButtonData. * Flags for SDL_MessageBoxButtonData.
*/ */
typedef enum { typedef enum
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ {
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
} SDL_MessageBoxButtonFlags; } SDL_MessageBoxButtonFlags;
/** /**
* Individual button data. * Individual button data.
*/ */
typedef struct { typedef struct
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ {
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
const char *text; /**< The UTF-8 button text */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
const char * text; /**< The UTF-8 button text */
} SDL_MessageBoxButtonData; } SDL_MessageBoxButtonData;
/** /**
* RGB value used in a message box color scheme * RGB value used in a message box color scheme
*/ */
typedef struct { typedef struct
Uint8 r, g, b; {
Uint8 r, g, b;
} SDL_MessageBoxColor; } SDL_MessageBoxColor;
typedef enum { typedef enum
SDL_MESSAGEBOX_COLOR_BACKGROUND, {
SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_BACKGROUND,
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, SDL_MESSAGEBOX_COLOR_TEXT,
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
SDL_MESSAGEBOX_COLOR_MAX SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
SDL_MESSAGEBOX_COLOR_MAX
} SDL_MessageBoxColorType; } SDL_MessageBoxColorType;
/** /**
* A set of colors to use for message box dialogs * A set of colors to use for message box dialogs
*/ */
typedef struct { typedef struct
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; {
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
} SDL_MessageBoxColorScheme; } SDL_MessageBoxColorScheme;
/** /**
* MessageBox structure containing title, text, window, etc. * MessageBox structure containing title, text, window, etc.
*/ */
typedef struct { typedef struct
Uint32 flags; /**< ::SDL_MessageBoxFlags */ {
SDL_Window *window; /**< Parent window, can be NULL */ Uint32 flags; /**< ::SDL_MessageBoxFlags */
const char *title; /**< UTF-8 title */ SDL_Window *window; /**< Parent window, can be NULL */
const char *message; /**< UTF-8 message text */ const char *title; /**< UTF-8 title */
const char *message; /**< UTF-8 message text */
int numbuttons; int numbuttons;
const SDL_MessageBoxButtonData *buttons; const SDL_MessageBoxButtonData *buttons;
const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
} SDL_MessageBoxData; } SDL_MessageBoxData;
/** /**
@ -172,14 +179,14 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message
* *
* \sa SDL_ShowMessageBox * \sa SDL_ShowMessageBox
*/ */
extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window);
SDL_Window *window);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus /* Ends C function definitions when using C++ */
#ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_messagebox_h_ */ #endif /* SDL_messagebox_h_ */

View File

@ -63,7 +63,7 @@ typedef void *SDL_MetalView;
* \sa SDL_Metal_DestroyView * \sa SDL_Metal_DestroyView
* \sa SDL_Metal_GetLayer * \sa SDL_Metal_GetLayer
*/ */
extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window *window); extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window);
/** /**
* Destroy an existing SDL_MetalView object. * Destroy an existing SDL_MetalView object.
@ -99,9 +99,10 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
* \sa SDL_GetWindowSize * \sa SDL_GetWindowSize
* \sa SDL_CreateWindow * \sa SDL_CreateWindow
*/ */
extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window *window, int *w, int *h); extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w,
int *h);
/* @} */ /* Metal support functions */ /* @} *//* Metal support functions */
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -26,16 +26,16 @@
*/ */
#ifndef SDL_misc_h_ #ifndef SDL_misc_h_
#define SDL_misc_h_ #define SDL_misc_h_
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* Open a URL/URI in the browser or other appropriate external application. * Open a URL/URI in the browser or other appropriate external application.
@ -68,11 +68,11 @@ extern "C" {
*/ */
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_misc_h_ */ #endif /* SDL_misc_h_ */

View File

@ -26,45 +26,47 @@
*/ */
#ifndef SDL_mouse_h_ #ifndef SDL_mouse_h_
#define SDL_mouse_h_ #define SDL_mouse_h_
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_error.h"
#include "SDL_video.h" #include "SDL_video.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/** /**
* \brief Cursor types for SDL_CreateSystemCursor(). * \brief Cursor types for SDL_CreateSystemCursor().
*/ */
typedef enum { typedef enum
SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ {
SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
SDL_SYSTEM_CURSOR_WAIT, /**< Wait */ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */ SDL_SYSTEM_CURSOR_WAIT, /**< Wait */
SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */ SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */ SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */ SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */
SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */ SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */
SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */ SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */
SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */ SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */
SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */ SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */
SDL_SYSTEM_CURSOR_HAND, /**< Hand */ SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */
SDL_NUM_SYSTEM_CURSORS SDL_SYSTEM_CURSOR_HAND, /**< Hand */
SDL_NUM_SYSTEM_CURSORS
} SDL_SystemCursor; } SDL_SystemCursor;
/** /**
* \brief Scroll direction types for the Scroll event * \brief Scroll direction types for the Scroll event
*/ */
typedef enum { typedef enum
SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */ {
SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */ SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
} SDL_MouseWheelDirection; } SDL_MouseWheelDirection;
/* Function prototypes */ /* Function prototypes */
@ -76,7 +78,7 @@ typedef enum {
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC SDL_Window *SDLCALL SDL_GetMouseFocus(void); extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
/** /**
* Retrieve the current state of the mouse. * Retrieve the current state of the mouse.
@ -168,7 +170,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
* *
* \sa SDL_WarpMouseGlobal * \sa SDL_WarpMouseGlobal
*/ */
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window *window, int x, int y); extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
int x, int y);
/** /**
* Move the mouse to the given position in global screen space. * Move the mouse to the given position in global screen space.
@ -311,7 +314,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
* \sa SDL_SetCursor * \sa SDL_SetCursor
* \sa SDL_ShowCursor * \sa SDL_ShowCursor
*/ */
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h, int hot_x, extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
const Uint8 * mask,
int w, int h, int hot_x,
int hot_y); int hot_y);
/** /**
@ -328,7 +333,9 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 *data, const Ui
* \sa SDL_CreateCursor * \sa SDL_CreateCursor
* \sa SDL_FreeCursor * \sa SDL_FreeCursor
*/ */
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y); extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
int hot_x,
int hot_y);
/** /**
* Create a system cursor. * Create a system cursor.
@ -359,7 +366,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
* \sa SDL_GetCursor * \sa SDL_GetCursor
* \sa SDL_ShowCursor * \sa SDL_ShowCursor
*/ */
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor); extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
/** /**
* Get the active cursor. * Get the active cursor.
@ -403,7 +410,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
* \sa SDL_CreateCursor * \sa SDL_CreateCursor
* \sa SDL_CreateSystemCursor * \sa SDL_CreateSystemCursor
*/ */
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor); extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
/** /**
* Toggle whether or not the cursor is shown. * Toggle whether or not the cursor is shown.
@ -427,30 +434,30 @@ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
*/ */
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
/** /**
* Used as a mask when testing buttons in buttonstate. * Used as a mask when testing buttons in buttonstate.
* *
* - Button 1: Left mouse button * - Button 1: Left mouse button
* - Button 2: Middle mouse button * - Button 2: Middle mouse button
* - Button 3: Right mouse button * - Button 3: Right mouse button
*/ */
#define SDL_BUTTON(X) (1 << ((X) - 1)) #define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1 #define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2 #define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3 #define SDL_BUTTON_RIGHT 3
#define SDL_BUTTON_X1 4 #define SDL_BUTTON_X1 4
#define SDL_BUTTON_X2 5 #define SDL_BUTTON_X2 5
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) #define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) #define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_mouse_h_ */ #endif /* SDL_mouse_h_ */

View File

@ -20,7 +20,7 @@
*/ */
#ifndef SDL_mutex_h_ #ifndef SDL_mutex_h_
#define SDL_mutex_h_ #define SDL_mutex_h_
/** /**
* \file SDL_mutex.h * \file SDL_mutex.h
@ -28,77 +28,100 @@
* Functions to provide thread synchronization primitives. * Functions to provide thread synchronization primitives.
*/ */
#include "SDL_error.h" #include "SDL_stdinc.h"
#include "SDL_stdinc.h" #include "SDL_error.h"
/******************************************************************************/ /******************************************************************************/
/* Enable thread safety attributes only with clang. /* Enable thread safety attributes only with clang.
* The attributes can be safely erased when compiling with other compilers. * The attributes can be safely erased when compiling with other compilers.
*/ */
#if defined(SDL_THREAD_SAFETY_ANALYSIS) && defined(__clang__) && (!defined(SWIG)) #if defined(SDL_THREAD_SAFETY_ANALYSIS) && \
#define SDL_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) defined(__clang__) && (!defined(SWIG))
#else #define SDL_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
#define SDL_THREAD_ANNOTATION_ATTRIBUTE__(x) /* no-op */ #else
#endif #define SDL_THREAD_ANNOTATION_ATTRIBUTE__(x) /* no-op */
#endif
#define SDL_CAPABILITY(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) #define SDL_CAPABILITY(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(capability(x))
#define SDL_SCOPED_CAPABILITY SDL_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) #define SDL_SCOPED_CAPABILITY \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable)
#define SDL_GUARDED_BY(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) #define SDL_GUARDED_BY(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
#define SDL_PT_GUARDED_BY(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) #define SDL_PT_GUARDED_BY(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
#define SDL_ACQUIRED_BEFORE(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(x)) #define SDL_ACQUIRED_BEFORE(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(x))
#define SDL_ACQUIRED_AFTER(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(x)) #define SDL_ACQUIRED_AFTER(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(x))
#define SDL_REQUIRES(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(x)) #define SDL_REQUIRES(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(x))
#define SDL_REQUIRES_SHARED(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(x)) #define SDL_REQUIRES_SHARED(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(x))
#define SDL_ACQUIRE(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(x)) #define SDL_ACQUIRE(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(x))
#define SDL_ACQUIRE_SHARED(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(x)) #define SDL_ACQUIRE_SHARED(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(x))
#define SDL_RELEASE(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(x)) #define SDL_RELEASE(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(x))
#define SDL_RELEASE_SHARED(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(x)) #define SDL_RELEASE_SHARED(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(x))
#define SDL_RELEASE_GENERIC(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_generic_capability(x)) #define SDL_RELEASE_GENERIC(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_generic_capability(x))
#define SDL_TRY_ACQUIRE(x, y) SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(x, y)) #define SDL_TRY_ACQUIRE(x, y) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(x, y))
#define SDL_TRY_ACQUIRE_SHARED(x, y) SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(x, y)) #define SDL_TRY_ACQUIRE_SHARED(x, y) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(x, y))
#define SDL_EXCLUDES(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x)) #define SDL_EXCLUDES(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x))
#define SDL_ASSERT_CAPABILITY(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x)) #define SDL_ASSERT_CAPABILITY(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x))
#define SDL_ASSERT_SHARED_CAPABILITY(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x)) #define SDL_ASSERT_SHARED_CAPABILITY(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x))
#define SDL_RETURN_CAPABILITY(x) SDL_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) #define SDL_RETURN_CAPABILITY(x) \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x))
#define SDL_NO_THREAD_SAFETY_ANALYSIS SDL_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) #define SDL_NO_THREAD_SAFETY_ANALYSIS \
SDL_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis)
/******************************************************************************/ /******************************************************************************/
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ #include "begin_code.h"
#ifdef __cplusplus /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* Synchronization functions which can time out return this value * Synchronization functions which can time out return this value
* if they time out. * if they time out.
*/ */
#define SDL_MUTEX_TIMEDOUT 1 #define SDL_MUTEX_TIMEDOUT 1
/**
* This is the timeout value which corresponds to never time out.
*/
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
/**
* This is the timeout value which corresponds to never time out.
*/
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
/** /**
* \name Mutex functions * \name Mutex functions
@ -147,8 +170,8 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex *mutex) SDL_ACQUIRE(mutex); extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex) SDL_ACQUIRE(mutex);
#define SDL_mutexP(m) SDL_LockMutex(m) #define SDL_mutexP(m) SDL_LockMutex(m)
/** /**
* Try to lock a mutex without blocking. * Try to lock a mutex without blocking.
@ -170,7 +193,7 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex *mutex) SDL_ACQUIRE(mutex);
* \sa SDL_LockMutex * \sa SDL_LockMutex
* \sa SDL_UnlockMutex * \sa SDL_UnlockMutex
*/ */
extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex *mutex) SDL_TRY_ACQUIRE(0, mutex); extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex) SDL_TRY_ACQUIRE(0, mutex);
/** /**
* Unlock the mutex. * Unlock the mutex.
@ -189,8 +212,8 @@ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex *mutex) SDL_TRY_ACQUIRE(0
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex *mutex) SDL_RELEASE(mutex); extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex) SDL_RELEASE(mutex);
#define SDL_mutexV(m) SDL_UnlockMutex(m) #define SDL_mutexV(m) SDL_UnlockMutex(m)
/** /**
* Destroy a mutex created with SDL_CreateMutex(). * Destroy a mutex created with SDL_CreateMutex().
@ -210,9 +233,10 @@ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex *mutex) SDL_RELEASE(mutex)
* \sa SDL_TryLockMutex * \sa SDL_TryLockMutex
* \sa SDL_UnlockMutex * \sa SDL_UnlockMutex
*/ */
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex); extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
/* @} *//* Mutex functions */
/* @} */ /* Mutex functions */
/** /**
* \name Semaphore functions * \name Semaphore functions
@ -264,7 +288,7 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
* \sa SDL_SemWait * \sa SDL_SemWait
* \sa SDL_SemWaitTimeout * \sa SDL_SemWaitTimeout
*/ */
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem); extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
/** /**
* Wait until a semaphore has a positive value and then decrements it. * Wait until a semaphore has a positive value and then decrements it.
@ -291,7 +315,7 @@ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
* \sa SDL_SemWait * \sa SDL_SemWait
* \sa SDL_SemWaitTimeout * \sa SDL_SemWaitTimeout
*/ */
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem); extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
/** /**
* See if a semaphore has a positive value and decrement it if it does. * See if a semaphore has a positive value and decrement it if it does.
@ -315,7 +339,7 @@ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
* \sa SDL_SemWait * \sa SDL_SemWait
* \sa SDL_SemWaitTimeout * \sa SDL_SemWaitTimeout
*/ */
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem); extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
/** /**
* Wait until a semaphore has a positive value and then decrements it. * Wait until a semaphore has a positive value and then decrements it.
@ -358,7 +382,7 @@ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout);
* \sa SDL_SemWait * \sa SDL_SemWait
* \sa SDL_SemWaitTimeout * \sa SDL_SemWaitTimeout
*/ */
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem); extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
/** /**
* Get the current value of a semaphore. * Get the current value of a semaphore.
@ -370,9 +394,10 @@ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
* *
* \sa SDL_CreateSemaphore * \sa SDL_CreateSemaphore
*/ */
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem); extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
/* @} *//* Semaphore functions */
/* @} */ /* Semaphore functions */
/** /**
* \name Condition variable functions * \name Condition variable functions
@ -412,7 +437,7 @@ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
* \sa SDL_CondWaitTimeout * \sa SDL_CondWaitTimeout
* \sa SDL_CreateCond * \sa SDL_CreateCond
*/ */
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond); extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
/** /**
* Restart one of the threads that are waiting on the condition variable. * Restart one of the threads that are waiting on the condition variable.
@ -429,7 +454,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
* \sa SDL_CreateCond * \sa SDL_CreateCond
* \sa SDL_DestroyCond * \sa SDL_DestroyCond
*/ */
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond); extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
/** /**
* Restart all threads that are waiting on the condition variable. * Restart all threads that are waiting on the condition variable.
@ -446,7 +471,7 @@ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
* \sa SDL_CreateCond * \sa SDL_CreateCond
* \sa SDL_DestroyCond * \sa SDL_DestroyCond
*/ */
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond); extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
/** /**
* Wait until a condition variable is signaled. * Wait until a condition variable is signaled.
@ -474,7 +499,7 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
* \sa SDL_CreateCond * \sa SDL_CreateCond
* \sa SDL_DestroyCond * \sa SDL_DestroyCond
*/ */
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex); extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
/** /**
* Wait until a condition variable is signaled or a certain time has passed. * Wait until a condition variable is signaled or a certain time has passed.
@ -503,15 +528,17 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex);
* \sa SDL_CreateCond * \sa SDL_CreateCond
* \sa SDL_DestroyCond * \sa SDL_DestroyCond
*/ */
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
SDL_mutex * mutex, Uint32 ms);
/* @} */ /* Condition variable functions */ /* @} *//* Condition variable functions */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus /* Ends C function definitions when using C++ */
#ifdef __cplusplus
} }
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* SDL_mutex_h_ */ #endif /* SDL_mutex_h_ */

View File

@ -20,13 +20,13 @@
*/ */
#ifndef SDLname_h_ #ifndef SDLname_h_
#define SDLname_h_ #define SDLname_h_
#if defined(__STDC__) || defined(__cplusplus) #if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1 #define NeedFunctionPrototypes 1
#endif #endif
#define SDL_NAME(X) SDL_##X #define SDL_NAME(X) SDL_##X
#endif /* SDLname_h_ */ #endif /* SDLname_h_ */

2132
third_party/SDL2/include/SDL_opengl.h vendored Normal file

File diff suppressed because it is too large Load Diff

13213
third_party/SDL2/include/SDL_opengl_glext.h vendored Normal file

File diff suppressed because it is too large Load Diff

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