Move third_party from src to root directory.
This commit is contained in:
parent
c821949354
commit
f47e2eb4af
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.exe
|
||||||
|
*.pdf
|
||||||
|
*.obj
|
||||||
|
*.pdb
|
||||||
|
*.res
|
@ -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\"
|
||||||
|
|
||||||
|
320
src/third_party/SDL2/include/SDL_assert.h
vendored
320
src/third_party/SDL2/include/SDL_assert.h
vendored
@ -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: */
|
|
116
src/third_party/SDL2/include/SDL_bits.h
vendored
116
src/third_party/SDL2/include/SDL_bits.h
vendored
@ -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: */
|
|
333
src/third_party/SDL2/include/SDL_config.h
vendored
333
src/third_party/SDL2/include/SDL_config.h
vendored
@ -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: */
|
|
2522
src/third_party/SDL2/include/SDL_egl.h
vendored
2522
src/third_party/SDL2/include/SDL_egl.h
vendored
File diff suppressed because it is too large
Load Diff
300
src/third_party/SDL2/include/SDL_endian.h
vendored
300
src/third_party/SDL2/include/SDL_endian.h
vendored
@ -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: */
|
|
1112
src/third_party/SDL2/include/SDL_events.h
vendored
1112
src/third_party/SDL2/include/SDL_events.h
vendored
File diff suppressed because it is too large
Load Diff
2923
src/third_party/SDL2/include/SDL_hints.h
vendored
2923
src/third_party/SDL2/include/SDL_hints.h
vendored
File diff suppressed because it is too large
Load Diff
344
src/third_party/SDL2/include/SDL_keycode.h
vendored
344
src/third_party/SDL2/include/SDL_keycode.h
vendored
@ -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: */
|
|
1977
src/third_party/SDL2/include/SDL_opengl.h
vendored
1977
src/third_party/SDL2/include/SDL_opengl.h
vendored
File diff suppressed because it is too large
Load Diff
14742
src/third_party/SDL2/include/SDL_opengl_glext.h
vendored
14742
src/third_party/SDL2/include/SDL_opengl_glext.h
vendored
File diff suppressed because it is too large
Load Diff
704
src/third_party/SDL2/include/SDL_opengles2_gl2.h
vendored
704
src/third_party/SDL2/include/SDL_opengles2_gl2.h
vendored
@ -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
|
|
4589
src/third_party/SDL2/include/SDL_opengles2_gl2ext.h
vendored
4589
src/third_party/SDL2/include/SDL_opengles2_gl2ext.h
vendored
File diff suppressed because it is too large
Load Diff
579
src/third_party/SDL2/include/SDL_pixels.h
vendored
579
src/third_party/SDL2/include/SDL_pixels.h
vendored
@ -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: */
|
|
276
src/third_party/SDL2/include/SDL_platform.h
vendored
276
src/third_party/SDL2/include/SDL_platform.h
vendored
@ -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: */
|
|
7
src/third_party/SDL2/include/SDL_revision.h
vendored
7
src/third_party/SDL2/include/SDL_revision.h
vendored
@ -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
|
|
437
src/third_party/SDL2/include/SDL_scancode.h
vendored
437
src/third_party/SDL2/include/SDL_scancode.h
vendored
@ -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: */
|
|
829
src/third_party/SDL2/include/SDL_stdinc.h
vendored
829
src/third_party/SDL2/include/SDL_stdinc.h
vendored
@ -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: */
|
|
364
src/third_party/SDL2/include/SDL_syswm.h
vendored
364
src/third_party/SDL2/include/SDL_syswm.h
vendored
@ -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: */
|
|
187
src/third_party/SDL2/include/begin_code.h
vendored
187
src/third_party/SDL2/include/begin_code.h
vendored
@ -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 */
|
|
BIN
src/third_party/SDL2/lib/x64/SDL2.dll
vendored
BIN
src/third_party/SDL2/lib/x64/SDL2.dll
vendored
Binary file not shown.
BIN
src/third_party/SDL2/lib/x86/SDL2.dll
vendored
BIN
src/third_party/SDL2/lib/x86/SDL2.dll
vendored
Binary file not shown.
@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
Bugs are now managed in the SDL issue tracker, here:
|
Bugs are now managed in the SDL issue tracker, here:
|
||||||
|
|
||||||
https://github.com/libsdl-org/SDL/issues
|
https://github.com/libsdl-org/SDL/issues
|
||||||
|
|
||||||
You may report bugs there, and search to see if a given issue has already
|
You may report bugs there, and search to see if a given issue has already
|
||||||
been reported, discussed, and maybe even fixed.
|
been reported, discussed, and maybe even fixed.
|
||||||
|
|
||||||
|
|
||||||
You may also find help at the SDL forums/mailing list:
|
You may also find help at the SDL forums/mailing list:
|
||||||
|
|
||||||
https://discourse.libsdl.org/
|
https://discourse.libsdl.org/
|
||||||
|
|
||||||
Bug reports are welcome here, but we really appreciate if you use the issue
|
Bug reports are welcome here, but we really appreciate if you use the issue
|
||||||
tracker, as bugs discussed on the mailing list may be forgotten or missed.
|
tracker, as bugs discussed on the mailing list may be forgotten or missed.
|
||||||
|
|
@ -1,20 +1,20 @@
|
|||||||
|
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
arising from the use of this software.
|
arising from the use of this software.
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
including commercial applications, and to alter it and redistribute it
|
including commercial applications, and to alter it and redistribute it
|
||||||
freely, subject to the following restrictions:
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
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
|
claim that you wrote the original software. If you use this software
|
||||||
in a product, an acknowledgment in the product documentation would be
|
in a product, an acknowledgment in the product documentation would be
|
||||||
appreciated but is not required.
|
appreciated but is not required.
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
misrepresented as being the original software.
|
misrepresented as being the original software.
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
Please distribute this file with the SDL runtime environment:
|
Please distribute this file with the SDL runtime environment:
|
||||||
|
|
||||||
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
||||||
designed to make it easy to write multi-media software, such as games
|
designed to make it easy to write multi-media software, such as games
|
||||||
and emulators.
|
and emulators.
|
||||||
|
|
||||||
The Simple DirectMedia Layer library source code is available from:
|
The Simple DirectMedia Layer library source code is available from:
|
||||||
https://www.libsdl.org/
|
https://www.libsdl.org/
|
||||||
|
|
||||||
This library is distributed under the terms of the zlib license:
|
This library is distributed under the terms of the zlib license:
|
||||||
http://www.zlib.net/zlib_license.html
|
http://www.zlib.net/zlib_license.html
|
||||||
|
|
@ -1,21 +1,21 @@
|
|||||||
|
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
|
|
||||||
(SDL)
|
(SDL)
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
---
|
---
|
||||||
https://www.libsdl.org/
|
https://www.libsdl.org/
|
||||||
|
|
||||||
Simple DirectMedia Layer is a cross-platform development library designed
|
Simple DirectMedia Layer is a cross-platform development library designed
|
||||||
to provide low level access to audio, keyboard, mouse, joystick, and graphics
|
to provide low level access to audio, keyboard, mouse, joystick, and graphics
|
||||||
hardware via OpenGL and Direct3D. It is used by video playback software,
|
hardware via OpenGL and Direct3D. It is used by video playback software,
|
||||||
emulators, and popular games including Valve's award winning catalog
|
emulators, and popular games including Valve's award winning catalog
|
||||||
and many Humble Bundle games.
|
and many Humble Bundle games.
|
||||||
|
|
||||||
More extensive documentation is available in the docs directory, starting
|
More extensive documentation is available in the docs directory, starting
|
||||||
with README.md
|
with README.md
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
Sam Lantinga (slouken@libsdl.org)
|
Sam Lantinga (slouken@libsdl.org)
|
File diff suppressed because it is too large
Load Diff
@ -1,483 +1,483 @@
|
|||||||
Android
|
Android
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Matt Styles wrote a tutorial on building SDL for Android with Visual Studio:
|
Matt Styles wrote a tutorial on building SDL for Android with Visual Studio:
|
||||||
http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html
|
http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html
|
||||||
|
|
||||||
The rest of this README covers the Android gradle style build process.
|
The rest of this README covers the Android gradle style build process.
|
||||||
|
|
||||||
If you are using the older ant build process, it is no longer officially
|
If you are using the older ant build process, it is no longer officially
|
||||||
supported, but you can use the "android-project-ant" directory as a template.
|
supported, but you can use the "android-project-ant" directory as a template.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Android SDK (version 34 or later)
|
Android SDK (version 34 or later)
|
||||||
https://developer.android.com/sdk/index.html
|
https://developer.android.com/sdk/index.html
|
||||||
|
|
||||||
Android NDK r15c or later
|
Android NDK r15c or later
|
||||||
https://developer.android.com/tools/sdk/ndk/index.html
|
https://developer.android.com/tools/sdk/ndk/index.html
|
||||||
|
|
||||||
Minimum API level supported by SDL: 19 (Android 4.4)
|
Minimum API level supported by SDL: 19 (Android 4.4)
|
||||||
|
|
||||||
|
|
||||||
How the port works
|
How the port works
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
- Android applications are Java-based, optionally with parts written in C
|
- Android applications are Java-based, optionally with parts written in C
|
||||||
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
|
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
|
||||||
the SDL library
|
the SDL library
|
||||||
- This means that your application C code must be placed inside an Android
|
- This means that your application C code must be placed inside an Android
|
||||||
Java project, along with some C support code that communicates with Java
|
Java project, along with some C support code that communicates with Java
|
||||||
- This eventually produces a standard Android .apk package
|
- This eventually produces a standard Android .apk package
|
||||||
|
|
||||||
The Android Java code implements an "Activity" and can be found in:
|
The Android Java code implements an "Activity" and can be found in:
|
||||||
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||||
|
|
||||||
The Java code loads your game code, the SDL shared library, and
|
The Java code loads your game code, the SDL shared library, and
|
||||||
dispatches to native functions implemented in the SDL library:
|
dispatches to native functions implemented in the SDL library:
|
||||||
src/core/android/SDL_android.c
|
src/core/android/SDL_android.c
|
||||||
|
|
||||||
|
|
||||||
Building an app
|
Building an app
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
For simple projects you can use the script located at build-scripts/androidbuild.sh
|
For simple projects you can use the script located at build-scripts/androidbuild.sh
|
||||||
|
|
||||||
There's two ways of using it:
|
There's two ways of using it:
|
||||||
|
|
||||||
androidbuild.sh com.yourcompany.yourapp < sources.list
|
androidbuild.sh com.yourcompany.yourapp < sources.list
|
||||||
androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
|
androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
|
||||||
|
|
||||||
sources.list should be a text file with a source file name in each line
|
sources.list should be a text file with a source file name in each line
|
||||||
Filenames should be specified relative to the current directory, for example if
|
Filenames should be specified relative to the current directory, for example if
|
||||||
you are in the build-scripts directory and want to create the testgles.c test, you'll
|
you are in the build-scripts directory and want to create the testgles.c test, you'll
|
||||||
run:
|
run:
|
||||||
|
|
||||||
./androidbuild.sh org.libsdl.testgles ../test/testgles.c
|
./androidbuild.sh org.libsdl.testgles ../test/testgles.c
|
||||||
|
|
||||||
One limitation of this script is that all sources provided will be aggregated into
|
One limitation of this script is that all sources provided will be aggregated into
|
||||||
a single directory, thus all your source files should have a unique name.
|
a single directory, thus all your source files should have a unique name.
|
||||||
|
|
||||||
Once the project is complete the script will tell you where the debug APK is located.
|
Once the project is complete the script will tell you where the debug APK is located.
|
||||||
If you want to create a signed release APK, you can use the project created by this
|
If you want to create a signed release APK, you can use the project created by this
|
||||||
utility to generate it.
|
utility to generate it.
|
||||||
|
|
||||||
Finally, a word of caution: re running androidbuild.sh wipes any changes you may have
|
Finally, a word of caution: re running androidbuild.sh wipes any changes you may have
|
||||||
done in the build directory for the app!
|
done in the build directory for the app!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
For more complex projects, follow these instructions:
|
For more complex projects, follow these instructions:
|
||||||
|
|
||||||
1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT).
|
1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT).
|
||||||
|
|
||||||
(The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.)
|
(The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.)
|
||||||
|
|
||||||
2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
|
2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
|
||||||
|
|
||||||
(This is needed as the source of SDL has to be compiled by the Android compiler)
|
(This is needed as the source of SDL has to be compiled by the Android compiler)
|
||||||
|
|
||||||
3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
|
3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
|
||||||
|
|
||||||
(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
|
(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
|
||||||
|
|
||||||
4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
|
4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
|
||||||
|
|
||||||
4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
|
4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
|
||||||
|
|
||||||
|
|
||||||
If you already have a project that uses CMake, the instructions change somewhat:
|
If you already have a project that uses CMake, the instructions change somewhat:
|
||||||
|
|
||||||
1. Do points 1 and 2 from the instruction above.
|
1. Do points 1 and 2 from the instruction above.
|
||||||
2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build
|
2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build
|
||||||
and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
|
and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
|
||||||
3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to
|
3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to
|
||||||
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
|
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
|
||||||
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
|
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
|
||||||
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
|
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
|
||||||
add_executable() for the target containing your "main" function.
|
add_executable() for the target containing your "main" function.
|
||||||
|
|
||||||
If you wish to use Android Studio, you can skip the last step.
|
If you wish to use Android Studio, you can skip the last step.
|
||||||
|
|
||||||
4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
|
4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
|
||||||
connected Android device
|
connected Android device
|
||||||
|
|
||||||
Here's an explanation of the files in the Android project, so you can customize them:
|
Here's an explanation of the files in the Android project, so you can customize them:
|
||||||
|
|
||||||
android-project/app
|
android-project/app
|
||||||
build.gradle - build info including the application version and SDK
|
build.gradle - build info including the application version and SDK
|
||||||
src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
|
src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
|
||||||
jni/ - directory holding native code
|
jni/ - directory holding native code
|
||||||
jni/Application.mk - Application JNI settings, including target platform and STL library
|
jni/Application.mk - Application JNI settings, including target platform and STL library
|
||||||
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
|
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
|
||||||
jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject
|
jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject
|
||||||
jni/SDL/ - (symlink to) directory holding the SDL library files
|
jni/SDL/ - (symlink to) directory holding the SDL library files
|
||||||
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
||||||
jni/src/ - directory holding your C/C++ source
|
jni/src/ - directory holding your C/C++ source
|
||||||
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
|
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
|
||||||
jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references
|
jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references
|
||||||
src/main/assets/ - directory holding asset files for your application
|
src/main/assets/ - directory holding asset files for your application
|
||||||
src/main/res/ - directory holding resources for your application
|
src/main/res/ - directory holding resources for your application
|
||||||
src/main/res/mipmap-* - directories holding icons for different phone hardware
|
src/main/res/mipmap-* - directories holding icons for different phone hardware
|
||||||
src/main/res/values/strings.xml - strings used in your application, including the application name
|
src/main/res/values/strings.xml - strings used in your application, including the application name
|
||||||
src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.
|
src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.
|
||||||
|
|
||||||
|
|
||||||
Customizing your application name
|
Customizing your application name
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
To customize your application name, edit AndroidManifest.xml and replace
|
To customize your application name, edit AndroidManifest.xml and replace
|
||||||
"org.libsdl.app" with an identifier for your product package.
|
"org.libsdl.app" with an identifier for your product package.
|
||||||
|
|
||||||
Then create a Java class extending SDLActivity and place it in a directory
|
Then create a Java class extending SDLActivity and place it in a directory
|
||||||
under src matching your package, e.g.
|
under src matching your package, e.g.
|
||||||
|
|
||||||
src/com/gamemaker/game/MyGame.java
|
src/com/gamemaker/game/MyGame.java
|
||||||
|
|
||||||
Here's an example of a minimal class file:
|
Here's an example of a minimal class file:
|
||||||
|
|
||||||
--- MyGame.java --------------------------
|
--- MyGame.java --------------------------
|
||||||
package com.gamemaker.game;
|
package com.gamemaker.game;
|
||||||
|
|
||||||
import org.libsdl.app.SDLActivity;
|
import org.libsdl.app.SDLActivity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sample wrapper class that just calls SDLActivity
|
* A sample wrapper class that just calls SDLActivity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MyGame extends SDLActivity { }
|
public class MyGame extends SDLActivity { }
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
|
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
|
||||||
class, .e.g. "MyGame"
|
class, .e.g. "MyGame"
|
||||||
|
|
||||||
|
|
||||||
Customizing your application icon
|
Customizing your application icon
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Conceptually changing your icon is just replacing the "ic_launcher.png" files in
|
Conceptually changing your icon is just replacing the "ic_launcher.png" files in
|
||||||
the drawable directories under the res directory. There are several directories
|
the drawable directories under the res directory. There are several directories
|
||||||
for different screen sizes.
|
for different screen sizes.
|
||||||
|
|
||||||
|
|
||||||
Loading assets
|
Loading assets
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Any files you put in the "app/src/main/assets" directory of your project
|
Any files you put in the "app/src/main/assets" directory of your project
|
||||||
directory will get bundled into the application package and you can load
|
directory will get bundled into the application package and you can load
|
||||||
them using the standard functions in SDL_rwops.h.
|
them using the standard functions in SDL_rwops.h.
|
||||||
|
|
||||||
There are also a few Android specific functions that allow you to get other
|
There are also a few Android specific functions that allow you to get other
|
||||||
useful paths for saving and loading data:
|
useful paths for saving and loading data:
|
||||||
* SDL_AndroidGetInternalStoragePath()
|
* SDL_AndroidGetInternalStoragePath()
|
||||||
* SDL_AndroidGetExternalStorageState()
|
* SDL_AndroidGetExternalStorageState()
|
||||||
* SDL_AndroidGetExternalStoragePath()
|
* SDL_AndroidGetExternalStoragePath()
|
||||||
|
|
||||||
See SDL_system.h for more details on these functions.
|
See SDL_system.h for more details on these functions.
|
||||||
|
|
||||||
The asset packaging system will, by default, compress certain file extensions.
|
The asset packaging system will, by default, compress certain file extensions.
|
||||||
SDL includes two asset file access mechanisms, the preferred one is the so
|
SDL includes two asset file access mechanisms, the preferred one is the so
|
||||||
called "File Descriptor" method, which is faster and doesn't involve the Dalvik
|
called "File Descriptor" method, which is faster and doesn't involve the Dalvik
|
||||||
GC, but given this method does not work on compressed assets, there is also the
|
GC, but given this method does not work on compressed assets, there is also the
|
||||||
"Input Stream" method, which is automatically used as a fall back by SDL. You
|
"Input Stream" method, which is automatically used as a fall back by SDL. You
|
||||||
may want to keep this fact in mind when building your APK, specially when large
|
may want to keep this fact in mind when building your APK, specially when large
|
||||||
files are involved.
|
files are involved.
|
||||||
For more information on which extensions get compressed by default and how to
|
For more information on which extensions get compressed by default and how to
|
||||||
disable this behaviour, see for example:
|
disable this behaviour, see for example:
|
||||||
|
|
||||||
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
|
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
|
||||||
|
|
||||||
|
|
||||||
Pause / Resume behaviour
|
Pause / Resume behaviour
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
|
If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
|
||||||
the event loop will block itself when the app is paused (ie, when the user
|
the event loop will block itself when the app is paused (ie, when the user
|
||||||
returns to the main Android dashboard). Blocking is better in terms of battery
|
returns to the main Android dashboard). Blocking is better in terms of battery
|
||||||
use, and it allows your app to spring back to life instantaneously after resume
|
use, and it allows your app to spring back to life instantaneously after resume
|
||||||
(versus polling for a resume message).
|
(versus polling for a resume message).
|
||||||
|
|
||||||
Upon resume, SDL will attempt to restore the GL context automatically.
|
Upon resume, SDL will attempt to restore the GL context automatically.
|
||||||
In modern devices (Android 3.0 and up) this will most likely succeed and your
|
In modern devices (Android 3.0 and up) this will most likely succeed and your
|
||||||
app can continue to operate as it was.
|
app can continue to operate as it was.
|
||||||
|
|
||||||
However, there's a chance (on older hardware, or on systems under heavy load),
|
However, there's a chance (on older hardware, or on systems under heavy load),
|
||||||
where the GL context can not be restored. In that case you have to listen for
|
where the GL context can not be restored. In that case you have to listen for
|
||||||
a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
|
a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
|
||||||
manually or quit the app.
|
manually or quit the app.
|
||||||
|
|
||||||
You should not use the SDL renderer API while the app going in background:
|
You should not use the SDL renderer API while the app going in background:
|
||||||
- SDL_APP_WILLENTERBACKGROUND:
|
- SDL_APP_WILLENTERBACKGROUND:
|
||||||
after you read this message, GL context gets backed-up and you should not
|
after you read this message, GL context gets backed-up and you should not
|
||||||
use the SDL renderer API.
|
use the SDL renderer API.
|
||||||
|
|
||||||
When this event is received, you have to set the render target to NULL, if you're using it.
|
When this event is received, you have to set the render target to NULL, if you're using it.
|
||||||
(eg call SDL_SetRenderTarget(renderer, NULL))
|
(eg call SDL_SetRenderTarget(renderer, NULL))
|
||||||
|
|
||||||
- SDL_APP_DIDENTERFOREGROUND:
|
- SDL_APP_DIDENTERFOREGROUND:
|
||||||
GL context is restored, and the SDL renderer API is available (unless you
|
GL context is restored, and the SDL renderer API is available (unless you
|
||||||
receive SDL_RENDER_DEVICE_RESET).
|
receive SDL_RENDER_DEVICE_RESET).
|
||||||
|
|
||||||
Mouse / Touch events
|
Mouse / Touch events
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
In some case, SDL generates synthetic mouse (resp. touch) events for touch
|
In some case, SDL generates synthetic mouse (resp. touch) events for touch
|
||||||
(resp. mouse) devices.
|
(resp. mouse) devices.
|
||||||
To enable/disable this behavior, see SDL_hints.h:
|
To enable/disable this behavior, see SDL_hints.h:
|
||||||
- SDL_HINT_TOUCH_MOUSE_EVENTS
|
- SDL_HINT_TOUCH_MOUSE_EVENTS
|
||||||
- SDL_HINT_MOUSE_TOUCH_EVENTS
|
- SDL_HINT_MOUSE_TOUCH_EVENTS
|
||||||
|
|
||||||
Misc
|
Misc
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
For some device, it appears to works better setting explicitly GL attributes
|
For some device, it appears to works better setting explicitly GL attributes
|
||||||
before creating a window:
|
before creating a window:
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||||
|
|
||||||
Threads and the Java VM
|
Threads and the Java VM
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
For a quick tour on how Linux native threads interoperate with the Java VM, take
|
For a quick tour on how Linux native threads interoperate with the Java VM, take
|
||||||
a look here: https://developer.android.com/guide/practices/jni.html
|
a look here: https://developer.android.com/guide/practices/jni.html
|
||||||
|
|
||||||
If you want to use threads in your SDL app, it's strongly recommended that you
|
If you want to use threads in your SDL app, it's strongly recommended that you
|
||||||
do so by creating them using SDL functions. This way, the required attach/detach
|
do so by creating them using SDL functions. This way, the required attach/detach
|
||||||
handling is managed by SDL automagically. If you have threads created by other
|
handling is managed by SDL automagically. If you have threads created by other
|
||||||
means and they make calls to SDL functions, make sure that you call
|
means and they make calls to SDL functions, make sure that you call
|
||||||
Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
|
Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
|
||||||
your thread automatically anyway (when you make an SDL call), but it'll never
|
your thread automatically anyway (when you make an SDL call), but it'll never
|
||||||
detach it.
|
detach it.
|
||||||
|
|
||||||
|
|
||||||
If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"),
|
If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"),
|
||||||
it won't be able to find your java class and method because of the java class loader
|
it won't be able to find your java class and method because of the java class loader
|
||||||
which is different for native threads, than for java threads (eg your "main()").
|
which is different for native threads, than for java threads (eg your "main()").
|
||||||
|
|
||||||
the work-around is to find class/method, in you "main()" thread, and to use them
|
the work-around is to find class/method, in you "main()" thread, and to use them
|
||||||
in your native thread.
|
in your native thread.
|
||||||
|
|
||||||
see:
|
see:
|
||||||
https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
|
https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
|
||||||
|
|
||||||
Using STL
|
Using STL
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
You can use STL in your project by creating an Application.mk file in the jni
|
You can use STL in your project by creating an Application.mk file in the jni
|
||||||
folder and adding the following line:
|
folder and adding the following line:
|
||||||
|
|
||||||
APP_STL := c++_shared
|
APP_STL := c++_shared
|
||||||
|
|
||||||
For more information go here:
|
For more information go here:
|
||||||
https://developer.android.com/ndk/guides/cpp-support
|
https://developer.android.com/ndk/guides/cpp-support
|
||||||
|
|
||||||
|
|
||||||
Using the emulator
|
Using the emulator
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
There are some good tips and tricks for getting the most out of the
|
There are some good tips and tricks for getting the most out of the
|
||||||
emulator here: https://developer.android.com/tools/devices/emulator.html
|
emulator here: https://developer.android.com/tools/devices/emulator.html
|
||||||
|
|
||||||
Especially useful is the info on setting up OpenGL ES 2.0 emulation.
|
Especially useful is the info on setting up OpenGL ES 2.0 emulation.
|
||||||
|
|
||||||
Notice that this software emulator is incredibly slow and needs a lot of disk space.
|
Notice that this software emulator is incredibly slow and needs a lot of disk space.
|
||||||
Using a real device works better.
|
Using a real device works better.
|
||||||
|
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
You can see if adb can see any devices with the following command:
|
You can see if adb can see any devices with the following command:
|
||||||
|
|
||||||
adb devices
|
adb devices
|
||||||
|
|
||||||
You can see the output of log messages on the default device with:
|
You can see the output of log messages on the default device with:
|
||||||
|
|
||||||
adb logcat
|
adb logcat
|
||||||
|
|
||||||
You can push files to the device with:
|
You can push files to the device with:
|
||||||
|
|
||||||
adb push local_file remote_path_and_file
|
adb push local_file remote_path_and_file
|
||||||
|
|
||||||
You can push files to the SD Card at /sdcard, for example:
|
You can push files to the SD Card at /sdcard, for example:
|
||||||
|
|
||||||
adb push moose.dat /sdcard/moose.dat
|
adb push moose.dat /sdcard/moose.dat
|
||||||
|
|
||||||
You can see the files on the SD card with a shell command:
|
You can see the files on the SD card with a shell command:
|
||||||
|
|
||||||
adb shell ls /sdcard/
|
adb shell ls /sdcard/
|
||||||
|
|
||||||
You can start a command shell on the default device with:
|
You can start a command shell on the default device with:
|
||||||
|
|
||||||
adb shell
|
adb shell
|
||||||
|
|
||||||
You can remove the library files of your project (and not the SDL lib files) with:
|
You can remove the library files of your project (and not the SDL lib files) with:
|
||||||
|
|
||||||
ndk-build clean
|
ndk-build clean
|
||||||
|
|
||||||
You can do a build with the following command:
|
You can do a build with the following command:
|
||||||
|
|
||||||
ndk-build
|
ndk-build
|
||||||
|
|
||||||
You can see the complete command line that ndk-build is using by passing V=1 on the command line:
|
You can see the complete command line that ndk-build is using by passing V=1 on the command line:
|
||||||
|
|
||||||
ndk-build V=1
|
ndk-build V=1
|
||||||
|
|
||||||
If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
|
If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
|
||||||
https://developer.android.com/ndk/guides/ndk-stack
|
https://developer.android.com/ndk/guides/ndk-stack
|
||||||
|
|
||||||
If you want to go through the process manually, you can use addr2line to convert the
|
If you want to go through the process manually, you can use addr2line to convert the
|
||||||
addresses in the stack trace to lines in your code.
|
addresses in the stack trace to lines in your code.
|
||||||
|
|
||||||
For example, if your crash looks like this:
|
For example, if your crash looks like this:
|
||||||
|
|
||||||
I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
|
I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
|
||||||
I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
|
I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
|
||||||
I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
|
I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
|
||||||
I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
|
I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
|
||||||
I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
|
I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
|
||||||
I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
|
I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
|
||||||
I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
|
I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
|
||||||
I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
|
I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
|
||||||
I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
|
I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
|
||||||
|
|
||||||
You can see that there's a crash in the C library being called from the main code.
|
You can see that there's a crash in the C library being called from the main code.
|
||||||
I run addr2line with the debug version of my code:
|
I run addr2line with the debug version of my code:
|
||||||
|
|
||||||
arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
|
arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
|
||||||
|
|
||||||
and then paste in the number after "pc" in the call stack, from the line that I care about:
|
and then paste in the number after "pc" in the call stack, from the line that I care about:
|
||||||
000014bc
|
000014bc
|
||||||
|
|
||||||
I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
|
I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
|
||||||
|
|
||||||
You can add logging to your code to help show what's happening:
|
You can add logging to your code to help show what's happening:
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
|
__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
|
||||||
|
|
||||||
If you need to build without optimization turned on, you can create a file called
|
If you need to build without optimization turned on, you can create a file called
|
||||||
"Application.mk" in the jni directory, with the following line in it:
|
"Application.mk" in the jni directory, with the following line in it:
|
||||||
|
|
||||||
APP_OPTIM := debug
|
APP_OPTIM := debug
|
||||||
|
|
||||||
|
|
||||||
Memory debugging
|
Memory debugging
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
The best (and slowest) way to debug memory issues on Android is valgrind.
|
The best (and slowest) way to debug memory issues on Android is valgrind.
|
||||||
Valgrind has support for Android out of the box, just grab code using:
|
Valgrind has support for Android out of the box, just grab code using:
|
||||||
|
|
||||||
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
|
svn co svn://svn.valgrind.org/valgrind/trunk valgrind
|
||||||
|
|
||||||
... and follow the instructions in the file README.android to build it.
|
... and follow the instructions in the file README.android to build it.
|
||||||
|
|
||||||
One thing I needed to do on Mac OS X was change the path to the toolchain,
|
One thing I needed to do on Mac OS X was change the path to the toolchain,
|
||||||
and add ranlib to the environment variables:
|
and add ranlib to the environment variables:
|
||||||
export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
|
export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
|
||||||
|
|
||||||
Once valgrind is built, you can create a wrapper script to launch your
|
Once valgrind is built, you can create a wrapper script to launch your
|
||||||
application with it, changing org.libsdl.app to your package identifier:
|
application with it, changing org.libsdl.app to your package identifier:
|
||||||
|
|
||||||
--- start_valgrind_app -------------------
|
--- start_valgrind_app -------------------
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
export TMPDIR=/data/data/org.libsdl.app
|
export TMPDIR=/data/data/org.libsdl.app
|
||||||
exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
|
exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
Then push it to the device:
|
Then push it to the device:
|
||||||
|
|
||||||
adb push start_valgrind_app /data/local
|
adb push start_valgrind_app /data/local
|
||||||
|
|
||||||
and make it executable:
|
and make it executable:
|
||||||
|
|
||||||
adb shell chmod 755 /data/local/start_valgrind_app
|
adb shell chmod 755 /data/local/start_valgrind_app
|
||||||
|
|
||||||
and tell Android to use the script to launch your application:
|
and tell Android to use the script to launch your application:
|
||||||
|
|
||||||
adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
|
adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
|
||||||
|
|
||||||
If the setprop command says "could not set property", it's likely that
|
If the setprop command says "could not set property", it's likely that
|
||||||
your package name is too long and you should make it shorter by changing
|
your package name is too long and you should make it shorter by changing
|
||||||
AndroidManifest.xml and the path to your class file in android-project/src
|
AndroidManifest.xml and the path to your class file in android-project/src
|
||||||
|
|
||||||
You can then launch your application normally and waaaaaaaiiittt for it.
|
You can then launch your application normally and waaaaaaaiiittt for it.
|
||||||
You can monitor the startup process with the logcat command above, and
|
You can monitor the startup process with the logcat command above, and
|
||||||
when it's done (or even while it's running) you can grab the valgrind
|
when it's done (or even while it's running) you can grab the valgrind
|
||||||
output file:
|
output file:
|
||||||
|
|
||||||
adb pull /sdcard/valgrind.log
|
adb pull /sdcard/valgrind.log
|
||||||
|
|
||||||
When you're done instrumenting with valgrind, you can disable the wrapper:
|
When you're done instrumenting with valgrind, you can disable the wrapper:
|
||||||
|
|
||||||
adb shell setprop wrap.org.libsdl.app ""
|
adb shell setprop wrap.org.libsdl.app ""
|
||||||
|
|
||||||
|
|
||||||
Graphics debugging
|
Graphics debugging
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
If you are developing on a compatible Tegra-based tablet, NVidia provides
|
If you are developing on a compatible Tegra-based tablet, NVidia provides
|
||||||
Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL
|
Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL
|
||||||
and GLES libraries, you must follow their instructions for installing the
|
and GLES libraries, you must follow their instructions for installing the
|
||||||
interposer library on a rooted device. The non-rooted instructions are not
|
interposer library on a rooted device. The non-rooted instructions are not
|
||||||
compatible with applications that use SDL2 for video.
|
compatible with applications that use SDL2 for video.
|
||||||
|
|
||||||
The Tegra Graphics Debugger is available from NVidia here:
|
The Tegra Graphics Debugger is available from NVidia here:
|
||||||
https://developer.nvidia.com/tegra-graphics-debugger
|
https://developer.nvidia.com/tegra-graphics-debugger
|
||||||
|
|
||||||
|
|
||||||
Why is API level 19 the minimum required?
|
Why is API level 19 the minimum required?
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
The latest NDK toolchain doesn't support targeting earlier than API level 19.
|
The latest NDK toolchain doesn't support targeting earlier than API level 19.
|
||||||
As of this writing, according to https://www.composables.com/tools/distribution-chart
|
As of this writing, according to https://www.composables.com/tools/distribution-chart
|
||||||
about 99.7% of the Android devices accessing Google Play support API level 19 or
|
about 99.7% of the Android devices accessing Google Play support API level 19 or
|
||||||
higher (August 2023).
|
higher (August 2023).
|
||||||
|
|
||||||
|
|
||||||
A note regarding the use of the "dirty rectangles" rendering technique
|
A note regarding the use of the "dirty rectangles" rendering technique
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
If your app uses a variation of the "dirty rectangles" rendering technique,
|
If your app uses a variation of the "dirty rectangles" rendering technique,
|
||||||
where you only update a portion of the screen on each frame, you may notice a
|
where you only update a portion of the screen on each frame, you may notice a
|
||||||
variety of visual glitches on Android, that are not present on other platforms.
|
variety of visual glitches on Android, that are not present on other platforms.
|
||||||
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
|
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
|
||||||
contexts, in particular the use of the eglSwapBuffers function. As stated in the
|
contexts, in particular the use of the eglSwapBuffers function. As stated in the
|
||||||
documentation for the function "The contents of ancillary buffers are always
|
documentation for the function "The contents of ancillary buffers are always
|
||||||
undefined after calling eglSwapBuffers".
|
undefined after calling eglSwapBuffers".
|
||||||
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
|
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
|
||||||
is not possible for SDL as it requires EGL 1.4, available only on the API level
|
is not possible for SDL as it requires EGL 1.4, available only on the API level
|
||||||
17+, so the only workaround available on this platform is to redraw the entire
|
17+, so the only workaround available on this platform is to redraw the entire
|
||||||
screen each frame.
|
screen each frame.
|
||||||
|
|
||||||
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
|
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
|
||||||
|
|
||||||
|
|
||||||
Ending your application
|
Ending your application
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Two legitimate ways:
|
Two legitimate ways:
|
||||||
|
|
||||||
- return from your main() function. Java side will automatically terminate the
|
- return from your main() function. Java side will automatically terminate the
|
||||||
Activity by calling Activity.finish().
|
Activity by calling Activity.finish().
|
||||||
|
|
||||||
- Android OS can decide to terminate your application by calling onDestroy()
|
- Android OS can decide to terminate your application by calling onDestroy()
|
||||||
(see Activity life cycle). Your application will receive a SDL_QUIT event you
|
(see Activity life cycle). Your application will receive a SDL_QUIT event you
|
||||||
can handle to save things and quit.
|
can handle to save things and quit.
|
||||||
|
|
||||||
Don't call exit() as it stops the activity badly.
|
Don't call exit() as it stops the activity badly.
|
||||||
|
|
||||||
NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
|
NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
|
||||||
SDLK_AC_BACK, for any purpose.
|
SDLK_AC_BACK, for any purpose.
|
||||||
|
|
||||||
Known issues
|
Known issues
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
- The number of buttons reported for each joystick is hardcoded to be 36, which
|
- The number of buttons reported for each joystick is hardcoded to be 36, which
|
||||||
is the current maximum number of buttons Android can report.
|
is the current maximum number of buttons Android can report.
|
||||||
|
|
@ -1,163 +1,163 @@
|
|||||||
# CMake
|
# CMake
|
||||||
|
|
||||||
(www.cmake.org)
|
(www.cmake.org)
|
||||||
|
|
||||||
SDL's build system was traditionally based on autotools. Over time, this
|
SDL's build system was traditionally based on autotools. Over time, this
|
||||||
approach has suffered from several issues across the different supported
|
approach has suffered from several issues across the different supported
|
||||||
platforms.
|
platforms.
|
||||||
To solve these problems, a new build system based on CMake was introduced.
|
To solve these problems, a new build system based on CMake was introduced.
|
||||||
It is developed in parallel to the legacy autotools build system, so users
|
It is developed in parallel to the legacy autotools build system, so users
|
||||||
can experiment with it without complication.
|
can experiment with it without complication.
|
||||||
|
|
||||||
The CMake build system is supported on the following platforms:
|
The CMake build system is supported on the following platforms:
|
||||||
|
|
||||||
* FreeBSD
|
* FreeBSD
|
||||||
* Linux
|
* Linux
|
||||||
* Microsoft Visual C
|
* Microsoft Visual C
|
||||||
* MinGW and Msys
|
* MinGW and Msys
|
||||||
* macOS, iOS, and tvOS, with support for XCode
|
* macOS, iOS, and tvOS, with support for XCode
|
||||||
* Android
|
* Android
|
||||||
* Emscripten
|
* Emscripten
|
||||||
* RiscOS
|
* RiscOS
|
||||||
* Playstation Vita
|
* Playstation Vita
|
||||||
|
|
||||||
## Building SDL
|
## Building SDL
|
||||||
|
|
||||||
Assuming the source for SDL is located at `~/sdl`
|
Assuming the source for SDL is located at `~/sdl`
|
||||||
```sh
|
```sh
|
||||||
cd ~
|
cd ~
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ~/sdl
|
cmake ~/sdl
|
||||||
cmake --build .
|
cmake --build .
|
||||||
```
|
```
|
||||||
|
|
||||||
This will build the static and dynamic versions of SDL in the `~/build` directory.
|
This will build the static and dynamic versions of SDL in the `~/build` directory.
|
||||||
Installation can be done using:
|
Installation can be done using:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cmake --install . # '--install' requires CMake 3.15, or newer
|
cmake --install . # '--install' requires CMake 3.15, or newer
|
||||||
```
|
```
|
||||||
|
|
||||||
## Including SDL in your project
|
## Including SDL in your project
|
||||||
|
|
||||||
SDL can be included in your project in 2 major ways:
|
SDL can be included in your project in 2 major ways:
|
||||||
- using a system SDL library, provided by your (*nix) distribution or a package manager
|
- using a system SDL library, provided by your (*nix) distribution or a package manager
|
||||||
- using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
|
- using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
|
||||||
|
|
||||||
The following CMake script supports both, depending on the value of `MYGAME_VENDORED`.
|
The following CMake script supports both, depending on the value of `MYGAME_VENDORED`.
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(mygame)
|
project(mygame)
|
||||||
|
|
||||||
# Create an option to switch between a system sdl library and a vendored sdl library
|
# Create an option to switch between a system sdl library and a vendored sdl library
|
||||||
option(MYGAME_VENDORED "Use vendored libraries" OFF)
|
option(MYGAME_VENDORED "Use vendored libraries" OFF)
|
||||||
|
|
||||||
if(MYGAME_VENDORED)
|
if(MYGAME_VENDORED)
|
||||||
add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
|
add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
|
||||||
else()
|
else()
|
||||||
# 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
|
# 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
|
||||||
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
|
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
|
||||||
|
|
||||||
# 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
|
# 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
|
||||||
find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
|
find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create your game executable target as usual
|
# Create your game executable target as usual
|
||||||
add_executable(mygame WIN32 mygame.c)
|
add_executable(mygame WIN32 mygame.c)
|
||||||
|
|
||||||
# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
|
# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
|
||||||
if(TARGET SDL2::SDL2main)
|
if(TARGET SDL2::SDL2main)
|
||||||
# It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
|
# It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
|
||||||
target_link_libraries(mygame PRIVATE SDL2::SDL2main)
|
target_link_libraries(mygame PRIVATE SDL2::SDL2main)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary.
|
# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary.
|
||||||
target_link_libraries(mygame PRIVATE SDL2::SDL2)
|
target_link_libraries(mygame PRIVATE SDL2::SDL2)
|
||||||
```
|
```
|
||||||
|
|
||||||
### A system SDL library
|
### A system SDL library
|
||||||
|
|
||||||
For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure).
|
For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure).
|
||||||
|
|
||||||
The following components are available, to be used as an argument of `find_package`.
|
The following components are available, to be used as an argument of `find_package`.
|
||||||
|
|
||||||
| Component name | Description |
|
| Component name | Description |
|
||||||
|----------------|--------------------------------------------------------------------------------------------|
|
|----------------|--------------------------------------------------------------------------------------------|
|
||||||
| SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] |
|
| SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] |
|
||||||
| SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target |
|
| SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target |
|
||||||
| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target |
|
| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target |
|
||||||
| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target |
|
| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target |
|
||||||
|
|
||||||
### Using a vendored SDL
|
### Using a vendored SDL
|
||||||
|
|
||||||
This only requires a copy of SDL in a subdirectory.
|
This only requires a copy of SDL in a subdirectory.
|
||||||
|
|
||||||
## CMake configuration options for platforms
|
## CMake configuration options for platforms
|
||||||
|
|
||||||
### iOS/tvOS
|
### iOS/tvOS
|
||||||
|
|
||||||
CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
|
CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
|
||||||
using Xcode or Make, possibly among other build-systems.
|
using Xcode or Make, possibly among other build-systems.
|
||||||
|
|
||||||
When using a recent version of CMake (3.14+), it should be possible to:
|
When using a recent version of CMake (3.14+), it should be possible to:
|
||||||
|
|
||||||
- build SDL for iOS, both static and dynamic
|
- build SDL for iOS, both static and dynamic
|
||||||
- build SDL test apps (as iOS/tvOS .app bundles)
|
- build SDL test apps (as iOS/tvOS .app bundles)
|
||||||
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
|
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
|
||||||
|
|
||||||
To use, set the following CMake variables when running CMake's configuration stage:
|
To use, set the following CMake variables when running CMake's configuration stage:
|
||||||
|
|
||||||
- `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
|
- `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
|
||||||
- `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
|
- `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
|
||||||
`appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
|
`appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
|
||||||
- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
|
- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
|
||||||
|
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
- for iOS-Simulator, using the latest, installed SDK:
|
- for iOS-Simulator, using the latest, installed SDK:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||||
```
|
```
|
||||||
|
|
||||||
- for iOS-Device, using the latest, installed SDK, 64-bit only
|
- for iOS-Device, using the latest, installed SDK, 64-bit only
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64
|
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64
|
||||||
```
|
```
|
||||||
|
|
||||||
- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
|
- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"
|
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"
|
||||||
```
|
```
|
||||||
|
|
||||||
- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
|
- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64
|
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64
|
||||||
```
|
```
|
||||||
|
|
||||||
- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
|
- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||||
```
|
```
|
||||||
|
|
||||||
- for tvOS-Simulator, using the latest, installed SDK:
|
- for tvOS-Simulator, using the latest, installed SDK:
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||||
```
|
```
|
||||||
|
|
||||||
- for tvOS-Device, using the latest, installed SDK:
|
- for tvOS-Device, using the latest, installed SDK:
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
|
cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons.
|
[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons.
|
@ -1,123 +1,123 @@
|
|||||||
DirectFB
|
DirectFB
|
||||||
========
|
========
|
||||||
|
|
||||||
Supports:
|
Supports:
|
||||||
|
|
||||||
- Hardware YUV overlays
|
- Hardware YUV overlays
|
||||||
- OpenGL - software only
|
- OpenGL - software only
|
||||||
- 2D/3D accelerations (depends on directfb driver)
|
- 2D/3D accelerations (depends on directfb driver)
|
||||||
- multiple displays
|
- multiple displays
|
||||||
- windows
|
- windows
|
||||||
|
|
||||||
What you need:
|
What you need:
|
||||||
|
|
||||||
* DirectFB 1.0.1, 1.2.x, 1.3.0
|
* DirectFB 1.0.1, 1.2.x, 1.3.0
|
||||||
* Kernel-Framebuffer support: required: vesafb, radeonfb ....
|
* Kernel-Framebuffer support: required: vesafb, radeonfb ....
|
||||||
* Mesa 7.0.x - optional for OpenGL
|
* Mesa 7.0.x - optional for OpenGL
|
||||||
|
|
||||||
The `/etc/directfbrc` file should contain the following lines to make
|
The `/etc/directfbrc` file should contain the following lines to make
|
||||||
your joystick work and avoid crashes:
|
your joystick work and avoid crashes:
|
||||||
|
|
||||||
```
|
```
|
||||||
disable-module=joystick
|
disable-module=joystick
|
||||||
disable-module=cle266
|
disable-module=cle266
|
||||||
disable-module=cyber5k
|
disable-module=cyber5k
|
||||||
no-linux-input-grab
|
no-linux-input-grab
|
||||||
```
|
```
|
||||||
|
|
||||||
To disable to use x11 backend when DISPLAY variable is found use
|
To disable to use x11 backend when DISPLAY variable is found use
|
||||||
|
|
||||||
```
|
```
|
||||||
export SDL_DIRECTFB_X11_CHECK=0
|
export SDL_DIRECTFB_X11_CHECK=0
|
||||||
```
|
```
|
||||||
|
|
||||||
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
|
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
|
||||||
use
|
use
|
||||||
|
|
||||||
```
|
```
|
||||||
export SDL_DIRECTFB_LINUX_INPUT=0
|
export SDL_DIRECTFB_LINUX_INPUT=0
|
||||||
```
|
```
|
||||||
|
|
||||||
To use hardware accelerated YUV-overlays for YUV-textures, use:
|
To use hardware accelerated YUV-overlays for YUV-textures, use:
|
||||||
|
|
||||||
```
|
```
|
||||||
export SDL_DIRECTFB_YUV_DIRECT=1
|
export SDL_DIRECTFB_YUV_DIRECT=1
|
||||||
```
|
```
|
||||||
|
|
||||||
This is disabled by default. It will only support one
|
This is disabled by default. It will only support one
|
||||||
YUV texture, namely the first. Every other YUV texture will be
|
YUV texture, namely the first. Every other YUV texture will be
|
||||||
rendered in software.
|
rendered in software.
|
||||||
|
|
||||||
In addition, you may use (directfb-1.2.x)
|
In addition, you may use (directfb-1.2.x)
|
||||||
|
|
||||||
```
|
```
|
||||||
export SDL_DIRECTFB_YUV_UNDERLAY=1
|
export SDL_DIRECTFB_YUV_UNDERLAY=1
|
||||||
```
|
```
|
||||||
|
|
||||||
to make the YUV texture an underlay. This will make the cursor to
|
to make the YUV texture an underlay. This will make the cursor to
|
||||||
be shown.
|
be shown.
|
||||||
|
|
||||||
Simple Window Manager
|
Simple Window Manager
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
The driver has support for a very, very basic window manager you may
|
The driver has support for a very, very basic window manager you may
|
||||||
want to use when running with `wm=default`. Use
|
want to use when running with `wm=default`. Use
|
||||||
|
|
||||||
```
|
```
|
||||||
export SDL_DIRECTFB_WM=1
|
export SDL_DIRECTFB_WM=1
|
||||||
```
|
```
|
||||||
|
|
||||||
to enable basic window borders. In order to have the window title rendered,
|
to enable basic window borders. In order to have the window title rendered,
|
||||||
you need to have the following font installed:
|
you need to have the following font installed:
|
||||||
|
|
||||||
```
|
```
|
||||||
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
/usr/share/fonts/truetype/freefont/FreeSans.ttf
|
||||||
```
|
```
|
||||||
|
|
||||||
OpenGL Support
|
OpenGL Support
|
||||||
==============
|
==============
|
||||||
|
|
||||||
The following instructions will give you *software* OpenGL. However this
|
The following instructions will give you *software* OpenGL. However this
|
||||||
works at least on all directfb supported platforms.
|
works at least on all directfb supported platforms.
|
||||||
|
|
||||||
As of this writing 20100802 you need to pull Mesa from git and do the following:
|
As of this writing 20100802 you need to pull Mesa from git and do the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone git://anongit.freedesktop.org/git/mesa/mesa
|
git clone git://anongit.freedesktop.org/git/mesa/mesa
|
||||||
cd mesa
|
cd mesa
|
||||||
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
|
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
|
||||||
```
|
```
|
||||||
|
|
||||||
Edit `configs/linux-directfb` so that the Directories-section looks like this:
|
Edit `configs/linux-directfb` so that the Directories-section looks like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
# Directories
|
# Directories
|
||||||
SRC_DIRS = mesa glu
|
SRC_DIRS = mesa glu
|
||||||
GLU_DIRS = sgi
|
GLU_DIRS = sgi
|
||||||
DRIVER_DIRS = directfb
|
DRIVER_DIRS = directfb
|
||||||
PROGRAM_DIRS =
|
PROGRAM_DIRS =
|
||||||
```
|
```
|
||||||
|
|
||||||
Then do the following:
|
Then do the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
make linux-directfb
|
make linux-directfb
|
||||||
make
|
make
|
||||||
|
|
||||||
echo Installing - please enter sudo pw.
|
echo Installing - please enter sudo pw.
|
||||||
|
|
||||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||||
cd src/mesa/drivers/directfb
|
cd src/mesa/drivers/directfb
|
||||||
make
|
make
|
||||||
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
sudo make install INSTALL_DIR=/usr/local/dfb_GL
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the SDL - testprograms:
|
To run the SDL - testprograms:
|
||||||
|
|
||||||
```
|
```
|
||||||
export SDL_VIDEODRIVER=directfb
|
export SDL_VIDEODRIVER=directfb
|
||||||
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
|
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
|
||||||
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
|
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
|
||||||
|
|
||||||
./testgl
|
./testgl
|
||||||
```
|
```
|
@ -1,138 +1,138 @@
|
|||||||
# Dynamic API
|
# Dynamic API
|
||||||
|
|
||||||
Originally posted on Ryan's Google+ account.
|
Originally posted on Ryan's Google+ account.
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
|
|
||||||
- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
|
- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
|
||||||
but developers are shipping their own SDL2 with individual Steam games.
|
but developers are shipping their own SDL2 with individual Steam games.
|
||||||
These games might stop getting updates, but a newer SDL2 might be needed later.
|
These games might stop getting updates, but a newer SDL2 might be needed later.
|
||||||
Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
|
Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
|
||||||
ever needed, and these fixes won't make it to a game shipping its own SDL.
|
ever needed, and these fixes won't make it to a game shipping its own SDL.
|
||||||
- Even if we replace the SDL2 in those games with a compatible one, that is to
|
- Even if we replace the SDL2 in those games with a compatible one, that is to
|
||||||
say, edit a developer's Steam depot (yuck!), there are developers that are
|
say, edit a developer's Steam depot (yuck!), there are developers that are
|
||||||
statically linking SDL2 that we can't do this for. We can't even force the
|
statically linking SDL2 that we can't do this for. We can't even force the
|
||||||
dynamic loader to ignore their SDL2 in this case, of course.
|
dynamic loader to ignore their SDL2 in this case, of course.
|
||||||
- If you don't ship an SDL2 with the game in some form, people that disabled the
|
- If you don't ship an SDL2 with the game in some form, people that disabled the
|
||||||
Steam Runtime, or just tried to run the game from the command line instead of
|
Steam Runtime, or just tried to run the game from the command line instead of
|
||||||
Steam might find themselves unable to run the game, due to a missing dependency.
|
Steam might find themselves unable to run the game, due to a missing dependency.
|
||||||
- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
|
- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
|
||||||
generic Linux boxes that may or may not have SDL2 installed, you have to ship
|
generic Linux boxes that may or may not have SDL2 installed, you have to ship
|
||||||
the library or risk a total failure to launch. So now, you might have to have
|
the library or risk a total failure to launch. So now, you might have to have
|
||||||
a non-Steam build plus a Steam build (that is, one with and one without SDL2
|
a non-Steam build plus a Steam build (that is, one with and one without SDL2
|
||||||
included), which is inconvenient if you could have had one universal build
|
included), which is inconvenient if you could have had one universal build
|
||||||
that works everywhere.
|
that works everywhere.
|
||||||
- We like the zlib license, but the biggest complaint from the open source
|
- We like the zlib license, but the biggest complaint from the open source
|
||||||
community about the license change is the static linking. The LGPL forced this
|
community about the license change is the static linking. The LGPL forced this
|
||||||
as a legal, not technical issue, but zlib doesn't care. Even those that aren't
|
as a legal, not technical issue, but zlib doesn't care. Even those that aren't
|
||||||
concerned about the GNU freedoms found themselves solving the same problems:
|
concerned about the GNU freedoms found themselves solving the same problems:
|
||||||
swapping in a newer SDL to an older game often times can save the day.
|
swapping in a newer SDL to an older game often times can save the day.
|
||||||
Static linking stops this dead.
|
Static linking stops this dead.
|
||||||
|
|
||||||
So here's what we did:
|
So here's what we did:
|
||||||
|
|
||||||
SDL now has, internally, a table of function pointers. So, this is what SDL_Init
|
SDL now has, internally, a table of function pointers. So, this is what SDL_Init
|
||||||
now looks like:
|
now looks like:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
Uint32 SDL_Init(Uint32 flags)
|
Uint32 SDL_Init(Uint32 flags)
|
||||||
{
|
{
|
||||||
return jump_table.SDL_Init(flags);
|
return jump_table.SDL_Init(flags);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Except that is all done with a bunch of macro magic so we don't have to maintain
|
Except that is all done with a bunch of macro magic so we don't have to maintain
|
||||||
every one of these.
|
every one of these.
|
||||||
|
|
||||||
What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
|
What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
|
||||||
SDL_Init() that you've been calling all this time. But at startup, it looks more
|
SDL_Init() that you've been calling all this time. But at startup, it looks more
|
||||||
like this:
|
like this:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
Uint32 SDL_Init_DEFAULT(Uint32 flags)
|
Uint32 SDL_Init_DEFAULT(Uint32 flags)
|
||||||
{
|
{
|
||||||
SDL_InitDynamicAPI();
|
SDL_InitDynamicAPI();
|
||||||
return jump_table.SDL_Init(flags);
|
return jump_table.SDL_Init(flags);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
|
SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
|
||||||
pointers, which means that this `_DEFAULT` function never gets called again.
|
pointers, which means that this `_DEFAULT` function never gets called again.
|
||||||
First call to any SDL function sets the whole thing up.
|
First call to any SDL function sets the whole thing up.
|
||||||
|
|
||||||
So you might be asking, what was the value in that? Isn't this what the operating
|
So you might be asking, what was the value in that? Isn't this what the operating
|
||||||
system's dynamic loader was supposed to do for us? Yes, but now we've got this
|
system's dynamic loader was supposed to do for us? Yes, but now we've got this
|
||||||
level of indirection, we can do things like this:
|
level of indirection, we can do things like this:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
|
export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
|
||||||
./MyGameThatIsStaticallyLinkedToSDL2
|
./MyGameThatIsStaticallyLinkedToSDL2
|
||||||
```
|
```
|
||||||
|
|
||||||
And now, this game that is statically linked to SDL, can still be overridden
|
And now, this game that is statically linked to SDL, can still be overridden
|
||||||
with a newer, or better, SDL. The statically linked one will only be used as
|
with a newer, or better, SDL. The statically linked one will only be used as
|
||||||
far as calling into the jump table in this case. But in cases where no override
|
far as calling into the jump table in this case. But in cases where no override
|
||||||
is desired, the statically linked version will provide its own jump table,
|
is desired, the statically linked version will provide its own jump table,
|
||||||
and everyone is happy.
|
and everyone is happy.
|
||||||
|
|
||||||
So now:
|
So now:
|
||||||
- Developers can statically link SDL, and users can still replace it.
|
- Developers can statically link SDL, and users can still replace it.
|
||||||
(We'd still rather you ship a shared library, though!)
|
(We'd still rather you ship a shared library, though!)
|
||||||
- Developers can ship an SDL with their game, Valve can override it for, say,
|
- Developers can ship an SDL with their game, Valve can override it for, say,
|
||||||
new features on SteamOS, or distros can override it for their own needs,
|
new features on SteamOS, or distros can override it for their own needs,
|
||||||
but it'll also just work in the default case.
|
but it'll also just work in the default case.
|
||||||
- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
|
- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
|
||||||
and it'll do the right thing.
|
and it'll do the right thing.
|
||||||
- End users (and Valve) can update a game's SDL in almost any case,
|
- End users (and Valve) can update a game's SDL in almost any case,
|
||||||
to keep abandoned games running on newer platforms.
|
to keep abandoned games running on newer platforms.
|
||||||
- Everyone develops with SDL exactly as they have been doing all along.
|
- Everyone develops with SDL exactly as they have been doing all along.
|
||||||
Same headers, same ABI. Just get the latest version to enable this magic.
|
Same headers, same ABI. Just get the latest version to enable this magic.
|
||||||
|
|
||||||
|
|
||||||
A little more about SDL_InitDynamicAPI():
|
A little more about SDL_InitDynamicAPI():
|
||||||
|
|
||||||
Internally, InitAPI does some locking to make sure everything waits until a
|
Internally, InitAPI does some locking to make sure everything waits until a
|
||||||
single thread initializes everything (although even SDL_CreateThread() goes
|
single thread initializes everything (although even SDL_CreateThread() goes
|
||||||
through here before spinning a thread, too), and then decides if it should use
|
through here before spinning a thread, too), and then decides if it should use
|
||||||
an external SDL library. If not, it sets up the jump table using the current
|
an external SDL library. If not, it sets up the jump table using the current
|
||||||
SDL's function pointers (which might be statically linked into a program, or in
|
SDL's function pointers (which might be statically linked into a program, or in
|
||||||
a shared library of its own). If so, it loads that library and looks for and
|
a shared library of its own). If so, it loads that library and looks for and
|
||||||
calls a single function:
|
calls a single function:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
Sint32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
|
Sint32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
|
||||||
```
|
```
|
||||||
|
|
||||||
That function takes a version number (more on that in a moment), the address of
|
That function takes a version number (more on that in a moment), the address of
|
||||||
the jump table, and the size, in bytes, of the table.
|
the jump table, and the size, in bytes, of the table.
|
||||||
Now, we've got policy here: this table's layout never changes; new stuff gets
|
Now, we've got policy here: this table's layout never changes; new stuff gets
|
||||||
added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
|
added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
|
||||||
the needed functions if tablesize <= sizeof its own jump table. If tablesize is
|
the needed functions if tablesize <= sizeof its own jump table. If tablesize is
|
||||||
bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
|
bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
|
||||||
if it's smaller, we know we can provide the entire API that the caller needs.
|
if it's smaller, we know we can provide the entire API that the caller needs.
|
||||||
|
|
||||||
The version variable is a failsafe switch.
|
The version variable is a failsafe switch.
|
||||||
Right now it's always 1. This number changes when there are major API changes
|
Right now it's always 1. This number changes when there are major API changes
|
||||||
(so we know if the tablesize might be smaller, or entries in it have changed).
|
(so we know if the tablesize might be smaller, or entries in it have changed).
|
||||||
Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
|
Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
|
||||||
inconceivable to have a small dispatch library that only supplies this one
|
inconceivable to have a small dispatch library that only supplies this one
|
||||||
function and loads different, otherwise-incompatible SDL libraries and has the
|
function and loads different, otherwise-incompatible SDL libraries and has the
|
||||||
right one initialize the jump table based on the version. For something that
|
right one initialize the jump table based on the version. For something that
|
||||||
must generically catch lots of different versions of SDL over time, like the
|
must generically catch lots of different versions of SDL over time, like the
|
||||||
Steam Client, this isn't a bad option.
|
Steam Client, this isn't a bad option.
|
||||||
|
|
||||||
Finally, I'm sure some people are reading this and thinking,
|
Finally, I'm sure some people are reading this and thinking,
|
||||||
"I don't want that overhead in my project!"
|
"I don't want that overhead in my project!"
|
||||||
|
|
||||||
To which I would point out that the extra function call through the jump table
|
To which I would point out that the extra function call through the jump table
|
||||||
probably wouldn't even show up in a profile, but lucky you: this can all be
|
probably wouldn't even show up in a profile, but lucky you: this can all be
|
||||||
disabled. You can build SDL without this if you absolutely must, but we would
|
disabled. You can build SDL without this if you absolutely must, but we would
|
||||||
encourage you not to do that. However, on heavily locked down platforms like
|
encourage you not to do that. However, on heavily locked down platforms like
|
||||||
iOS, or maybe when debugging, it makes sense to disable it. The way this is
|
iOS, or maybe when debugging, it makes sense to disable it. The way this is
|
||||||
designed in SDL, you just have to change one #define, and the entire system
|
designed in SDL, you just have to change one #define, and the entire system
|
||||||
vaporizes out, and SDL functions exactly like it always did. Most of it is
|
vaporizes out, and SDL functions exactly like it always did. Most of it is
|
||||||
macro magic, so the system is contained to one C file and a few headers.
|
macro magic, so the system is contained to one C file and a few headers.
|
||||||
However, this is on by default and you have to edit a header file to turn it
|
However, this is on by default and you have to edit a header file to turn it
|
||||||
off. Our hopes is that if we make it easy to disable, but not too easy,
|
off. Our hopes is that if we make it easy to disable, but not too easy,
|
||||||
everyone will ultimately be able to get what they want, but we've gently
|
everyone will ultimately be able to get what they want, but we've gently
|
||||||
nudged everyone towards what we think is the best solution.
|
nudged everyone towards what we think is the best solution.
|
@ -1,374 +1,374 @@
|
|||||||
# Emscripten
|
# Emscripten
|
||||||
|
|
||||||
## The state of things
|
## The state of things
|
||||||
|
|
||||||
(As of September 2023, but things move quickly and we don't update this
|
(As of September 2023, but things move quickly and we don't update this
|
||||||
document often.)
|
document often.)
|
||||||
|
|
||||||
In modern times, all the browsers you probably care about (Chrome, Firefox,
|
In modern times, all the browsers you probably care about (Chrome, Firefox,
|
||||||
Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some
|
Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some
|
||||||
reasonable base configurations:
|
reasonable base configurations:
|
||||||
|
|
||||||
- WebAssembly (don't bother with asm.js any more)
|
- WebAssembly (don't bother with asm.js any more)
|
||||||
- WebGL (which will look like OpenGL ES 2 or 3 to your app).
|
- WebGL (which will look like OpenGL ES 2 or 3 to your app).
|
||||||
- Threads (see caveats, though!)
|
- Threads (see caveats, though!)
|
||||||
- Game controllers
|
- Game controllers
|
||||||
- Autoupdating (so you can assume they have a recent version of the browser)
|
- Autoupdating (so you can assume they have a recent version of the browser)
|
||||||
|
|
||||||
All this to say we're at the point where you don't have to make a lot of
|
All this to say we're at the point where you don't have to make a lot of
|
||||||
concessions to get even a fairly complex SDL-based game up and running.
|
concessions to get even a fairly complex SDL-based game up and running.
|
||||||
|
|
||||||
|
|
||||||
## RTFM
|
## RTFM
|
||||||
|
|
||||||
This document is a quick rundown of some high-level details. The
|
This document is a quick rundown of some high-level details. The
|
||||||
documentation at [emscripten.org](https://emscripten.org/) is vast
|
documentation at [emscripten.org](https://emscripten.org/) is vast
|
||||||
and extremely detailed for a wide variety of topics, and you should at
|
and extremely detailed for a wide variety of topics, and you should at
|
||||||
least skim through it at some point.
|
least skim through it at some point.
|
||||||
|
|
||||||
|
|
||||||
## Porting your app to Emscripten
|
## Porting your app to Emscripten
|
||||||
|
|
||||||
Many many things just need some simple adjustments and they'll compile
|
Many many things just need some simple adjustments and they'll compile
|
||||||
like any other C/C++ code, as long as SDL was handling the platform-specific
|
like any other C/C++ code, as long as SDL was handling the platform-specific
|
||||||
work for your program.
|
work for your program.
|
||||||
|
|
||||||
First, you probably need this in at least one of your source files:
|
First, you probably need this in at least one of your source files:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
```
|
```
|
||||||
|
|
||||||
Second: assembly language code has to go. Replace it with C. You can even use
|
Second: assembly language code has to go. Replace it with C. You can even use
|
||||||
[x86 SIMD intrinsic functions in Emscripten](https://emscripten.org/docs/porting/simd.html)!
|
[x86 SIMD intrinsic functions in Emscripten](https://emscripten.org/docs/porting/simd.html)!
|
||||||
|
|
||||||
Third: Middleware has to go. If you have a third-party library you link
|
Third: Middleware has to go. If you have a third-party library you link
|
||||||
against, you either need an Emscripten port of it, or the source code to it
|
against, you either need an Emscripten port of it, or the source code to it
|
||||||
to compile yourself, or you need to remove it.
|
to compile yourself, or you need to remove it.
|
||||||
|
|
||||||
Fourth: You still start in a function called main(), but you need to get out of
|
Fourth: You still start in a function called main(), but you need to get out of
|
||||||
it and into a function that gets called repeatedly, and returns quickly,
|
it and into a function that gets called repeatedly, and returns quickly,
|
||||||
called a mainloop.
|
called a mainloop.
|
||||||
|
|
||||||
Somewhere in your program, you probably have something that looks like a more
|
Somewhere in your program, you probably have something that looks like a more
|
||||||
complicated version of this:
|
complicated version of this:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
initialize_the_game();
|
initialize_the_game();
|
||||||
while (game_is_still_running) {
|
while (game_is_still_running) {
|
||||||
check_for_new_input();
|
check_for_new_input();
|
||||||
think_about_stuff();
|
think_about_stuff();
|
||||||
draw_the_next_frame();
|
draw_the_next_frame();
|
||||||
}
|
}
|
||||||
deinitialize_the_game();
|
deinitialize_the_game();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This will not work on Emscripten, because the main thread needs to be free
|
This will not work on Emscripten, because the main thread needs to be free
|
||||||
to do stuff and can't sit in this loop forever. So Emscripten lets you set up
|
to do stuff and can't sit in this loop forever. So Emscripten lets you set up
|
||||||
a [mainloop](https://emscripten.org/docs/porting/emscripten-runtime-environment.html#browser-main-loop).
|
a [mainloop](https://emscripten.org/docs/porting/emscripten-runtime-environment.html#browser-main-loop).
|
||||||
|
|
||||||
```c
|
```c
|
||||||
static void mainloop(void) /* this will run often, possibly at the monitor's refresh rate */
|
static void mainloop(void) /* this will run often, possibly at the monitor's refresh rate */
|
||||||
{
|
{
|
||||||
if (!game_is_still_running) {
|
if (!game_is_still_running) {
|
||||||
deinitialize_the_game();
|
deinitialize_the_game();
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_cancel_main_loop(); /* this should "kill" the app. */
|
emscripten_cancel_main_loop(); /* this should "kill" the app. */
|
||||||
#else
|
#else
|
||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_new_input();
|
check_for_new_input();
|
||||||
think_about_stuff();
|
think_about_stuff();
|
||||||
draw_the_next_frame();
|
draw_the_next_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
initialize_the_game();
|
initialize_the_game();
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_main_loop(mainloop, 0, 1);
|
emscripten_set_main_loop(mainloop, 0, 1);
|
||||||
#else
|
#else
|
||||||
while (1) { mainloop(); }
|
while (1) { mainloop(); }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Basically, `emscripten_set_main_loop(mainloop, 0, 1);` says "run
|
Basically, `emscripten_set_main_loop(mainloop, 0, 1);` says "run
|
||||||
`mainloop` over and over until I end the program." The function will
|
`mainloop` over and over until I end the program." The function will
|
||||||
run, and return, freeing the main thread for other tasks, and then
|
run, and return, freeing the main thread for other tasks, and then
|
||||||
run again when it's time. The `1` parameter does some magic to make
|
run again when it's time. The `1` parameter does some magic to make
|
||||||
your main() function end immediately; this is useful because you
|
your main() function end immediately; this is useful because you
|
||||||
don't want any shutdown code that might be sitting below this code
|
don't want any shutdown code that might be sitting below this code
|
||||||
to actually run if main() were to continue on, since we're just
|
to actually run if main() were to continue on, since we're just
|
||||||
getting started.
|
getting started.
|
||||||
|
|
||||||
There's a lot of little details that are beyond the scope of this
|
There's a lot of little details that are beyond the scope of this
|
||||||
document, but that's the biggest intial set of hurdles to porting
|
document, but that's the biggest intial set of hurdles to porting
|
||||||
your app to the web.
|
your app to the web.
|
||||||
|
|
||||||
|
|
||||||
## Do you need threads?
|
## Do you need threads?
|
||||||
|
|
||||||
If you plan to use threads, they work on all major browsers now. HOWEVER,
|
If you plan to use threads, they work on all major browsers now. HOWEVER,
|
||||||
they bring with them a lot of careful considerations. Rendering _must_
|
they bring with them a lot of careful considerations. Rendering _must_
|
||||||
be done on the main thread. This is a general guideline for many
|
be done on the main thread. This is a general guideline for many
|
||||||
platforms, but a hard requirement on the web.
|
platforms, but a hard requirement on the web.
|
||||||
|
|
||||||
Many other things also must happen on the main thread; often times SDL
|
Many other things also must happen on the main thread; often times SDL
|
||||||
and Emscripten make efforts to "proxy" work to the main thread that
|
and Emscripten make efforts to "proxy" work to the main thread that
|
||||||
must be there, but you have to be careful (and read more detailed
|
must be there, but you have to be careful (and read more detailed
|
||||||
documentation than this for the finer points).
|
documentation than this for the finer points).
|
||||||
|
|
||||||
Even when using threads, your main thread needs to set an Emscripten
|
Even when using threads, your main thread needs to set an Emscripten
|
||||||
mainloop that runs quickly and returns, or things will fail to work
|
mainloop that runs quickly and returns, or things will fail to work
|
||||||
correctly.
|
correctly.
|
||||||
|
|
||||||
You should definitely read [Emscripten's pthreads docs](https://emscripten.org/docs/porting/pthreads.html)
|
You should definitely read [Emscripten's pthreads docs](https://emscripten.org/docs/porting/pthreads.html)
|
||||||
for all the finer points. Mostly SDL's thread API will work as expected,
|
for all the finer points. Mostly SDL's thread API will work as expected,
|
||||||
but is built on pthreads, so it shares the same little incompatibilities
|
but is built on pthreads, so it shares the same little incompatibilities
|
||||||
that are documented there, such as where you can use a mutex, and when
|
that are documented there, such as where you can use a mutex, and when
|
||||||
a thread will start running, etc.
|
a thread will start running, etc.
|
||||||
|
|
||||||
|
|
||||||
IMPORTANT: You have to decide to either build something that uses
|
IMPORTANT: You have to decide to either build something that uses
|
||||||
threads or something that doesn't; you can't have one build
|
threads or something that doesn't; you can't have one build
|
||||||
that works everywhere. This is an Emscripten (or maybe WebAssembly?
|
that works everywhere. This is an Emscripten (or maybe WebAssembly?
|
||||||
Or just web browsers in general?) limitation. If you aren't using
|
Or just web browsers in general?) limitation. If you aren't using
|
||||||
threads, it's easier to not enable them at all, at build time.
|
threads, it's easier to not enable them at all, at build time.
|
||||||
|
|
||||||
If you use threads, you _have to_ run from a web server that has
|
If you use threads, you _have to_ run from a web server that has
|
||||||
[COOP/COEP headers set correctly](https://web.dev/why-coop-coep/)
|
[COOP/COEP headers set correctly](https://web.dev/why-coop-coep/)
|
||||||
or your program will fail to start at all.
|
or your program will fail to start at all.
|
||||||
|
|
||||||
If building with threads, `__EMSCRIPTEN_PTHREADS__` will be defined
|
If building with threads, `__EMSCRIPTEN_PTHREADS__` will be defined
|
||||||
for checking with the C preprocessor, so you can build something
|
for checking with the C preprocessor, so you can build something
|
||||||
different depending on what sort of build you're compiling.
|
different depending on what sort of build you're compiling.
|
||||||
|
|
||||||
|
|
||||||
## Audio
|
## Audio
|
||||||
|
|
||||||
Audio works as expected at the API level, but not exactly like other
|
Audio works as expected at the API level, but not exactly like other
|
||||||
platforms.
|
platforms.
|
||||||
|
|
||||||
You'll only see a single default audio device. Audio capture also works;
|
You'll only see a single default audio device. Audio capture also works;
|
||||||
if the browser pops up a prompt to ask for permission to access the
|
if the browser pops up a prompt to ask for permission to access the
|
||||||
microphone, the SDL_OpenAudioDevice call will succeed and start producing
|
microphone, the SDL_OpenAudioDevice call will succeed and start producing
|
||||||
silence at a regular interval. Once the user approves the request, real
|
silence at a regular interval. Once the user approves the request, real
|
||||||
audio data will flow. If the user denies it, the app is not informed and
|
audio data will flow. If the user denies it, the app is not informed and
|
||||||
will just continue to receive silence.
|
will just continue to receive silence.
|
||||||
|
|
||||||
Modern web browsers will not permit web pages to produce sound before the
|
Modern web browsers will not permit web pages to produce sound before the
|
||||||
user has interacted with them (clicked or tapped on them, usually); this is
|
user has interacted with them (clicked or tapped on them, usually); this is
|
||||||
for several reasons, not the least of which being that no one likes when a
|
for several reasons, not the least of which being that no one likes when a
|
||||||
random browser tab suddenly starts making noise and the user has to scramble
|
random browser tab suddenly starts making noise and the user has to scramble
|
||||||
to figure out which and silence it.
|
to figure out which and silence it.
|
||||||
|
|
||||||
SDL will allow you to open the audio device for playback in this
|
SDL will allow you to open the audio device for playback in this
|
||||||
circumstance, and your audio callback will fire, but SDL will throw the audio
|
circumstance, and your audio callback will fire, but SDL will throw the audio
|
||||||
data away until the user interacts with the page. This helps apps that depend
|
data away until the user interacts with the page. This helps apps that depend
|
||||||
on the audio callback to make progress, and also keeps audio playback in sync
|
on the audio callback to make progress, and also keeps audio playback in sync
|
||||||
once the app is finally allowed to make noise.
|
once the app is finally allowed to make noise.
|
||||||
|
|
||||||
There are two reasonable ways to deal with the silence at the app level:
|
There are two reasonable ways to deal with the silence at the app level:
|
||||||
if you are writing some sort of media player thing, where the user expects
|
if you are writing some sort of media player thing, where the user expects
|
||||||
there to be a volume control when you mouseover the canvas, just default
|
there to be a volume control when you mouseover the canvas, just default
|
||||||
that control to a muted state; if the user clicks on the control to unmute
|
that control to a muted state; if the user clicks on the control to unmute
|
||||||
it, on this first click, open the audio device. This allows the media to
|
it, on this first click, open the audio device. This allows the media to
|
||||||
play at start, and the user can reasonably opt-in to listening.
|
play at start, and the user can reasonably opt-in to listening.
|
||||||
|
|
||||||
Many games do not have this sort of UI, and are more rigid about starting
|
Many games do not have this sort of UI, and are more rigid about starting
|
||||||
audio along with everything else at the start of the process. For these, your
|
audio along with everything else at the start of the process. For these, your
|
||||||
best bet is to write a little Javascript that puts up a "Click here to play!"
|
best bet is to write a little Javascript that puts up a "Click here to play!"
|
||||||
UI, and upon the user clicking, remove that UI and then call the Emscripten
|
UI, and upon the user clicking, remove that UI and then call the Emscripten
|
||||||
app's main() function. As far as the application knows, the audio device was
|
app's main() function. As far as the application knows, the audio device was
|
||||||
available to be opened as soon as the program started, and since this magic
|
available to be opened as soon as the program started, and since this magic
|
||||||
happens in a little Javascript, you don't have to change your C/C++ code at
|
happens in a little Javascript, you don't have to change your C/C++ code at
|
||||||
all to make it happen.
|
all to make it happen.
|
||||||
|
|
||||||
Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
|
Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
|
||||||
for some Javascript code to steal for this approach.
|
for some Javascript code to steal for this approach.
|
||||||
|
|
||||||
|
|
||||||
## Rendering
|
## Rendering
|
||||||
|
|
||||||
If you use SDL's 2D render API, it will use GLES2 internally, which
|
If you use SDL's 2D render API, it will use GLES2 internally, which
|
||||||
Emscripten will turn into WebGL calls. You can also use OpenGL ES 2
|
Emscripten will turn into WebGL calls. You can also use OpenGL ES 2
|
||||||
directly by creating a GL context and drawing into it.
|
directly by creating a GL context and drawing into it.
|
||||||
|
|
||||||
Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually
|
Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually
|
||||||
present anything on the screen until your return from your mainloop
|
present anything on the screen until your return from your mainloop
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
|
||||||
## Building SDL/emscripten
|
## Building SDL/emscripten
|
||||||
|
|
||||||
First: do you _really_ need to build SDL from source?
|
First: do you _really_ need to build SDL from source?
|
||||||
|
|
||||||
If you aren't developing SDL itself, have a desire to mess with its source
|
If you aren't developing SDL itself, have a desire to mess with its source
|
||||||
code, or need something on the bleeding edge, don't build SDL. Just use
|
code, or need something on the bleeding edge, don't build SDL. Just use
|
||||||
Emscripten's packaged version!
|
Emscripten's packaged version!
|
||||||
|
|
||||||
Compile and link your app with `-sUSE_SDL=2` and it'll use a build of
|
Compile and link your app with `-sUSE_SDL=2` and it'll use a build of
|
||||||
SDL packaged with Emscripten. This comes from the same source code and
|
SDL packaged with Emscripten. This comes from the same source code and
|
||||||
fixes the Emscripten project makes to SDL are generally merged into SDL's
|
fixes the Emscripten project makes to SDL are generally merged into SDL's
|
||||||
revision control, so often this is much easier for app developers.
|
revision control, so often this is much easier for app developers.
|
||||||
|
|
||||||
`-sUSE_SDL=1` will select Emscripten's JavaScript reimplementation of SDL
|
`-sUSE_SDL=1` will select Emscripten's JavaScript reimplementation of SDL
|
||||||
1.2 instead; if you need SDL 1.2, this might be fine, but we generally
|
1.2 instead; if you need SDL 1.2, this might be fine, but we generally
|
||||||
recommend you don't use SDL 1.2 in modern times.
|
recommend you don't use SDL 1.2 in modern times.
|
||||||
|
|
||||||
|
|
||||||
If you want to build SDL, though...
|
If you want to build SDL, though...
|
||||||
|
|
||||||
SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
|
SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
|
||||||
are likely to work, as well.
|
are likely to work, as well.
|
||||||
|
|
||||||
|
|
||||||
Build:
|
Build:
|
||||||
|
|
||||||
This works on Linux/Unix and macOS. Please send comments about Windows.
|
This works on Linux/Unix and macOS. Please send comments about Windows.
|
||||||
|
|
||||||
Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html)
|
Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html)
|
||||||
first, and run `source emsdk_env.sh` at the command line so it finds the
|
first, and run `source emsdk_env.sh` at the command line so it finds the
|
||||||
tools.
|
tools.
|
||||||
|
|
||||||
(These configure options might be overkill, but this has worked for me.)
|
(These configure options might be overkill, but this has worked for me.)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd SDL
|
cd SDL
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
emconfigure ../configure --host=wasm32-unknown-emscripten --disable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3"
|
emconfigure ../configure --host=wasm32-unknown-emscripten --disable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3"
|
||||||
emmake make -j4
|
emmake make -j4
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to build with thread support, something like this works:
|
If you want to build with thread support, something like this works:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
emconfigure ../configure --host=wasm32-unknown-emscripten --enable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3 -pthread" LDFLAGS="-pthread"
|
emconfigure ../configure --host=wasm32-unknown-emscripten --enable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3 -pthread" LDFLAGS="-pthread"
|
||||||
```
|
```
|
||||||
|
|
||||||
Or with cmake:
|
Or with cmake:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
emcmake cmake ..
|
emcmake cmake ..
|
||||||
emmake make -j4
|
emmake make -j4
|
||||||
```
|
```
|
||||||
|
|
||||||
To build one of the tests:
|
To build one of the tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd test/
|
cd test/
|
||||||
emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
|
emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building your app
|
## Building your app
|
||||||
|
|
||||||
You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but
|
You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but
|
||||||
mostly it uses the same command line arguments as Clang.
|
mostly it uses the same command line arguments as Clang.
|
||||||
|
|
||||||
Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL,
|
Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL,
|
||||||
link with `-sUSE_SDL=2` to use Emscripten's prepackaged SDL2 build.
|
link with `-sUSE_SDL=2` to use Emscripten's prepackaged SDL2 build.
|
||||||
|
|
||||||
Usually you would produce a binary like this:
|
Usually you would produce a binary like this:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gcc -o mygame mygame.c # or whatever
|
gcc -o mygame mygame.c # or whatever
|
||||||
```
|
```
|
||||||
|
|
||||||
But for Emscripten, you want to output something else:
|
But for Emscripten, you want to output something else:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
emcc -o index.html mygame.c
|
emcc -o index.html mygame.c
|
||||||
```
|
```
|
||||||
|
|
||||||
This will produce several files...support Javascript and WebAssembly (.wasm)
|
This will produce several files...support Javascript and WebAssembly (.wasm)
|
||||||
files. The `-o index.html` will produce a simple HTML page that loads and
|
files. The `-o index.html` will produce a simple HTML page that loads and
|
||||||
runs your app. You will (probably) eventually want to replace or customize
|
runs your app. You will (probably) eventually want to replace or customize
|
||||||
that file and do `-o index.js` instead to just build the code pieces.
|
that file and do `-o index.js` instead to just build the code pieces.
|
||||||
|
|
||||||
If you're working on a program of any serious size, you'll likely need to
|
If you're working on a program of any serious size, you'll likely need to
|
||||||
link with `-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1gb` to get access
|
link with `-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1gb` to get access
|
||||||
to more memory. If using pthreads, you'll need the `-sMAXIMUM_MEMORY=1gb`
|
to more memory. If using pthreads, you'll need the `-sMAXIMUM_MEMORY=1gb`
|
||||||
or the app will fail to start on iOS browsers, but this might be a bug that
|
or the app will fail to start on iOS browsers, but this might be a bug that
|
||||||
goes away in the future.
|
goes away in the future.
|
||||||
|
|
||||||
|
|
||||||
## Data files
|
## Data files
|
||||||
|
|
||||||
Your game probably has data files. Here's how to access them.
|
Your game probably has data files. Here's how to access them.
|
||||||
|
|
||||||
Filesystem access works like a Unix filesystem; you have a single directory
|
Filesystem access works like a Unix filesystem; you have a single directory
|
||||||
tree, possibly interpolated from several mounted locations, no drive letters,
|
tree, possibly interpolated from several mounted locations, no drive letters,
|
||||||
'/' for a path separator. You can access them with standard file APIs like
|
'/' for a path separator. You can access them with standard file APIs like
|
||||||
open() or fopen() or SDL_RWops. You can read or write from the filesystem.
|
open() or fopen() or SDL_RWops. You can read or write from the filesystem.
|
||||||
|
|
||||||
By default, you probably have a "MEMFS" filesystem (all files are stored in
|
By default, you probably have a "MEMFS" filesystem (all files are stored in
|
||||||
memory, but access to them is immediate and doesn't need to block). There are
|
memory, but access to them is immediate and doesn't need to block). There are
|
||||||
other options, like "IDBFS" (files are stored in a local database, so they
|
other options, like "IDBFS" (files are stored in a local database, so they
|
||||||
don't need to be in RAM all the time and they can persist between runs of the
|
don't need to be in RAM all the time and they can persist between runs of the
|
||||||
program, but access is not synchronous). You can mix and match these file
|
program, but access is not synchronous). You can mix and match these file
|
||||||
systems, mounting a MEMFS filesystem at one place and idbfs elsewhere, etc,
|
systems, mounting a MEMFS filesystem at one place and idbfs elsewhere, etc,
|
||||||
but that's beyond the scope of this document. Please refer to Emscripten's
|
but that's beyond the scope of this document. Please refer to Emscripten's
|
||||||
[page on the topic](https://emscripten.org/docs/porting/files/file_systems_overview.html)
|
[page on the topic](https://emscripten.org/docs/porting/files/file_systems_overview.html)
|
||||||
for more info.
|
for more info.
|
||||||
|
|
||||||
The _easiest_ (but not the best) way to get at your data files is to embed
|
The _easiest_ (but not the best) way to get at your data files is to embed
|
||||||
them in the app itself. Emscripten's linker has support for automating this.
|
them in the app itself. Emscripten's linker has support for automating this.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
emcc -o index.html loopwave.c --embed-file=../test/sample.wav@/sounds/sample.wav
|
emcc -o index.html loopwave.c --embed-file=../test/sample.wav@/sounds/sample.wav
|
||||||
```
|
```
|
||||||
|
|
||||||
This will pack ../test/sample.wav in your app, and make it available at
|
This will pack ../test/sample.wav in your app, and make it available at
|
||||||
"/sounds/sample.wav" at runtime. Emscripten makes sure this data is available
|
"/sounds/sample.wav" at runtime. Emscripten makes sure this data is available
|
||||||
before your main() function runs, and since it's in MEMFS, you can just
|
before your main() function runs, and since it's in MEMFS, you can just
|
||||||
read it like you do on other platforms. `--embed-file` can also accept a
|
read it like you do on other platforms. `--embed-file` can also accept a
|
||||||
directory to pack an entire tree, and you can specify the argument multiple
|
directory to pack an entire tree, and you can specify the argument multiple
|
||||||
times to pack unrelated things into the final installation.
|
times to pack unrelated things into the final installation.
|
||||||
|
|
||||||
Note that this is absolutely the best approach if you have a few small
|
Note that this is absolutely the best approach if you have a few small
|
||||||
files to include and shouldn't worry about the issue further. However, if you
|
files to include and shouldn't worry about the issue further. However, if you
|
||||||
have hundreds of megabytes and/or thousands of files, this is not so great,
|
have hundreds of megabytes and/or thousands of files, this is not so great,
|
||||||
since the user will download it all every time they load your page, and it
|
since the user will download it all every time they load your page, and it
|
||||||
all has to live in memory at runtime.
|
all has to live in memory at runtime.
|
||||||
|
|
||||||
[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html)
|
[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html)
|
||||||
gives other options and details, and is worth a read.
|
gives other options and details, and is worth a read.
|
||||||
|
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
Debugging web apps is a mixed bag. You should compile and link with
|
Debugging web apps is a mixed bag. You should compile and link with
|
||||||
`-gsource-map`, which embeds a ton of source-level debugging information into
|
`-gsource-map`, which embeds a ton of source-level debugging information into
|
||||||
the build, and make sure _the app source code is available on the web server_,
|
the build, and make sure _the app source code is available on the web server_,
|
||||||
which is often a scary proposition for various reasons.
|
which is often a scary proposition for various reasons.
|
||||||
|
|
||||||
When you debug from the browser's tools and hit a breakpoint, you can step
|
When you debug from the browser's tools and hit a breakpoint, you can step
|
||||||
through the actual C/C++ source code, though, which can be nice.
|
through the actual C/C++ source code, though, which can be nice.
|
||||||
|
|
||||||
If you try debugging in Firefox and it doesn't work well for no apparent
|
If you try debugging in Firefox and it doesn't work well for no apparent
|
||||||
reason, try Chrome, and vice-versa. These tools are still relatively new,
|
reason, try Chrome, and vice-versa. These tools are still relatively new,
|
||||||
and improving all the time.
|
and improving all the time.
|
||||||
|
|
||||||
SDL_Log() (or even plain old printf) will write to the Javascript console,
|
SDL_Log() (or even plain old printf) will write to the Javascript console,
|
||||||
and honestly I find printf-style debugging to be easier than setting up a build
|
and honestly I find printf-style debugging to be easier than setting up a build
|
||||||
for proper debugging, so use whatever tools work best for you.
|
for proper debugging, so use whatever tools work best for you.
|
||||||
|
|
||||||
|
|
||||||
## Questions?
|
## Questions?
|
||||||
|
|
||||||
Please give us feedback on this document at [the SDL bug tracker](https://github.com/libsdl-org/SDL/issues).
|
Please give us feedback on this document at [the SDL bug tracker](https://github.com/libsdl-org/SDL/issues).
|
||||||
If something is wrong or unclear, we want to know!
|
If something is wrong or unclear, we want to know!
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,176 +1,176 @@
|
|||||||
GDK
|
GDK
|
||||||
=====
|
=====
|
||||||
|
|
||||||
This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
|
This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
|
||||||
|
|
||||||
Windows (GDK) and Xbox One/Xbox Series (GDKX) are both supported and all the required code is included in this public SDL release. However, only licensed Xbox developers have access to the GDKX libraries which will allow you to build the Xbox targets.
|
Windows (GDK) and Xbox One/Xbox Series (GDKX) are both supported and all the required code is included in this public SDL release. However, only licensed Xbox developers have access to the GDKX libraries which will allow you to build the Xbox targets.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
|
* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
|
||||||
* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
|
* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
|
||||||
* For Xbox, you will need the corresponding GDKX version (licensed developers only)
|
* For Xbox, you will need the corresponding GDKX version (licensed developers only)
|
||||||
* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
|
* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
|
||||||
|
|
||||||
|
|
||||||
Windows GDK Status
|
Windows GDK Status
|
||||||
------
|
------
|
||||||
|
|
||||||
The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
|
The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
|
||||||
|
|
||||||
* Additionally, the GDK port adds the following:
|
* Additionally, the GDK port adds the following:
|
||||||
* Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
|
* Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
|
||||||
* GDK-specific setup:
|
* GDK-specific setup:
|
||||||
* Initializing/uninitializing the game runtime, and initializing Xbox Live services
|
* Initializing/uninitializing the game runtime, and initializing Xbox Live services
|
||||||
* Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
|
* Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
|
||||||
|
|
||||||
* An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
|
* An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
|
||||||
* Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
|
* Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
|
||||||
* You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
|
* You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
|
||||||
|
|
||||||
* Single-player games have some additional features available:
|
* Single-player games have some additional features available:
|
||||||
* Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer.
|
* Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer.
|
||||||
* `SDL_GetPrefPath` still works, but only for single-player titles.
|
* `SDL_GetPrefPath` still works, but only for single-player titles.
|
||||||
|
|
||||||
These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values!
|
These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values!
|
||||||
|
|
||||||
* What doesn't work:
|
* What doesn't work:
|
||||||
* Compilation with anything other than through the included Visual C++ solution file
|
* Compilation with anything other than through the included Visual C++ solution file
|
||||||
|
|
||||||
## VisualC-GDK Solution
|
## VisualC-GDK Solution
|
||||||
|
|
||||||
The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
|
The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
|
||||||
|
|
||||||
* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
|
* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
|
||||||
* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
|
* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
|
||||||
* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
|
* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
|
||||||
* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
|
* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
|
||||||
*NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
|
*NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
|
||||||
* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
|
* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
|
||||||
|
|
||||||
If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
|
If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
|
||||||
|
|
||||||
Windows GDK Setup, Detailed Steps
|
Windows GDK Setup, Detailed Steps
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
|
These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
|
||||||
|
|
||||||
### 1. Add a Gaming.Desktop.x64 Configuration ###
|
### 1. Add a Gaming.Desktop.x64 Configuration ###
|
||||||
|
|
||||||
In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
|
In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
|
||||||
|
|
||||||
### 2. Build SDL2 and SDL2main for GDK ###
|
### 2. Build SDL2 and SDL2main for GDK ###
|
||||||
|
|
||||||
Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
|
Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
|
||||||
|
|
||||||
*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built.
|
*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built.
|
||||||
|
|
||||||
### 3. Configuring Project Settings ###
|
### 3. Configuring Project Settings ###
|
||||||
|
|
||||||
While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
|
While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
|
||||||
|
|
||||||
* Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
|
* Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
|
||||||
* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
|
* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
|
||||||
* Under Linker > Input > Additional Dependencies, you need the following:
|
* Under Linker > Input > Additional Dependencies, you need the following:
|
||||||
* `SDL2.lib`
|
* `SDL2.lib`
|
||||||
* `SDL2main.lib` (unless not using)
|
* `SDL2main.lib` (unless not using)
|
||||||
* `xgameruntime.lib`
|
* `xgameruntime.lib`
|
||||||
* `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
|
* `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
|
||||||
* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
|
* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
|
||||||
|
|
||||||
### 4. Setting up SDL_main ###
|
### 4. Setting up SDL_main ###
|
||||||
|
|
||||||
Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
|
Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
|
||||||
|
|
||||||
### 5. Required DLLs ###
|
### 5. Required DLLs ###
|
||||||
|
|
||||||
The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
|
The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
|
||||||
|
|
||||||
* Your SDL2.dll
|
* Your SDL2.dll
|
||||||
* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
|
* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
|
||||||
* XCurl.dll
|
* XCurl.dll
|
||||||
|
|
||||||
You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
|
You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
|
||||||
|
|
||||||
### 6. Setting up MicrosoftGame.config ###
|
### 6. Setting up MicrosoftGame.config ###
|
||||||
|
|
||||||
You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
|
You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
|
||||||
|
|
||||||
This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
|
This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
|
||||||
|
|
||||||
For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
|
For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
|
||||||
|
|
||||||
Then, you need to set the following values to the values from Partner Center:
|
Then, you need to set the following values to the values from Partner Center:
|
||||||
|
|
||||||
* Identity tag - Name and Publisher attributes
|
* Identity tag - Name and Publisher attributes
|
||||||
* TitleId
|
* TitleId
|
||||||
* MSAAppId
|
* MSAAppId
|
||||||
|
|
||||||
### 7. Adding Required Logos
|
### 7. Adding Required Logos
|
||||||
|
|
||||||
Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
|
Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
|
||||||
|
|
||||||
|
|
||||||
### 8. Copying any Data Files ###
|
### 8. Copying any Data Files ###
|
||||||
|
|
||||||
When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
|
When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
|
||||||
|
|
||||||
|
|
||||||
### 9. Build and Run from Visual Studio ###
|
### 9. Build and Run from Visual Studio ###
|
||||||
|
|
||||||
At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
|
At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
|
||||||
|
|
||||||
If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
|
If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
|
||||||
|
|
||||||
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
|
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
|
||||||
2. Switch the sandbox name with:
|
2. Switch the sandbox name with:
|
||||||
`XblPCSandbox SANDBOX.#`
|
`XblPCSandbox SANDBOX.#`
|
||||||
3. (To switch back to the retail sandbox):
|
3. (To switch back to the retail sandbox):
|
||||||
`XblPCSandbox RETAIL`
|
`XblPCSandbox RETAIL`
|
||||||
|
|
||||||
### 10. Packaging and Installing Locally
|
### 10. Packaging and Installing Locally
|
||||||
|
|
||||||
You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
|
You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
|
||||||
|
|
||||||
To create the package:
|
To create the package:
|
||||||
|
|
||||||
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
|
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
|
||||||
2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
|
2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
|
||||||
3. `mkdir Package` to create an output directory
|
3. `mkdir Package` to create an output directory
|
||||||
4. To package the file into the `Package` directory, use:
|
4. To package the file into the `Package` directory, use:
|
||||||
`makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
|
`makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
|
||||||
5. To install the package, use:
|
5. To install the package, use:
|
||||||
`wdapp install PACKAGENAME.msixvc`
|
`wdapp install PACKAGENAME.msixvc`
|
||||||
6. Once the package is installed, you can run it from the start menu.
|
6. Once the package is installed, you can run it from the start menu.
|
||||||
7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
|
7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
|
||||||
|
|
||||||
Xbox GDKX Setup
|
Xbox GDKX Setup
|
||||||
---------------------
|
---------------------
|
||||||
In general, the same process in the Windows GDK instructions work. There are just a few additional notes:
|
In general, the same process in the Windows GDK instructions work. There are just a few additional notes:
|
||||||
* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target
|
* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target
|
||||||
* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target
|
* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target
|
||||||
* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define
|
* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define
|
||||||
* You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox)
|
* You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox)
|
||||||
* The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons)
|
* The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons)
|
||||||
* To create a package, use:
|
* To create a package, use:
|
||||||
`makepkg pack /f PackageLayout.xml /lt /d . /pd Package`
|
`makepkg pack /f PackageLayout.xml /lt /d . /pd Package`
|
||||||
* To install the package, use:
|
* To install the package, use:
|
||||||
`xbapp install [PACKAGE].xvc`
|
`xbapp install [PACKAGE].xvc`
|
||||||
* For some reason, if you make changes that require SDL2.dll to build, and you are running through the debugger (instead of a package), you have to rebuild your .exe target for the debugger to recognize the dll has changed and needs to be transferred to the console again
|
* For some reason, if you make changes that require SDL2.dll to build, and you are running through the debugger (instead of a package), you have to rebuild your .exe target for the debugger to recognize the dll has changed and needs to be transferred to the console again
|
||||||
* While there are successful releases of Xbox titles using this port, it is not as extensively tested as other targets
|
* While there are successful releases of Xbox titles using this port, it is not as extensively tested as other targets
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
#### Xbox Live Login does not work
|
#### Xbox Live Login does not work
|
||||||
|
|
||||||
As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
|
As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
|
||||||
|
|
||||||
Furthermore, confirm that your PC is set to the correct sandbox.
|
Furthermore, confirm that your PC is set to the correct sandbox.
|
||||||
|
|
||||||
|
|
||||||
#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
|
#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
|
||||||
|
|
||||||
Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).
|
Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).
|
@ -1,71 +1,71 @@
|
|||||||
Dollar Gestures
|
Dollar Gestures
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
|
SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
|
||||||
|
|
||||||
Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
|
Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
|
||||||
|
|
||||||
Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
|
Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
|
||||||
|
|
||||||
Recording:
|
Recording:
|
||||||
----------
|
----------
|
||||||
To begin recording on a touch device call:
|
To begin recording on a touch device call:
|
||||||
SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
|
SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
|
||||||
|
|
||||||
Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
|
Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
|
||||||
A SDL_DOLLARRECORD event is a dgesture with the following fields:
|
A SDL_DOLLARRECORD event is a dgesture with the following fields:
|
||||||
|
|
||||||
* event.dgesture.touchId - the Id of the touch used to record the gesture.
|
* event.dgesture.touchId - the Id of the touch used to record the gesture.
|
||||||
* event.dgesture.gestureId - the unique id of the recorded gesture.
|
* event.dgesture.gestureId - the unique id of the recorded gesture.
|
||||||
|
|
||||||
|
|
||||||
Performing:
|
Performing:
|
||||||
-----------
|
-----------
|
||||||
As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
|
As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
|
||||||
|
|
||||||
* event.dgesture.touchId - the Id of the touch which performed the gesture.
|
* event.dgesture.touchId - the Id of the touch which performed the gesture.
|
||||||
* event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
|
* event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
|
||||||
* event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
|
* event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
|
||||||
* event.dgesture.numFingers - the number of fingers used to draw the stroke.
|
* event.dgesture.numFingers - the number of fingers used to draw the stroke.
|
||||||
|
|
||||||
Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Saving:
|
Saving:
|
||||||
-------
|
-------
|
||||||
To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
|
To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
|
||||||
|
|
||||||
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
|
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
|
||||||
|
|
||||||
Both functions return the number of gestures successfully saved.
|
Both functions return the number of gestures successfully saved.
|
||||||
|
|
||||||
|
|
||||||
Loading:
|
Loading:
|
||||||
--------
|
--------
|
||||||
To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
|
To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
|
||||||
|
|
||||||
SDL_LoadDollarTemplates returns the number of templates successfully loaded.
|
SDL_LoadDollarTemplates returns the number of templates successfully loaded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Multi Gestures
|
Multi Gestures
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL provides simple support for pinch/rotate/swipe gestures.
|
SDL provides simple support for pinch/rotate/swipe gestures.
|
||||||
Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
|
Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
|
||||||
|
|
||||||
* event.mgesture.touchId - the Id of the touch on which the gesture was performed.
|
* event.mgesture.touchId - the Id of the touch on which the gesture was performed.
|
||||||
* event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
|
* event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
|
||||||
* event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
|
* event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
|
||||||
* event.mgesture.dTheta - the amount that the fingers rotated during this motion.
|
* event.mgesture.dTheta - the amount that the fingers rotated during this motion.
|
||||||
* event.mgesture.dDist - the amount that the fingers pinched during this motion.
|
* event.mgesture.dDist - the amount that the fingers pinched during this motion.
|
||||||
* event.mgesture.numFingers - the number of fingers used in the gesture.
|
* event.mgesture.numFingers - the number of fingers used in the gesture.
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Notes
|
Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
For a complete example see test/testgesture.c
|
For a complete example see test/testgesture.c
|
||||||
|
|
||||||
Please direct questions/comments to:
|
Please direct questions/comments to:
|
||||||
jim.tla+sdl_touch@gmail.com
|
jim.tla+sdl_touch@gmail.com
|
@ -1,19 +1,19 @@
|
|||||||
git
|
git
|
||||||
=========
|
=========
|
||||||
|
|
||||||
The latest development version of SDL is available via git.
|
The latest development version of SDL is available via git.
|
||||||
Git allows you to get up-to-the-minute fixes and enhancements;
|
Git allows you to get up-to-the-minute fixes and enhancements;
|
||||||
as a developer works on a source tree, you can use "git" to mirror that
|
as a developer works on a source tree, you can use "git" to mirror that
|
||||||
source tree instead of waiting for an official release. Please look
|
source tree instead of waiting for an official release. Please look
|
||||||
at the Git website ( https://git-scm.com/ ) for more
|
at the Git website ( https://git-scm.com/ ) for more
|
||||||
information on using git, where you can also download software for
|
information on using git, where you can also download software for
|
||||||
macOS, Windows, and Unix systems.
|
macOS, Windows, and Unix systems.
|
||||||
|
|
||||||
git clone https://github.com/libsdl-org/SDL
|
git clone https://github.com/libsdl-org/SDL
|
||||||
|
|
||||||
If you are building SDL via configure, you will need to run autogen.sh
|
If you are building SDL via configure, you will need to run autogen.sh
|
||||||
before running configure.
|
before running configure.
|
||||||
|
|
||||||
There is a web interface to the Git repository at:
|
There is a web interface to the Git repository at:
|
||||||
http://github.com/libsdl-org/SDL/
|
http://github.com/libsdl-org/SDL/
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
We are no longer hosted in Mercurial. Please see README-git.md for details.
|
We are no longer hosted in Mercurial. Please see README-git.md for details.
|
||||||
|
|
||||||
Thanks!
|
Thanks!
|
||||||
|
|
@ -1,307 +1,307 @@
|
|||||||
iOS
|
iOS
|
||||||
======
|
======
|
||||||
|
|
||||||
Building the Simple DirectMedia Layer for iOS 9.0+
|
Building the Simple DirectMedia Layer for iOS 9.0+
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
|
Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
|
||||||
|
|
||||||
Instructions:
|
Instructions:
|
||||||
|
|
||||||
1. Open SDL.xcodeproj (located in Xcode/SDL) in Xcode.
|
1. Open SDL.xcodeproj (located in Xcode/SDL) in Xcode.
|
||||||
2. Select your desired target, and hit build.
|
2. Select your desired target, and hit build.
|
||||||
|
|
||||||
|
|
||||||
Using the Simple DirectMedia Layer for iOS
|
Using the Simple DirectMedia Layer for iOS
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
1. Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology.
|
1. Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology.
|
||||||
2. In the main view, delete all files except for Assets and LaunchScreen
|
2. In the main view, delete all files except for Assets and LaunchScreen
|
||||||
3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj
|
3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj
|
||||||
4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name"
|
4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name"
|
||||||
5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left
|
5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left
|
||||||
6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS"
|
6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS"
|
||||||
7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library.
|
7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library.
|
||||||
8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files
|
8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files
|
||||||
9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function.
|
9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function.
|
||||||
10. Add any assets that your application needs.
|
10. Add any assets that your application needs.
|
||||||
11. Enjoy!
|
11. Enjoy!
|
||||||
|
|
||||||
|
|
||||||
TODO: Add information regarding App Store requirements such as icons, etc.
|
TODO: Add information regarding App Store requirements such as icons, etc.
|
||||||
|
|
||||||
|
|
||||||
Notes -- Retina / High-DPI and window sizes
|
Notes -- Retina / High-DPI and window sizes
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Window and display mode sizes in SDL are in "screen coordinates" (or "points",
|
Window and display mode sizes in SDL are in "screen coordinates" (or "points",
|
||||||
in Apple's terminology) rather than in pixels. On iOS this means that a window
|
in Apple's terminology) rather than in pixels. On iOS this means that a window
|
||||||
created on an iPhone 6 will have a size in screen coordinates of 375 x 667,
|
created on an iPhone 6 will have a size in screen coordinates of 375 x 667,
|
||||||
rather than a size in pixels of 750 x 1334. All iOS apps are expected to
|
rather than a size in pixels of 750 x 1334. All iOS apps are expected to
|
||||||
size their content based on screen coordinates / points rather than pixels,
|
size their content based on screen coordinates / points rather than pixels,
|
||||||
as this allows different iOS devices to have different pixel densities
|
as this allows different iOS devices to have different pixel densities
|
||||||
(Retina versus non-Retina screens, etc.) without apps caring too much.
|
(Retina versus non-Retina screens, etc.) without apps caring too much.
|
||||||
|
|
||||||
By default SDL will not use the full pixel density of the screen on
|
By default SDL will not use the full pixel density of the screen on
|
||||||
Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
|
Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
|
||||||
creating your window to enable high-dpi support.
|
creating your window to enable high-dpi support.
|
||||||
|
|
||||||
When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
|
When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
|
||||||
will still be in "screen coordinates" rather than pixels, but the window will
|
will still be in "screen coordinates" rather than pixels, but the window will
|
||||||
have a much greater pixel density when the device supports it, and the
|
have a much greater pixel density when the device supports it, and the
|
||||||
SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
|
SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
|
||||||
whether raw OpenGL or the SDL_Render API is used) can be queried to determine
|
whether raw OpenGL or the SDL_Render API is used) can be queried to determine
|
||||||
the size in pixels of the drawable screen framebuffer.
|
the size in pixels of the drawable screen framebuffer.
|
||||||
|
|
||||||
Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
|
Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
|
||||||
sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
|
sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
|
||||||
orthographic projection matrix using the size in screen coordinates
|
orthographic projection matrix using the size in screen coordinates
|
||||||
(SDL_GetWindowSize()) can be used in order to display content at the same scale
|
(SDL_GetWindowSize()) can be used in order to display content at the same scale
|
||||||
no matter whether a Retina device is used or not.
|
no matter whether a Retina device is used or not.
|
||||||
|
|
||||||
|
|
||||||
Notes -- Application events
|
Notes -- Application events
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
On iOS the application goes through a fixed life cycle and you will get
|
On iOS the application goes through a fixed life cycle and you will get
|
||||||
notifications of state changes via application events. When these events
|
notifications of state changes via application events. When these events
|
||||||
are delivered you must handle them in an event callback because the OS may
|
are delivered you must handle them in an event callback because the OS may
|
||||||
not give you any processing time after the events are delivered.
|
not give you any processing time after the events are delivered.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
int HandleAppEvents(void *userdata, SDL_Event *event)
|
int HandleAppEvents(void *userdata, SDL_Event *event)
|
||||||
{
|
{
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case SDL_APP_TERMINATING:
|
case SDL_APP_TERMINATING:
|
||||||
/* Terminate the app.
|
/* Terminate the app.
|
||||||
Shut everything down before returning from this function.
|
Shut everything down before returning from this function.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_LOWMEMORY:
|
case SDL_APP_LOWMEMORY:
|
||||||
/* You will get this when your app is paused and iOS wants more memory.
|
/* You will get this when your app is paused and iOS wants more memory.
|
||||||
Release as much memory as possible.
|
Release as much memory as possible.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_WILLENTERBACKGROUND:
|
case SDL_APP_WILLENTERBACKGROUND:
|
||||||
/* Prepare your app to go into the background. Stop loops, etc.
|
/* Prepare your app to go into the background. Stop loops, etc.
|
||||||
This gets called when the user hits the home button, or gets a call.
|
This gets called when the user hits the home button, or gets a call.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_DIDENTERBACKGROUND:
|
case SDL_APP_DIDENTERBACKGROUND:
|
||||||
/* This will get called if the user accepted whatever sent your app to the background.
|
/* This will get called if the user accepted whatever sent your app to the background.
|
||||||
If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
|
If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
|
||||||
When you get this, you have 5 seconds to save all your state or the app will be terminated.
|
When you get this, you have 5 seconds to save all your state or the app will be terminated.
|
||||||
Your app is NOT active at this point.
|
Your app is NOT active at this point.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_WILLENTERFOREGROUND:
|
case SDL_APP_WILLENTERFOREGROUND:
|
||||||
/* This call happens when your app is coming back to the foreground.
|
/* This call happens when your app is coming back to the foreground.
|
||||||
Restore all your state here.
|
Restore all your state here.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case SDL_APP_DIDENTERFOREGROUND:
|
case SDL_APP_DIDENTERFOREGROUND:
|
||||||
/* Restart your loops here.
|
/* Restart your loops here.
|
||||||
Your app is interactive and getting CPU again.
|
Your app is interactive and getting CPU again.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
/* No special processing, add it to the event queue */
|
/* No special processing, add it to the event queue */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_SetEventFilter(HandleAppEvents, NULL);
|
SDL_SetEventFilter(HandleAppEvents, NULL);
|
||||||
|
|
||||||
... run your main loop
|
... run your main loop
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Notes -- Accelerometer as Joystick
|
Notes -- Accelerometer as Joystick
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory.
|
SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory.
|
||||||
|
|
||||||
The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
|
The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
|
||||||
|
|
||||||
|
|
||||||
Notes -- OpenGL ES
|
Notes -- OpenGL ES
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Your SDL application for iOS uses OpenGL ES for video by default.
|
Your SDL application for iOS uses OpenGL ES for video by default.
|
||||||
|
|
||||||
OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
|
OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
|
||||||
|
|
||||||
If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
|
If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
|
||||||
|
|
||||||
Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
|
Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
|
||||||
|
|
||||||
OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
|
OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
|
||||||
|
|
||||||
- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
|
- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
|
||||||
- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
|
- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
|
||||||
- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
|
- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
|
||||||
|
|
||||||
The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
|
The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
|
||||||
|
|
||||||
|
|
||||||
Notes -- Keyboard
|
Notes -- Keyboard
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
The SDL keyboard API has been extended to support on-screen keyboards:
|
The SDL keyboard API has been extended to support on-screen keyboards:
|
||||||
|
|
||||||
void SDL_StartTextInput()
|
void SDL_StartTextInput()
|
||||||
-- enables text events and reveals the onscreen keyboard.
|
-- enables text events and reveals the onscreen keyboard.
|
||||||
|
|
||||||
void SDL_StopTextInput()
|
void SDL_StopTextInput()
|
||||||
-- disables text events and hides the onscreen keyboard.
|
-- disables text events and hides the onscreen keyboard.
|
||||||
|
|
||||||
SDL_bool SDL_IsTextInputActive()
|
SDL_bool SDL_IsTextInputActive()
|
||||||
-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
|
-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
|
||||||
|
|
||||||
|
|
||||||
Notes -- Mouse
|
Notes -- Mouse
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
iOS now supports Bluetooth mice on iPad, but by default will provide the mouse input as touch. In order for SDL to see the real mouse events, you should set the key UIApplicationSupportsIndirectInputEvents to true in your Info.plist
|
iOS now supports Bluetooth mice on iPad, but by default will provide the mouse input as touch. In order for SDL to see the real mouse events, you should set the key UIApplicationSupportsIndirectInputEvents to true in your Info.plist
|
||||||
|
|
||||||
|
|
||||||
Notes -- Reading and Writing files
|
Notes -- Reading and Writing files
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory.
|
Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory.
|
||||||
|
|
||||||
Once your application is installed its directory tree looks like:
|
Once your application is installed its directory tree looks like:
|
||||||
|
|
||||||
MySDLApp Home/
|
MySDLApp Home/
|
||||||
MySDLApp.app
|
MySDLApp.app
|
||||||
Documents/
|
Documents/
|
||||||
Library/
|
Library/
|
||||||
Preferences/
|
Preferences/
|
||||||
tmp/
|
tmp/
|
||||||
|
|
||||||
When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
|
When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
|
||||||
|
|
||||||
More information on this subject is available here:
|
More information on this subject is available here:
|
||||||
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
|
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
|
||||||
|
|
||||||
|
|
||||||
Notes -- xcFramework
|
Notes -- xcFramework
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform.
|
The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform.
|
||||||
|
|
||||||
In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package.
|
In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package.
|
||||||
|
|
||||||
The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac.
|
The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac.
|
||||||
|
|
||||||
This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes.
|
This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes.
|
||||||
|
|
||||||
In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this:
|
In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this:
|
||||||
|
|
||||||
#ifndef SDL_MAIN_HANDLED
|
#ifndef SDL_MAIN_HANDLED
|
||||||
#ifdef main
|
#ifdef main
|
||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return SDL_UIKitRunApp(argc, argv, SDL_main);
|
return SDL_UIKitRunApp(argc, argv, SDL_main);
|
||||||
}
|
}
|
||||||
#endif /* !SDL_MAIN_HANDLED */
|
#endif /* !SDL_MAIN_HANDLED */
|
||||||
|
|
||||||
Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected:
|
Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected:
|
||||||
|
|
||||||
#include "SDL_main.h"
|
#include "SDL_main.h"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_main.h>
|
#include <SDL_main.h>
|
||||||
|
|
||||||
|
|
||||||
Notes -- iPhone SDL limitations
|
Notes -- iPhone SDL limitations
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS).
|
Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS).
|
||||||
|
|
||||||
Textures:
|
Textures:
|
||||||
The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
|
The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
|
||||||
|
|
||||||
Loading Shared Objects:
|
Loading Shared Objects:
|
||||||
This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h.
|
This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h.
|
||||||
|
|
||||||
|
|
||||||
Notes -- CoreBluetooth.framework
|
Notes -- CoreBluetooth.framework
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
SDL_JOYSTICK_HIDAPI is disabled by default. It can give you access to a lot
|
SDL_JOYSTICK_HIDAPI is disabled by default. It can give you access to a lot
|
||||||
more game controller devices, but it requires permission from the user before
|
more game controller devices, but it requires permission from the user before
|
||||||
your app will be able to talk to the Bluetooth hardware. "Made For iOS"
|
your app will be able to talk to the Bluetooth hardware. "Made For iOS"
|
||||||
branded controllers do not need this as we don't have to speak to them
|
branded controllers do not need this as we don't have to speak to them
|
||||||
directly with raw bluetooth, so many apps can live without this.
|
directly with raw bluetooth, so many apps can live without this.
|
||||||
|
|
||||||
You'll need to link with CoreBluetooth.framework and add something like this
|
You'll need to link with CoreBluetooth.framework and add something like this
|
||||||
to your Info.plist:
|
to your Info.plist:
|
||||||
|
|
||||||
<key>NSBluetoothPeripheralUsageDescription</key>
|
<key>NSBluetoothPeripheralUsageDescription</key>
|
||||||
<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
|
<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
|
||||||
|
|
||||||
|
|
||||||
Game Center
|
Game Center
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
|
Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
|
||||||
|
|
||||||
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
|
||||||
|
|
||||||
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
|
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
void ShowFrame(void*)
|
void ShowFrame(void*)
|
||||||
{
|
{
|
||||||
... do event handling, frame logic and rendering ...
|
... do event handling, frame logic and rendering ...
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
... initialize game ...
|
... initialize game ...
|
||||||
|
|
||||||
#ifdef __IPHONEOS__
|
#ifdef __IPHONEOS__
|
||||||
// Initialize the Game Center for scoring and matchmaking
|
// Initialize the Game Center for scoring and matchmaking
|
||||||
InitGameCenter();
|
InitGameCenter();
|
||||||
|
|
||||||
// Set up the game to run in the window animation callback on iOS
|
// Set up the game to run in the window animation callback on iOS
|
||||||
// so that Game Center and so forth works correctly.
|
// so that Game Center and so forth works correctly.
|
||||||
SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
|
SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
|
||||||
#else
|
#else
|
||||||
while ( running ) {
|
while ( running ) {
|
||||||
ShowFrame(0);
|
ShowFrame(0);
|
||||||
DelayFrame();
|
DelayFrame();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Deploying to older versions of iOS
|
Deploying to older versions of iOS
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
|
SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
|
||||||
|
|
||||||
In order to do that you need to download an older version of Xcode:
|
In order to do that you need to download an older version of Xcode:
|
||||||
https://developer.apple.com/download/more/?name=Xcode
|
https://developer.apple.com/download/more/?name=Xcode
|
||||||
|
|
||||||
Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
|
Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
|
||||||
|
|
||||||
Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES
|
Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES
|
||||||
|
|
||||||
Open your project and set your deployment target to the desired version of iOS
|
Open your project and set your deployment target to the desired version of iOS
|
||||||
|
|
||||||
Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController
|
Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController
|
@ -1,27 +1,27 @@
|
|||||||
KMSDRM on *BSD
|
KMSDRM on *BSD
|
||||||
==================================================
|
==================================================
|
||||||
|
|
||||||
KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
|
KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
|
||||||
|
|
||||||
WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
|
WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
|
||||||
|
|
||||||
OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
|
OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
|
||||||
|
|
||||||
|
|
||||||
SDL2 WSCONS input backend features
|
SDL2 WSCONS input backend features
|
||||||
===================================================
|
===================================================
|
||||||
1. It is keymap-aware; it will work properly with different keymaps.
|
1. It is keymap-aware; it will work properly with different keymaps.
|
||||||
2. It has mouse support.
|
2. It has mouse support.
|
||||||
3. Accent input is supported.
|
3. Accent input is supported.
|
||||||
4. Compose keys are supported.
|
4. Compose keys are supported.
|
||||||
5. AltGr and Meta Shift keys work as intended.
|
5. AltGr and Meta Shift keys work as intended.
|
||||||
|
|
||||||
Partially working or no input on OpenBSD/NetBSD.
|
Partially working or no input on OpenBSD/NetBSD.
|
||||||
==================================================
|
==================================================
|
||||||
|
|
||||||
The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
|
The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
|
||||||
|
|
||||||
Partially working or no input on FreeBSD.
|
Partially working or no input on FreeBSD.
|
||||||
==================================================
|
==================================================
|
||||||
|
|
||||||
The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
|
The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
|
@ -1,96 +1,96 @@
|
|||||||
Linux
|
Linux
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
By default SDL will only link against glibc, the rest of the features will be
|
By default SDL will only link against glibc, the rest of the features will be
|
||||||
enabled dynamically at runtime depending on the available features on the target
|
enabled dynamically at runtime depending on the available features on the target
|
||||||
system. So, for example if you built SDL with XRandR support and the target
|
system. So, for example if you built SDL with XRandR support and the target
|
||||||
system does not have the XRandR libraries installed, it will be disabled
|
system does not have the XRandR libraries installed, it will be disabled
|
||||||
at runtime, and you won't get a missing library error, at least with the
|
at runtime, and you won't get a missing library error, at least with the
|
||||||
default configuration parameters.
|
default configuration parameters.
|
||||||
|
|
||||||
|
|
||||||
Build Dependencies
|
Build Dependencies
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Ubuntu 18.04, all available features enabled:
|
Ubuntu 18.04, all available features enabled:
|
||||||
|
|
||||||
sudo apt-get install build-essential git make autoconf automake libtool \
|
sudo apt-get install build-essential git make autoconf automake libtool \
|
||||||
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
|
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
|
||||||
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
|
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
|
||||||
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
|
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
|
||||||
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
||||||
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
|
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
|
||||||
|
|
||||||
Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line.
|
Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line.
|
||||||
|
|
||||||
Fedora 35, all available features enabled:
|
Fedora 35, all available features enabled:
|
||||||
|
|
||||||
sudo yum install gcc git-core make cmake autoconf automake libtool \
|
sudo yum install gcc git-core make cmake autoconf automake libtool \
|
||||||
alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \
|
alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \
|
||||||
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
|
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
|
||||||
libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \
|
libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \
|
||||||
systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
|
systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
|
||||||
mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
|
mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
|
||||||
libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
|
libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
|
||||||
libsamplerate-devel pipewire-jack-audio-connection-kit-devel \
|
libsamplerate-devel pipewire-jack-audio-connection-kit-devel \
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
- This includes all the audio targets except arts and esd, because Ubuntu
|
- This includes all the audio targets except arts and esd, because Ubuntu
|
||||||
(and/or Debian) pulled their packages, but in theory SDL still supports them.
|
(and/or Debian) pulled their packages, but in theory SDL still supports them.
|
||||||
The sndio audio target is also unavailable on Fedora.
|
The sndio audio target is also unavailable on Fedora.
|
||||||
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
|
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
|
||||||
for higher-quality audio resampling. SDL will work without it if the library
|
for higher-quality audio resampling. SDL will work without it if the library
|
||||||
is missing, so it's safe to build in support even if the end user doesn't
|
is missing, so it's safe to build in support even if the end user doesn't
|
||||||
have this library installed.
|
have this library installed.
|
||||||
- DirectFB isn't included because the configure script (currently) fails to find
|
- DirectFB isn't included because the configure script (currently) fails to find
|
||||||
it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
|
it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
|
||||||
configure script to include DirectFB support. Send patches. :)
|
configure script to include DirectFB support. Send patches. :)
|
||||||
|
|
||||||
|
|
||||||
Joystick does not work
|
Joystick does not work
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
If you compiled or are using a version of SDL with udev support (and you should!)
|
If you compiled or are using a version of SDL with udev support (and you should!)
|
||||||
there's a few issues that may cause SDL to fail to detect your joystick. To
|
there's a few issues that may cause SDL to fail to detect your joystick. To
|
||||||
debug this, start by installing the evtest utility. On Ubuntu/Debian:
|
debug this, start by installing the evtest utility. On Ubuntu/Debian:
|
||||||
|
|
||||||
sudo apt-get install evtest
|
sudo apt-get install evtest
|
||||||
|
|
||||||
Then run:
|
Then run:
|
||||||
|
|
||||||
sudo evtest
|
sudo evtest
|
||||||
|
|
||||||
You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
|
You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
|
||||||
Now run:
|
Now run:
|
||||||
|
|
||||||
cat /dev/input/event/XX
|
cat /dev/input/event/XX
|
||||||
|
|
||||||
If you get a permission error, you need to set a udev rule to change the mode of
|
If you get a permission error, you need to set a udev rule to change the mode of
|
||||||
your device (see below)
|
your device (see below)
|
||||||
|
|
||||||
Also, try:
|
Also, try:
|
||||||
|
|
||||||
sudo udevadm info --query=all --name=input/eventXX
|
sudo udevadm info --query=all --name=input/eventXX
|
||||||
|
|
||||||
If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
|
If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
|
||||||
you need to set up an udev rule to force this variable.
|
you need to set up an udev rule to force this variable.
|
||||||
|
|
||||||
A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
|
A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
|
||||||
like:
|
like:
|
||||||
|
|
||||||
SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
|
SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
|
||||||
SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
|
SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
|
||||||
|
|
||||||
You can set up similar rules for your device by changing the values listed in
|
You can set up similar rules for your device by changing the values listed in
|
||||||
idProduct and idVendor. To obtain these values, try:
|
idProduct and idVendor. To obtain these values, try:
|
||||||
|
|
||||||
sudo udevadm info -a --name=input/eventXX | grep idVendor
|
sudo udevadm info -a --name=input/eventXX | grep idVendor
|
||||||
sudo udevadm info -a --name=input/eventXX | grep idProduct
|
sudo udevadm info -a --name=input/eventXX | grep idProduct
|
||||||
|
|
||||||
If multiple values come up for each of these, the one you want is the first one of each.
|
If multiple values come up for each of these, the one you want is the first one of each.
|
||||||
|
|
||||||
On other systems which ship with an older udev (such as CentOS), you may need
|
On other systems which ship with an older udev (such as CentOS), you may need
|
||||||
to set up a rule such as:
|
to set up a rule such as:
|
||||||
|
|
||||||
SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
|
SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
|
||||||
|
|
@ -1,285 +1,285 @@
|
|||||||
# Mac OS X (aka macOS).
|
# Mac OS X (aka macOS).
|
||||||
|
|
||||||
These instructions are for people using Apple's Mac OS X (pronounced
|
These instructions are for people using Apple's Mac OS X (pronounced
|
||||||
"ten"), which in newer versions is just referred to as "macOS".
|
"ten"), which in newer versions is just referred to as "macOS".
|
||||||
|
|
||||||
From the developer's point of view, macOS is a sort of hybrid Mac and
|
From the developer's point of view, macOS is a sort of hybrid Mac and
|
||||||
Unix system, and you have the option of using either traditional
|
Unix system, and you have the option of using either traditional
|
||||||
command line tools or Apple's IDE Xcode.
|
command line tools or Apple's IDE Xcode.
|
||||||
|
|
||||||
# Command Line Build
|
# Command Line Build
|
||||||
|
|
||||||
To build SDL using the command line, use the standard configure and make
|
To build SDL using the command line, use the standard configure and make
|
||||||
process:
|
process:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
../configure
|
../configure
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
CMake is also known to work, although it continues to be a work in progress:
|
CMake is also known to work, although it continues to be a work in progress:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
You can also build SDL as a Universal library (a single binary for both
|
You can also build SDL as a Universal library (a single binary for both
|
||||||
64-bit Intel and ARM architectures), by using the build-scripts/clang-fat.sh
|
64-bit Intel and ARM architectures), by using the build-scripts/clang-fat.sh
|
||||||
script.
|
script.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
CC=$PWD/../build-scripts/clang-fat.sh ../configure
|
CC=$PWD/../build-scripts/clang-fat.sh ../configure
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0
|
This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0
|
||||||
ABI compatibility on ARM64 architectures. For best compatibility you
|
ABI compatibility on ARM64 architectures. For best compatibility you
|
||||||
should compile your application the same way.
|
should compile your application the same way.
|
||||||
|
|
||||||
Please note that building SDL requires at least Xcode 6 and the 10.9 SDK.
|
Please note that building SDL requires at least Xcode 6 and the 10.9 SDK.
|
||||||
PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
|
PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
|
||||||
32-bit Intel and macOS 10.8 runtime support has been officially dropped as
|
32-bit Intel and macOS 10.8 runtime support has been officially dropped as
|
||||||
of SDL 2.24.0.
|
of SDL 2.24.0.
|
||||||
|
|
||||||
To use the library once it's built, you essential have two possibilities:
|
To use the library once it's built, you essential have two possibilities:
|
||||||
use the traditional autoconf/automake/make method, or use Xcode.
|
use the traditional autoconf/automake/make method, or use Xcode.
|
||||||
|
|
||||||
|
|
||||||
# Caveats for using SDL with Mac OS X
|
# Caveats for using SDL with Mac OS X
|
||||||
|
|
||||||
If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
|
If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
|
||||||
SDL will not register its own. This means that SDL will not terminate using
|
SDL will not register its own. This means that SDL will not terminate using
|
||||||
SDL_Quit if it receives a termination request, it will terminate like a
|
SDL_Quit if it receives a termination request, it will terminate like a
|
||||||
normal app, and it will not send a SDL_DROPFILE when you request to open a
|
normal app, and it will not send a SDL_DROPFILE when you request to open a
|
||||||
file with the app. To solve these issues, put the following code in your
|
file with the app. To solve these issues, put the following code in your
|
||||||
NSApplicationDelegate implementation:
|
NSApplicationDelegate implementation:
|
||||||
|
|
||||||
|
|
||||||
```objc
|
```objc
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
|
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_QUIT;
|
event.type = SDL_QUIT;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NSTerminateCancel;
|
return NSTerminateCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||||
{
|
{
|
||||||
if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
|
if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_DROPFILE;
|
event.type = SDL_DROPFILE;
|
||||||
event.drop.file = SDL_strdup([filename UTF8String]);
|
event.drop.file = SDL_strdup([filename UTF8String]);
|
||||||
return (SDL_PushEvent(&event) > 0);
|
return (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Using the Simple DirectMedia Layer with a traditional Makefile
|
# Using the Simple DirectMedia Layer with a traditional Makefile
|
||||||
|
|
||||||
An existing autoconf/automake build system for your SDL app has good chances
|
An existing autoconf/automake build system for your SDL app has good chances
|
||||||
to work almost unchanged on macOS. However, to produce a "real" Mac binary
|
to work almost unchanged on macOS. However, to produce a "real" Mac binary
|
||||||
that you can distribute to users, you need to put the generated binary into a
|
that you can distribute to users, you need to put the generated binary into a
|
||||||
so called "bundle", which is basically a fancy folder with a name like
|
so called "bundle", which is basically a fancy folder with a name like
|
||||||
"MyCoolGame.app".
|
"MyCoolGame.app".
|
||||||
|
|
||||||
To get this build automatically, add something like the following rule to
|
To get this build automatically, add something like the following rule to
|
||||||
your Makefile.am:
|
your Makefile.am:
|
||||||
|
|
||||||
```make
|
```make
|
||||||
bundle_contents = APP_NAME.app/Contents
|
bundle_contents = APP_NAME.app/Contents
|
||||||
APP_NAME_bundle: EXE_NAME
|
APP_NAME_bundle: EXE_NAME
|
||||||
mkdir -p $(bundle_contents)/MacOS
|
mkdir -p $(bundle_contents)/MacOS
|
||||||
mkdir -p $(bundle_contents)/Resources
|
mkdir -p $(bundle_contents)/Resources
|
||||||
echo "APPL????" > $(bundle_contents)/PkgInfo
|
echo "APPL????" > $(bundle_contents)/PkgInfo
|
||||||
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
|
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
|
||||||
```
|
```
|
||||||
|
|
||||||
You should replace `EXE_NAME` with the name of the executable. `APP_NAME` is
|
You should replace `EXE_NAME` with the name of the executable. `APP_NAME` is
|
||||||
what will be visible to the user in the Finder. Usually it will be the same
|
what will be visible to the user in the Finder. Usually it will be the same
|
||||||
as `EXE_NAME` but capitalized. E.g. if `EXE_NAME` is "testgame" then `APP_NAME`
|
as `EXE_NAME` but capitalized. E.g. if `EXE_NAME` is "testgame" then `APP_NAME`
|
||||||
usually is "TestGame". You might also want to use `@PACKAGE@` to use the
|
usually is "TestGame". You might also want to use `@PACKAGE@` to use the
|
||||||
package name as specified in your configure.ac file.
|
package name as specified in your configure.ac file.
|
||||||
|
|
||||||
If your project builds more than one application, you will have to do a bit
|
If your project builds more than one application, you will have to do a bit
|
||||||
more. For each of your target applications, you need a separate rule.
|
more. For each of your target applications, you need a separate rule.
|
||||||
|
|
||||||
If you want the created bundles to be installed, you may want to add this
|
If you want the created bundles to be installed, you may want to add this
|
||||||
rule to your Makefile.am:
|
rule to your Makefile.am:
|
||||||
|
|
||||||
```make
|
```make
|
||||||
install-exec-hook: APP_NAME_bundle
|
install-exec-hook: APP_NAME_bundle
|
||||||
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
|
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
|
||||||
mkdir -p $(DESTDIR)$(prefix)/Applications/
|
mkdir -p $(DESTDIR)$(prefix)/Applications/
|
||||||
cp -r $< /$(DESTDIR)$(prefix)Applications/
|
cp -r $< /$(DESTDIR)$(prefix)Applications/
|
||||||
```
|
```
|
||||||
|
|
||||||
This rule takes the Bundle created by the rule from step 3 and installs them
|
This rule takes the Bundle created by the rule from step 3 and installs them
|
||||||
into "$(DESTDIR)$(prefix)/Applications/".
|
into "$(DESTDIR)$(prefix)/Applications/".
|
||||||
|
|
||||||
Again, if you want to install multiple applications, you will have to augment
|
Again, if you want to install multiple applications, you will have to augment
|
||||||
the make rule accordingly.
|
the make rule accordingly.
|
||||||
|
|
||||||
But beware! That is only part of the story! With the above, you end up with
|
But beware! That is only part of the story! With the above, you end up with
|
||||||
a barebones .app bundle, which is double-clickable from the Finder. But
|
a barebones .app bundle, which is double-clickable from the Finder. But
|
||||||
there are some more things you should do before shipping your product...
|
there are some more things you should do before shipping your product...
|
||||||
|
|
||||||
1. The bundle right now probably is dynamically linked against SDL. That
|
1. The bundle right now probably is dynamically linked against SDL. That
|
||||||
means that when you copy it to another computer, *it will not run*,
|
means that when you copy it to another computer, *it will not run*,
|
||||||
unless you also install SDL on that other computer. A good solution
|
unless you also install SDL on that other computer. A good solution
|
||||||
for this dilemma is to static link against SDL. On OS X, you can
|
for this dilemma is to static link against SDL. On OS X, you can
|
||||||
achieve that by linking against the libraries listed by
|
achieve that by linking against the libraries listed by
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sdl-config --static-libs
|
sdl-config --static-libs
|
||||||
```
|
```
|
||||||
|
|
||||||
instead of those listed by
|
instead of those listed by
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sdl-config --libs
|
sdl-config --libs
|
||||||
```
|
```
|
||||||
|
|
||||||
Depending on how exactly SDL is integrated into your build systems, the
|
Depending on how exactly SDL is integrated into your build systems, the
|
||||||
way to achieve that varies, so I won't describe it here in detail
|
way to achieve that varies, so I won't describe it here in detail
|
||||||
|
|
||||||
2. Add an 'Info.plist' to your application. That is a special XML file which
|
2. Add an 'Info.plist' to your application. That is a special XML file which
|
||||||
contains some meta-information about your application (like some copyright
|
contains some meta-information about your application (like some copyright
|
||||||
information, the version of your app, the name of an optional icon file,
|
information, the version of your app, the name of an optional icon file,
|
||||||
and other things). Part of that information is displayed by the Finder
|
and other things). Part of that information is displayed by the Finder
|
||||||
when you click on the .app, or if you look at the "Get Info" window.
|
when you click on the .app, or if you look at the "Get Info" window.
|
||||||
More information about Info.plist files can be found on Apple's homepage.
|
More information about Info.plist files can be found on Apple's homepage.
|
||||||
|
|
||||||
|
|
||||||
As a final remark, let me add that I use some of the techniques (and some
|
As a final remark, let me add that I use some of the techniques (and some
|
||||||
variations of them) in [Exult](https://github.com/exult/exult) and
|
variations of them) in [Exult](https://github.com/exult/exult) and
|
||||||
[ScummVM](https://github.com/scummvm/scummvm); both are available in source on
|
[ScummVM](https://github.com/scummvm/scummvm); both are available in source on
|
||||||
the net, so feel free to take a peek at them for inspiration!
|
the net, so feel free to take a peek at them for inspiration!
|
||||||
|
|
||||||
|
|
||||||
# Using the Simple DirectMedia Layer with Xcode
|
# Using the Simple DirectMedia Layer with Xcode
|
||||||
|
|
||||||
These instructions are for using Apple's Xcode IDE to build SDL applications.
|
These instructions are for using Apple's Xcode IDE to build SDL applications.
|
||||||
|
|
||||||
## First steps
|
## First steps
|
||||||
|
|
||||||
The first thing to do is to unpack the Xcode.tar.gz archive in the
|
The first thing to do is to unpack the Xcode.tar.gz archive in the
|
||||||
top level SDL directory (where the Xcode.tar.gz archive resides).
|
top level SDL directory (where the Xcode.tar.gz archive resides).
|
||||||
Because Stuffit Expander will unpack the archive into a subdirectory,
|
Because Stuffit Expander will unpack the archive into a subdirectory,
|
||||||
you should unpack the archive manually from the command line:
|
you should unpack the archive manually from the command line:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd [path_to_SDL_source]
|
cd [path_to_SDL_source]
|
||||||
tar zxf Xcode.tar.gz
|
tar zxf Xcode.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
This will create a new folder called Xcode, which you can browse
|
This will create a new folder called Xcode, which you can browse
|
||||||
normally from the Finder.
|
normally from the Finder.
|
||||||
|
|
||||||
## Building the Framework
|
## Building the Framework
|
||||||
|
|
||||||
The SDL Library is packaged as a framework bundle, an organized
|
The SDL Library is packaged as a framework bundle, an organized
|
||||||
relocatable folder hierarchy of executable code, interface headers,
|
relocatable folder hierarchy of executable code, interface headers,
|
||||||
and additional resources. For practical purposes, you can think of a
|
and additional resources. For practical purposes, you can think of a
|
||||||
framework as a more user and system-friendly shared library, whose library
|
framework as a more user and system-friendly shared library, whose library
|
||||||
file behaves more or less like a standard UNIX shared library.
|
file behaves more or less like a standard UNIX shared library.
|
||||||
|
|
||||||
To build the framework, simply open the framework project and build it.
|
To build the framework, simply open the framework project and build it.
|
||||||
By default, the framework bundle "SDL.framework" is installed in
|
By default, the framework bundle "SDL.framework" is installed in
|
||||||
/Library/Frameworks. Therefore, the testers and project stationary expect
|
/Library/Frameworks. Therefore, the testers and project stationary expect
|
||||||
it to be located there. However, it will function the same in any of the
|
it to be located there. However, it will function the same in any of the
|
||||||
following locations:
|
following locations:
|
||||||
|
|
||||||
* ~/Library/Frameworks
|
* ~/Library/Frameworks
|
||||||
* /Local/Library/Frameworks
|
* /Local/Library/Frameworks
|
||||||
* /System/Library/Frameworks
|
* /System/Library/Frameworks
|
||||||
|
|
||||||
## Build Options
|
## Build Options
|
||||||
|
|
||||||
There are two "Build Styles" (See the "Targets" tab) for SDL.
|
There are two "Build Styles" (See the "Targets" tab) for SDL.
|
||||||
"Deployment" should be used if you aren't tweaking the SDL library.
|
"Deployment" should be used if you aren't tweaking the SDL library.
|
||||||
"Development" should be used to debug SDL apps or the library itself.
|
"Development" should be used to debug SDL apps or the library itself.
|
||||||
|
|
||||||
## Building the Testers
|
## Building the Testers
|
||||||
|
|
||||||
Open the SDLTest project and build away!
|
Open the SDLTest project and build away!
|
||||||
|
|
||||||
## Using the Project Stationary
|
## Using the Project Stationary
|
||||||
|
|
||||||
Copy the stationary to the indicated folders to access it from
|
Copy the stationary to the indicated folders to access it from
|
||||||
the "New Project" and "Add target" menus. What could be easier?
|
the "New Project" and "Add target" menus. What could be easier?
|
||||||
|
|
||||||
## Setting up a new project by hand
|
## Setting up a new project by hand
|
||||||
|
|
||||||
Some of you won't want to use the Stationary so I'll give some tips:
|
Some of you won't want to use the Stationary so I'll give some tips:
|
||||||
|
|
||||||
(this is accurate as of Xcode 12.5.)
|
(this is accurate as of Xcode 12.5.)
|
||||||
|
|
||||||
* Click "File" -> "New" -> "Project...
|
* Click "File" -> "New" -> "Project...
|
||||||
* Choose "macOS" and then "App" from the "Application" section.
|
* Choose "macOS" and then "App" from the "Application" section.
|
||||||
* Fill out the options in the next window. User interface is "XIB" and
|
* Fill out the options in the next window. User interface is "XIB" and
|
||||||
Language is "Objective-C".
|
Language is "Objective-C".
|
||||||
* Remove "main.m" from your project
|
* Remove "main.m" from your project
|
||||||
* Remove "MainMenu.xib" from your project
|
* Remove "MainMenu.xib" from your project
|
||||||
* Remove "AppDelegates.*" from your project
|
* Remove "AppDelegates.*" from your project
|
||||||
* Add "\$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
|
* Add "\$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
|
||||||
* Add "\$(HOME)/Library/Frameworks" to the frameworks search path
|
* Add "\$(HOME)/Library/Frameworks" to the frameworks search path
|
||||||
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
|
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
|
||||||
* Add your files
|
* Add your files
|
||||||
* Clean and build
|
* Clean and build
|
||||||
|
|
||||||
## Building from command line
|
## Building from command line
|
||||||
|
|
||||||
Use `xcode-build` in the same directory as your .pbxproj file
|
Use `xcode-build` in the same directory as your .pbxproj file
|
||||||
|
|
||||||
## Running your app
|
## Running your app
|
||||||
|
|
||||||
You can send command line args to your app by either invoking it from
|
You can send command line args to your app by either invoking it from
|
||||||
the command line (in *.app/Contents/MacOS) or by entering them in the
|
the command line (in *.app/Contents/MacOS) or by entering them in the
|
||||||
Executables" panel of the target settings.
|
Executables" panel of the target settings.
|
||||||
|
|
||||||
# Implementation Notes
|
# Implementation Notes
|
||||||
|
|
||||||
Some things that may be of interest about how it all works...
|
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.
|
||||||
|
|
||||||
|
|
||||||
## You have a Cocoa App!
|
## You have a Cocoa App!
|
||||||
|
|
||||||
Your SDL app is essentially a Cocoa application. When your app
|
Your SDL app is essentially a Cocoa application. When your app
|
||||||
starts up and the libraries finish loading, a Cocoa procedure is called,
|
starts up and the libraries finish loading, a Cocoa procedure is called,
|
||||||
which sets up the working directory and calls your main() method.
|
which sets up the working directory and calls your main() method.
|
||||||
You are free to modify your Cocoa app with generally no consequence
|
You are free to modify your Cocoa app with generally no consequence
|
||||||
to SDL. You cannot, however, easily change the SDL window itself.
|
to SDL. You cannot, however, easily change the SDL window itself.
|
||||||
Functionality may be added in the future to help this.
|
Functionality may be added in the future to help this.
|
||||||
|
|
||||||
# Bug reports
|
# Bug reports
|
||||||
|
|
||||||
Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/).
|
Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/).
|
||||||
Please feel free to report bugs there!
|
Please feel free to report bugs there!
|
||||||
|
|
@ -1,28 +1,28 @@
|
|||||||
# Nintendo 3DS
|
# Nintendo 3DS
|
||||||
|
|
||||||
SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
|
SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
|
||||||
|
|
||||||
- [Pierre Wendling](https://github.com/FtZPetruska)
|
- [Pierre Wendling](https://github.com/FtZPetruska)
|
||||||
|
|
||||||
Credits to:
|
Credits to:
|
||||||
|
|
||||||
- The awesome people who ported SDL to other homebrew platforms.
|
- The awesome people who ported SDL to other homebrew platforms.
|
||||||
- The Devkitpro team for making all the tools necessary to achieve this.
|
- The Devkitpro team for making all the tools necessary to achieve this.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
|
To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
|
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build build
|
cmake --build build
|
||||||
cmake --install build
|
cmake --install build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Currently only software rendering is supported.
|
- Currently only software rendering is supported.
|
||||||
- SDL2main should be used to ensure ROMFS is enabled.
|
- SDL2main should be used to ensure ROMFS is enabled.
|
||||||
- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
|
- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
|
||||||
- `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
|
- `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
|
||||||
- The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.
|
- The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.
|
@ -1,103 +1,103 @@
|
|||||||
Native Client
|
Native Client
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
* Native Client SDK (https://developer.chrome.com/native-client),
|
* Native Client SDK (https://developer.chrome.com/native-client),
|
||||||
(tested with Pepper version 33 or higher).
|
(tested with Pepper version 33 or higher).
|
||||||
|
|
||||||
The SDL backend for Chrome's Native Client has been tested only with the PNaCl
|
The SDL backend for Chrome's Native Client has been tested only with the PNaCl
|
||||||
toolchain, which generates binaries designed to run on ARM and x86_32/64
|
toolchain, which generates binaries designed to run on ARM and x86_32/64
|
||||||
platforms. This does not mean it won't work with the other toolchains!
|
platforms. This does not mean it won't work with the other toolchains!
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Building SDL for NaCl
|
Building SDL for NaCl
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Set up the right environment variables (see naclbuild.sh), then configure SDL with:
|
Set up the right environment variables (see naclbuild.sh), then configure SDL with:
|
||||||
|
|
||||||
configure --host=pnacl --prefix some/install/destination
|
configure --host=pnacl --prefix some/install/destination
|
||||||
|
|
||||||
Then "make".
|
Then "make".
|
||||||
|
|
||||||
As an example of how to create a deployable app a Makefile project is provided
|
As an example of how to create a deployable app a Makefile project is provided
|
||||||
in test/nacl/Makefile, which includes some monkey patching of the common.mk file
|
in test/nacl/Makefile, which includes some monkey patching of the common.mk file
|
||||||
provided by NaCl, without which linking properly to SDL won't work (the search
|
provided by NaCl, without which linking properly to SDL won't work (the search
|
||||||
path can't be modified externally, so the linker won't find SDL's binaries unless
|
path can't be modified externally, so the linker won't find SDL's binaries unless
|
||||||
you dump them into the SDK path, which is inconvenient).
|
you dump them into the SDK path, which is inconvenient).
|
||||||
Also provided in test/nacl is the required support file, such as index.html,
|
Also provided in test/nacl is the required support file, such as index.html,
|
||||||
manifest.json, etc.
|
manifest.json, etc.
|
||||||
SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
|
SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
|
||||||
This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
|
This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
|
||||||
hiding the asynchronous nature of the browser behind the scenes...which is not the
|
hiding the asynchronous nature of the browser behind the scenes...which is not the
|
||||||
same as making it disappear!
|
same as making it disappear!
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Running tests
|
Running tests
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
Due to the nature of NaCl programs, building and running SDL tests is not as
|
Due to the nature of NaCl programs, building and running SDL tests is not as
|
||||||
straightforward as one would hope. The script naclbuild.sh in build-scripts
|
straightforward as one would hope. The script naclbuild.sh in build-scripts
|
||||||
automates the process and should serve as a guide for users of SDL trying to build
|
automates the process and should serve as a guide for users of SDL trying to build
|
||||||
their own applications.
|
their own applications.
|
||||||
|
|
||||||
Basic usage:
|
Basic usage:
|
||||||
|
|
||||||
./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
|
./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
|
||||||
|
|
||||||
This will build testgles2.c by default.
|
This will build testgles2.c by default.
|
||||||
|
|
||||||
If you want to build a different test, for example testrendercopyex.c:
|
If you want to build a different test, for example testrendercopyex.c:
|
||||||
|
|
||||||
SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
|
SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
|
||||||
|
|
||||||
Once the build finishes, you have to serve the contents with a web server (the
|
Once the build finishes, you have to serve the contents with a web server (the
|
||||||
script will give you instructions on how to do that with Python).
|
script will give you instructions on how to do that with Python).
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
RWops and nacl_io
|
RWops and nacl_io
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
SDL_RWops work transparently with nacl_io. Two functions control the mount points:
|
SDL_RWops work transparently with nacl_io. Two functions control the mount points:
|
||||||
|
|
||||||
int mount(const char* source, const char* target,
|
int mount(const char* source, const char* target,
|
||||||
const char* filesystemtype,
|
const char* filesystemtype,
|
||||||
unsigned long mountflags, const void *data);
|
unsigned long mountflags, const void *data);
|
||||||
int umount(const char *target);
|
int umount(const char *target);
|
||||||
|
|
||||||
For convenience, SDL will by default mount an httpfs tree at / before calling
|
For convenience, SDL will by default mount an httpfs tree at / before calling
|
||||||
the app's main function. Such setting can be overridden by calling:
|
the app's main function. Such setting can be overridden by calling:
|
||||||
|
|
||||||
umount("/");
|
umount("/");
|
||||||
|
|
||||||
And then mounting a different filesystem at /
|
And then mounting a different filesystem at /
|
||||||
|
|
||||||
It's important to consider that the asynchronous nature of file operations on a
|
It's important to consider that the asynchronous nature of file operations on a
|
||||||
browser is hidden from the application, effectively providing the developer with
|
browser is hidden from the application, effectively providing the developer with
|
||||||
a set of blocking file operations just like you get in a regular desktop
|
a set of blocking file operations just like you get in a regular desktop
|
||||||
environment, which eases the job of porting to Native Client, but also introduces
|
environment, which eases the job of porting to Native Client, but also introduces
|
||||||
a set of challenges of its own, in particular when big file sizes and slow
|
a set of challenges of its own, in particular when big file sizes and slow
|
||||||
connections are involved.
|
connections are involved.
|
||||||
|
|
||||||
For more information on how nacl_io and mount points work, see:
|
For more information on how nacl_io and mount points work, see:
|
||||||
|
|
||||||
https://developer.chrome.com/native-client/devguide/coding/nacl_io
|
https://developer.chrome.com/native-client/devguide/coding/nacl_io
|
||||||
https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
|
https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
|
||||||
|
|
||||||
To be able to save into the directory "/save/" (like backup of game) :
|
To be able to save into the directory "/save/" (like backup of game) :
|
||||||
|
|
||||||
mount("", "/save", "html5fs", 0, "type=PERSISTENT");
|
mount("", "/save", "html5fs", 0, "type=PERSISTENT");
|
||||||
|
|
||||||
And add to manifest.json :
|
And add to manifest.json :
|
||||||
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"unlimitedStorage"
|
"unlimitedStorage"
|
||||||
]
|
]
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
TODO - Known Issues
|
TODO - Known Issues
|
||||||
================================================================================
|
================================================================================
|
||||||
* Testing of all systems with a real application (something other than SDL's tests)
|
* Testing of all systems with a real application (something other than SDL's tests)
|
||||||
* Key events don't seem to work properly
|
* Key events don't seem to work properly
|
||||||
|
|
@ -1,44 +1,44 @@
|
|||||||
Nokia N-Gage
|
Nokia N-Gage
|
||||||
============
|
============
|
||||||
|
|
||||||
SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
|
SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
|
||||||
(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
|
(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
|
||||||
|
|
||||||
Compiling
|
Compiling
|
||||||
---------
|
---------
|
||||||
|
|
||||||
SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
|
SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
|
||||||
The library is included in the
|
The library is included in the
|
||||||
[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
|
[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
|
||||||
sub-module.
|
sub-module.
|
||||||
|
|
||||||
A complete example project based on SDL2 can be found in the GitHub
|
A complete example project based on SDL2 can be found in the GitHub
|
||||||
account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
|
account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
|
||||||
|
|
||||||
Current level of implementation
|
Current level of implementation
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
The video driver currently provides full screen video support with
|
The video driver currently provides full screen video support with
|
||||||
keyboard input.
|
keyboard input.
|
||||||
|
|
||||||
At the moment only the software renderer works.
|
At the moment only the software renderer works.
|
||||||
|
|
||||||
Audio is not yet implemented.
|
Audio is not yet implemented.
|
||||||
|
|
||||||
Acknowledgements
|
Acknowledgements
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
|
Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
|
||||||
valuable insight into Symbian programming. Without the SDL 1.2 port
|
valuable insight into Symbian programming. Without the SDL 1.2 port
|
||||||
which was specially developed for CDoom (Doom for the Nokia 9210), this
|
which was specially developed for CDoom (Doom for the Nokia 9210), this
|
||||||
adaptation would not have been possible.
|
adaptation would not have been possible.
|
||||||
|
|
||||||
I would like to thank my friends
|
I would like to thank my friends
|
||||||
[Razvan](https://twitter.com/bewarerazvan) and [Dan
|
[Razvan](https://twitter.com/bewarerazvan) and [Dan
|
||||||
Whelan](https://danwhelan.ie/), for their continuous support. Without
|
Whelan](https://danwhelan.ie/), for their continuous support. Without
|
||||||
you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
|
you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
|
||||||
have lost my patience long ago.
|
have lost my patience long ago.
|
||||||
|
|
||||||
Last but not least, I would like to thank the development team of
|
Last but not least, I would like to thank the development team of
|
||||||
[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
|
[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
|
||||||
patience and support in troubleshooting helped me a lot.
|
patience and support in troubleshooting helped me a lot.
|
@ -1,92 +1,92 @@
|
|||||||
Simple DirectMedia Layer 2 for OS/2 & eComStation
|
Simple DirectMedia Layer 2 for OS/2 & eComStation
|
||||||
================================================================================
|
================================================================================
|
||||||
SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 2016
|
SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 2016
|
||||||
|
|
||||||
|
|
||||||
OpenGL not supported by this port.
|
OpenGL not supported by this port.
|
||||||
|
|
||||||
Additional optional environment variables:
|
Additional optional environment variables:
|
||||||
|
|
||||||
SDL_AUDIO_SHARE
|
SDL_AUDIO_SHARE
|
||||||
Values: 0 or 1, default is 0
|
Values: 0 or 1, default is 0
|
||||||
Initializes the device as shareable or exclusively acquired.
|
Initializes the device as shareable or exclusively acquired.
|
||||||
|
|
||||||
SDL_VIDEODRIVER
|
SDL_VIDEODRIVER
|
||||||
Values: DIVE or VMAN, default is DIVE
|
Values: DIVE or VMAN, default is DIVE
|
||||||
Use video subsystem: Direct interface video extensions (DIVE) or
|
Use video subsystem: Direct interface video extensions (DIVE) or
|
||||||
Video Manager (VMAN).
|
Video Manager (VMAN).
|
||||||
|
|
||||||
You may significantly increase video output speed with OS4 kernel and patched
|
You may significantly increase video output speed with OS4 kernel and patched
|
||||||
files vman.dll and dive.dll or with latest versions of ACPI support and video
|
files vman.dll and dive.dll or with latest versions of ACPI support and video
|
||||||
driver Panorama.
|
driver Panorama.
|
||||||
|
|
||||||
Latest versions of OS/4 kernel:
|
Latest versions of OS/4 kernel:
|
||||||
http://gus.biysk.ru/os4/
|
http://gus.biysk.ru/os4/
|
||||||
(Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
|
(Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
|
||||||
|
|
||||||
Patched files vman.dll and dive.dll:
|
Patched files vman.dll and dive.dll:
|
||||||
http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
|
http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
|
||||||
|
|
||||||
|
|
||||||
Compiling:
|
Compiling:
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
|
Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
|
||||||
https://github.com/open-watcom/ and https://open-watcom.github.io
|
https://github.com/open-watcom/ and https://open-watcom.github.io
|
||||||
WATCOM environment variable must to be set to the Open Watcom install
|
WATCOM environment variable must to be set to the Open Watcom install
|
||||||
directory. To compile, run: wmake -f Makefile.os2
|
directory. To compile, run: wmake -f Makefile.os2
|
||||||
|
|
||||||
|
|
||||||
Installing:
|
Installing:
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
- eComStation:
|
- eComStation:
|
||||||
|
|
||||||
If you have previously installed SDL2, make a Backup copy of SDL2.dll
|
If you have previously installed SDL2, make a Backup copy of SDL2.dll
|
||||||
located in D:\ecs\dll (where D: is disk on which installed eComStation).
|
located in D:\ecs\dll (where D: is disk on which installed eComStation).
|
||||||
Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
|
Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
|
||||||
|
|
||||||
- OS/2:
|
- OS/2:
|
||||||
|
|
||||||
Copy SDL2.dll to any directory on your LIBPATH. If you have a previous
|
Copy SDL2.dll to any directory on your LIBPATH. If you have a previous
|
||||||
version installed, close all SDL2 applications before replacing the old
|
version installed, close all SDL2 applications before replacing the old
|
||||||
copy. Also make sure that any other older versions of DLLs are removed
|
copy. Also make sure that any other older versions of DLLs are removed
|
||||||
from your system.
|
from your system.
|
||||||
|
|
||||||
|
|
||||||
Joysticks in SDL2:
|
Joysticks in SDL2:
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
|
The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
|
||||||
Here is the original documentation from SDL-1.2:
|
Here is the original documentation from SDL-1.2:
|
||||||
|
|
||||||
The Joystick detection only works for standard joysticks (2 buttons, 2 axes
|
The Joystick detection only works for standard joysticks (2 buttons, 2 axes
|
||||||
and the like). Therefore, if you use a non-standard joystick, you should
|
and the like). Therefore, if you use a non-standard joystick, you should
|
||||||
specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
|
specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
|
||||||
file or CONFIG.SYS, so SDL applications can provide full capability to your
|
file or CONFIG.SYS, so SDL applications can provide full capability to your
|
||||||
device. The syntax is:
|
device. The syntax is:
|
||||||
|
|
||||||
SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
|
SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
|
||||||
|
|
||||||
So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
|
So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
|
||||||
the line should be:
|
the line should be:
|
||||||
|
|
||||||
SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
|
SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
|
||||||
|
|
||||||
If you want to add spaces in your joystick name, just surround it with
|
If you want to add spaces in your joystick name, just surround it with
|
||||||
quotes or double-quotes:
|
quotes or double-quotes:
|
||||||
|
|
||||||
SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
|
SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
|
SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
|
||||||
|
|
||||||
Note however that Balls and Hats are not supported under OS/2, and the
|
Note however that Balls and Hats are not supported under OS/2, and the
|
||||||
value will be ignored... but it is wise to define these correctly because
|
value will be ignored... but it is wise to define these correctly because
|
||||||
in the future those can be supported.
|
in the future those can be supported.
|
||||||
|
|
||||||
Also the number of buttons is limited to 2 when using two joysticks,
|
Also the number of buttons is limited to 2 when using two joysticks,
|
||||||
4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
|
4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
|
||||||
and 8 when using a joystick with 2 axes. Notice however these are limitations
|
and 8 when using a joystick with 2 axes. Notice however these are limitations
|
||||||
of the Joystick Port hardware, not OS/2.
|
of the Joystick Port hardware, not OS/2.
|
@ -1,17 +1,17 @@
|
|||||||
Pandora
|
Pandora
|
||||||
=====================================================================
|
=====================================================================
|
||||||
|
|
||||||
( http://openpandora.org/ )
|
( http://openpandora.org/ )
|
||||||
- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
|
- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
|
||||||
support to work on the pandora under the framebuffer. This driver do not have
|
support to work on the pandora under the framebuffer. This driver do not have
|
||||||
input support for now, so if you use it you will have to add your own control code.
|
input support for now, so if you use it you will have to add your own control code.
|
||||||
The video driver name is "pandora" so if you have problem running it from
|
The video driver name is "pandora" so if you have problem running it from
|
||||||
the framebuffer, try to set the following variable before starting your application :
|
the framebuffer, try to set the following variable before starting your application :
|
||||||
"export SDL_VIDEODRIVER=pandora"
|
"export SDL_VIDEODRIVER=pandora"
|
||||||
|
|
||||||
- OpenGL ES support was added to the x11 driver, so it's working like the normal
|
- OpenGL ES support was added to the x11 driver, so it's working like the normal
|
||||||
x11 driver one with OpenGLX support, with SDL input event's etc..
|
x11 driver one with OpenGLX support, with SDL input event's etc..
|
||||||
|
|
||||||
|
|
||||||
David Carré (Cpasjuste)
|
David Carré (Cpasjuste)
|
||||||
cpasjuste@gmail.com
|
cpasjuste@gmail.com
|
@ -1,8 +1,8 @@
|
|||||||
Platforms
|
Platforms
|
||||||
=========
|
=========
|
||||||
|
|
||||||
We maintain the list of supported platforms on our wiki now, and how to
|
We maintain the list of supported platforms on our wiki now, and how to
|
||||||
build and install SDL for those platforms:
|
build and install SDL for those platforms:
|
||||||
|
|
||||||
https://wiki.libsdl.org/Installation
|
https://wiki.libsdl.org/Installation
|
||||||
|
|
@ -1,68 +1,68 @@
|
|||||||
Porting
|
Porting
|
||||||
=======
|
=======
|
||||||
|
|
||||||
* Porting To A New Platform
|
* Porting To A New Platform
|
||||||
|
|
||||||
The first thing you have to do when porting to a new platform, is look at
|
The first thing you have to do when porting to a new platform, is look at
|
||||||
include/SDL_platform.h and create an entry there for your operating system.
|
include/SDL_platform.h and create an entry there for your operating system.
|
||||||
The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
|
The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
|
||||||
Ideally SDL_platform.h will be able to auto-detect the system it's building
|
Ideally SDL_platform.h will be able to auto-detect the system it's building
|
||||||
on based on C preprocessor symbols.
|
on based on C preprocessor symbols.
|
||||||
|
|
||||||
There are two basic ways of building SDL at the moment:
|
There are two basic ways of building SDL at the moment:
|
||||||
|
|
||||||
1. The "UNIX" way: ./configure; make; make install
|
1. The "UNIX" way: ./configure; make; make install
|
||||||
|
|
||||||
If you have a GNUish system, then you might try this. Edit configure.ac,
|
If you have a GNUish system, then you might try this. Edit configure.ac,
|
||||||
take a look at the large section labelled:
|
take a look at the large section labelled:
|
||||||
|
|
||||||
"Set up the configuration based on the host platform!"
|
"Set up the configuration based on the host platform!"
|
||||||
|
|
||||||
Add a section for your platform, and then re-run autogen.sh and build!
|
Add a section for your platform, and then re-run autogen.sh and build!
|
||||||
|
|
||||||
2. Using an IDE:
|
2. Using an IDE:
|
||||||
|
|
||||||
If you're using an IDE or other non-configure build system, you'll probably
|
If you're using an IDE or other non-configure build system, you'll probably
|
||||||
want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
|
want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
|
||||||
add a section for your platform, and create a custom SDL_config_{platform}.h,
|
add a section for your platform, and create a custom SDL_config_{platform}.h,
|
||||||
based on SDL_config_minimal.h and SDL_config.h.in
|
based on SDL_config_minimal.h and SDL_config.h.in
|
||||||
|
|
||||||
Add the top level include directory to the header search path, and then add
|
Add the top level include directory to the header search path, and then add
|
||||||
the following sources to the project:
|
the following sources to the project:
|
||||||
|
|
||||||
src/*.c
|
src/*.c
|
||||||
src/atomic/*.c
|
src/atomic/*.c
|
||||||
src/audio/*.c
|
src/audio/*.c
|
||||||
src/cpuinfo/*.c
|
src/cpuinfo/*.c
|
||||||
src/events/*.c
|
src/events/*.c
|
||||||
src/file/*.c
|
src/file/*.c
|
||||||
src/haptic/*.c
|
src/haptic/*.c
|
||||||
src/joystick/*.c
|
src/joystick/*.c
|
||||||
src/power/*.c
|
src/power/*.c
|
||||||
src/render/*.c
|
src/render/*.c
|
||||||
src/render/software/*.c
|
src/render/software/*.c
|
||||||
src/stdlib/*.c
|
src/stdlib/*.c
|
||||||
src/thread/*.c
|
src/thread/*.c
|
||||||
src/timer/*.c
|
src/timer/*.c
|
||||||
src/video/*.c
|
src/video/*.c
|
||||||
src/audio/disk/*.c
|
src/audio/disk/*.c
|
||||||
src/audio/dummy/*.c
|
src/audio/dummy/*.c
|
||||||
src/filesystem/dummy/*.c
|
src/filesystem/dummy/*.c
|
||||||
src/video/dummy/*.c
|
src/video/dummy/*.c
|
||||||
src/haptic/dummy/*.c
|
src/haptic/dummy/*.c
|
||||||
src/joystick/dummy/*.c
|
src/joystick/dummy/*.c
|
||||||
src/main/dummy/*.c
|
src/main/dummy/*.c
|
||||||
src/thread/generic/*.c
|
src/thread/generic/*.c
|
||||||
src/timer/dummy/*.c
|
src/timer/dummy/*.c
|
||||||
src/loadso/dummy/*.c
|
src/loadso/dummy/*.c
|
||||||
|
|
||||||
|
|
||||||
Once you have a working library without any drivers, you can go back to each
|
Once you have a working library without any drivers, you can go back to each
|
||||||
of the major subsystems and start implementing drivers for your platform.
|
of the major subsystems and start implementing drivers for your platform.
|
||||||
|
|
||||||
If you have any questions, don't hesitate to ask on the SDL mailing list:
|
If you have any questions, don't hesitate to ask on the SDL mailing list:
|
||||||
http://www.libsdl.org/mailing-list.php
|
http://www.libsdl.org/mailing-list.php
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
Sam Lantinga (slouken@libsdl.org)
|
Sam Lantinga (slouken@libsdl.org)
|
||||||
|
|
@ -1,51 +1,51 @@
|
|||||||
PS2
|
PS2
|
||||||
======
|
======
|
||||||
SDL2 port for the Sony Playstation 2 contributed by:
|
SDL2 port for the Sony Playstation 2 contributed by:
|
||||||
- Francisco Javier Trujillo Mata
|
- Francisco Javier Trujillo Mata
|
||||||
|
|
||||||
|
|
||||||
Credit to
|
Credit to
|
||||||
- The guys that ported SDL to PSP & Vita because I'm taking them as reference.
|
- The guys that ported SDL to PSP & Vita because I'm taking them as reference.
|
||||||
- David G. F. for helping me with several issues and tests.
|
- David G. F. for helping me with several issues and tests.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
|
To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
|
||||||
```bash
|
```bash
|
||||||
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
|
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
|
||||||
cmake --build build
|
cmake --build build
|
||||||
cmake --install build
|
cmake --install build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Hints
|
## Hints
|
||||||
The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
|
The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
|
||||||
If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
|
If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
|
If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
|
||||||
So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
|
So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
|
||||||
It could be something similar as:
|
It could be something similar as:
|
||||||
```c
|
```c
|
||||||
.....
|
.....
|
||||||
|
|
||||||
SDL_PS2_SKIP_IOP_RESET();
|
SDL_PS2_SKIP_IOP_RESET();
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
.....
|
.....
|
||||||
```
|
```
|
||||||
For a release binary is recommendable to reset the IOP always.
|
For a release binary is recommendable to reset the IOP always.
|
||||||
|
|
||||||
Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
|
Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
|
||||||
|
|
||||||
## Getting PS2 Dev
|
## Getting PS2 Dev
|
||||||
[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
|
[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
|
||||||
|
|
||||||
## Running on PCSX2 Emulator
|
## Running on PCSX2 Emulator
|
||||||
[PCSX2](https://github.com/PCSX2/pcsx2)
|
[PCSX2](https://github.com/PCSX2/pcsx2)
|
||||||
|
|
||||||
[More PCSX2 information](https://pcsx2.net/)
|
[More PCSX2 information](https://pcsx2.net/)
|
||||||
|
|
||||||
## To Do
|
## To Do
|
||||||
- PS2 Screen Keyboard
|
- PS2 Screen Keyboard
|
||||||
- Dialogs
|
- Dialogs
|
||||||
- Others
|
- Others
|
@ -1,36 +1,36 @@
|
|||||||
PSP
|
PSP
|
||||||
======
|
======
|
||||||
SDL2 port for the Sony PSP contributed by:
|
SDL2 port for the Sony PSP contributed by:
|
||||||
- Captian Lex
|
- Captian Lex
|
||||||
- Francisco Javier Trujillo Mata
|
- Francisco Javier Trujillo Mata
|
||||||
- Wouter Wijsman
|
- Wouter Wijsman
|
||||||
|
|
||||||
|
|
||||||
Credit to
|
Credit to
|
||||||
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
|
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
|
||||||
Geecko for his PSP GU lib "Glib2d"
|
Geecko for his PSP GU lib "Glib2d"
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
|
To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
|
||||||
```bash
|
```bash
|
||||||
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
|
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
|
||||||
cmake --build build
|
cmake --build build
|
||||||
cmake --install build
|
cmake --install build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Getting PSP Dev
|
## Getting PSP Dev
|
||||||
[Installing PSP Dev](https://github.com/pspdev/pspdev)
|
[Installing PSP Dev](https://github.com/pspdev/pspdev)
|
||||||
|
|
||||||
## Running on PPSSPP Emulator
|
## Running on PPSSPP Emulator
|
||||||
[PPSSPP](https://github.com/hrydgard/ppsspp)
|
[PPSSPP](https://github.com/hrydgard/ppsspp)
|
||||||
|
|
||||||
[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
|
[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
|
||||||
|
|
||||||
|
|
||||||
## Compiling a HelloWorld
|
## Compiling a HelloWorld
|
||||||
[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
|
[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
|
||||||
|
|
||||||
## To Do
|
## To Do
|
||||||
- PSP Screen Keyboard
|
- PSP Screen Keyboard
|
||||||
- Dialogs
|
- Dialogs
|
@ -1,180 +1,180 @@
|
|||||||
Raspberry Pi
|
Raspberry Pi
|
||||||
============
|
============
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
Raspbian (other Linux distros may work as well).
|
Raspbian (other Linux distros may work as well).
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Works without X11
|
* Works without X11
|
||||||
* Hardware accelerated OpenGL ES 2.x
|
* Hardware accelerated OpenGL ES 2.x
|
||||||
* Sound via ALSA
|
* Sound via ALSA
|
||||||
* Input (mouse/keyboard/joystick) via EVDEV
|
* Input (mouse/keyboard/joystick) via EVDEV
|
||||||
* Hotplugging of input devices via UDEV
|
* Hotplugging of input devices via UDEV
|
||||||
|
|
||||||
|
|
||||||
Raspbian Build Dependencies
|
Raspbian Build Dependencies
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
|
sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
|
||||||
|
|
||||||
You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
|
You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
|
||||||
OpenGL ES 2.x, it usually comes pre-installed, but in any case:
|
OpenGL ES 2.x, it usually comes pre-installed, but in any case:
|
||||||
|
|
||||||
sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
|
sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
|
||||||
|
|
||||||
|
|
||||||
NEON
|
NEON
|
||||||
----
|
----
|
||||||
|
|
||||||
If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so
|
If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so
|
||||||
that SDL will select some otherwise-disabled highly-optimized code. The
|
that SDL will select some otherwise-disabled highly-optimized code. The
|
||||||
original Pi units don't have NEON, the Pi2 probably does, and the Pi3
|
original Pi units don't have NEON, the Pi2 probably does, and the Pi3
|
||||||
definitely does.
|
definitely does.
|
||||||
|
|
||||||
|
|
||||||
Cross compiling from x86 Linux
|
Cross compiling from x86 Linux
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
To cross compile SDL for Raspbian from your desktop machine, you'll need a
|
To cross compile SDL for Raspbian from your desktop machine, you'll need a
|
||||||
Raspbian system root and the cross compilation tools. We'll assume these tools
|
Raspbian system root and the cross compilation tools. We'll assume these tools
|
||||||
will be placed in /opt/rpi-tools
|
will be placed in /opt/rpi-tools
|
||||||
|
|
||||||
sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
|
sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
|
||||||
|
|
||||||
You'll also need a Raspbian binary image.
|
You'll also need a Raspbian binary image.
|
||||||
Get it from: http://downloads.raspberrypi.org/raspbian_latest
|
Get it from: http://downloads.raspberrypi.org/raspbian_latest
|
||||||
After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
|
After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
|
||||||
Let's assume the sysroot will be built in /opt/rpi-sysroot.
|
Let's assume the sysroot will be built in /opt/rpi-sysroot.
|
||||||
|
|
||||||
export SYSROOT=/opt/rpi-sysroot
|
export SYSROOT=/opt/rpi-sysroot
|
||||||
sudo kpartx -a -v <path_to_raspbian_image>.img
|
sudo kpartx -a -v <path_to_raspbian_image>.img
|
||||||
sudo mount -o loop /dev/mapper/loop0p2 /mnt
|
sudo mount -o loop /dev/mapper/loop0p2 /mnt
|
||||||
sudo cp -r /mnt $SYSROOT
|
sudo cp -r /mnt $SYSROOT
|
||||||
sudo apt-get install qemu binfmt-support qemu-user-static
|
sudo apt-get install qemu binfmt-support qemu-user-static
|
||||||
sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
|
sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
|
||||||
sudo mount --bind /dev $SYSROOT/dev
|
sudo mount --bind /dev $SYSROOT/dev
|
||||||
sudo mount --bind /proc $SYSROOT/proc
|
sudo mount --bind /proc $SYSROOT/proc
|
||||||
sudo mount --bind /sys $SYSROOT/sys
|
sudo mount --bind /sys $SYSROOT/sys
|
||||||
|
|
||||||
Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
|
Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
|
||||||
edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
|
edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
|
||||||
|
|
||||||
sudo chroot $SYSROOT
|
sudo chroot $SYSROOT
|
||||||
apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev
|
apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev
|
||||||
exit
|
exit
|
||||||
sudo umount $SYSROOT/dev
|
sudo umount $SYSROOT/dev
|
||||||
sudo umount $SYSROOT/proc
|
sudo umount $SYSROOT/proc
|
||||||
sudo umount $SYSROOT/sys
|
sudo umount $SYSROOT/sys
|
||||||
sudo umount /mnt
|
sudo umount /mnt
|
||||||
|
|
||||||
There's one more fix required, as the libdl.so symlink uses an absolute path
|
There's one more fix required, as the libdl.so symlink uses an absolute path
|
||||||
which doesn't quite work in our setup.
|
which doesn't quite work in our setup.
|
||||||
|
|
||||||
sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
|
sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
|
||||||
sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
|
sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
|
||||||
|
|
||||||
The final step is compiling SDL itself.
|
The final step is compiling SDL itself.
|
||||||
|
|
||||||
export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
|
export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
|
||||||
cd <SDL SOURCE>
|
cd <SDL SOURCE>
|
||||||
mkdir -p build;cd build
|
mkdir -p build;cd build
|
||||||
LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
|
LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
|
To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
|
||||||
|
|
||||||
perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
|
perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
|
||||||
|
|
||||||
Apps don't work or poor video/audio performance
|
Apps don't work or poor video/audio performance
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
|
||||||
If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
|
If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
|
||||||
update the RPi's firmware. Note that doing so will fix these problems, but it
|
update the RPi's firmware. Note that doing so will fix these problems, but it
|
||||||
will also render the CMA - Dynamic Memory Split functionality useless.
|
will also render the CMA - Dynamic Memory Split functionality useless.
|
||||||
|
|
||||||
Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
|
Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
|
||||||
low in general, specially if a 1080p TV is hooked up.
|
low in general, specially if a 1080p TV is hooked up.
|
||||||
|
|
||||||
See here how to configure this setting: http://elinux.org/RPiconfig
|
See here how to configure this setting: http://elinux.org/RPiconfig
|
||||||
|
|
||||||
Using a fixed gpu_mem=128 is the best option (specially if you updated the
|
Using a fixed gpu_mem=128 is the best option (specially if you updated the
|
||||||
firmware, using CMA probably won't work, at least it's the current case).
|
firmware, using CMA probably won't work, at least it's the current case).
|
||||||
|
|
||||||
No input
|
No input
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Make sure you belong to the "input" group.
|
Make sure you belong to the "input" group.
|
||||||
|
|
||||||
sudo usermod -aG input `whoami`
|
sudo usermod -aG input `whoami`
|
||||||
|
|
||||||
No HDMI Audio
|
No HDMI Audio
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
If you notice that ALSA works but there's no audio over HDMI, try adding:
|
If you notice that ALSA works but there's no audio over HDMI, try adding:
|
||||||
|
|
||||||
hdmi_drive=2
|
hdmi_drive=2
|
||||||
|
|
||||||
to your config.txt file and reboot.
|
to your config.txt file and reboot.
|
||||||
|
|
||||||
Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
|
Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
|
||||||
|
|
||||||
Text Input API support
|
Text Input API support
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
The Text Input API is supported, with translation of scan codes done via the
|
The Text Input API is supported, with translation of scan codes done via the
|
||||||
kernel symbol tables. For this to work, SDL needs access to a valid console.
|
kernel symbol tables. For this to work, SDL needs access to a valid console.
|
||||||
If you notice there's no SDL_TEXTINPUT message being emitted, double check that
|
If you notice there's no SDL_TEXTINPUT message being emitted, double check that
|
||||||
your app has read access to one of the following:
|
your app has read access to one of the following:
|
||||||
|
|
||||||
* /proc/self/fd/0
|
* /proc/self/fd/0
|
||||||
* /dev/tty
|
* /dev/tty
|
||||||
* /dev/tty[0...6]
|
* /dev/tty[0...6]
|
||||||
* /dev/vc/0
|
* /dev/vc/0
|
||||||
* /dev/console
|
* /dev/console
|
||||||
|
|
||||||
This is usually not a problem if you run from the physical terminal (as opposed
|
This is usually not a problem if you run from the physical terminal (as opposed
|
||||||
to running from a pseudo terminal, such as via SSH). If running from a PTS, a
|
to running from a pseudo terminal, such as via SSH). If running from a PTS, a
|
||||||
quick workaround is to run your app as root or add yourself to the tty group,
|
quick workaround is to run your app as root or add yourself to the tty group,
|
||||||
then re-login to the system.
|
then re-login to the system.
|
||||||
|
|
||||||
sudo usermod -aG tty `whoami`
|
sudo usermod -aG tty `whoami`
|
||||||
|
|
||||||
The keyboard layout used by SDL is the same as the one the kernel uses.
|
The keyboard layout used by SDL is the same as the one the kernel uses.
|
||||||
To configure the layout on Raspbian:
|
To configure the layout on Raspbian:
|
||||||
|
|
||||||
sudo dpkg-reconfigure keyboard-configuration
|
sudo dpkg-reconfigure keyboard-configuration
|
||||||
|
|
||||||
To configure the locale, which controls which keys are interpreted as letters,
|
To configure the locale, which controls which keys are interpreted as letters,
|
||||||
this determining the CAPS LOCK behavior:
|
this determining the CAPS LOCK behavior:
|
||||||
|
|
||||||
sudo dpkg-reconfigure locales
|
sudo dpkg-reconfigure locales
|
||||||
|
|
||||||
|
|
||||||
OpenGL problems
|
OpenGL problems
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
If you have desktop OpenGL headers installed at build time in your RPi or cross
|
If you have desktop OpenGL headers installed at build time in your RPi or cross
|
||||||
compilation environment, support for it will be built in. However, the chipset
|
compilation environment, support for it will be built in. However, the chipset
|
||||||
does not actually have support for it, which causes issues in certain SDL apps
|
does not actually have support for it, which causes issues in certain SDL apps
|
||||||
since the presence of OpenGL support supersedes the ES/ES2 variants.
|
since the presence of OpenGL support supersedes the ES/ES2 variants.
|
||||||
The workaround is to disable OpenGL at configuration time:
|
The workaround is to disable OpenGL at configuration time:
|
||||||
|
|
||||||
./configure --disable-video-opengl
|
./configure --disable-video-opengl
|
||||||
|
|
||||||
Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
|
Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
|
||||||
environment variable:
|
environment variable:
|
||||||
|
|
||||||
export SDL_RENDER_DRIVER=opengles2
|
export SDL_RENDER_DRIVER=opengles2
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
|
* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
|
||||||
leaking into the console only if it has root privileges. Launching apps locally
|
leaking into the console only if it has root privileges. Launching apps locally
|
||||||
does not suffer from this issue.
|
does not suffer from this issue.
|
||||||
|
|
||||||
|
|
@ -1,41 +1,41 @@
|
|||||||
RISC OS
|
RISC OS
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
* RISC OS 3.5 or later.
|
* RISC OS 3.5 or later.
|
||||||
* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
|
* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
|
||||||
* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
|
* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
|
||||||
* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
|
* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
|
||||||
|
|
||||||
|
|
||||||
Compiling:
|
Compiling:
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
|
Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
|
||||||
|
|
||||||
The following commands can be used to build SDL2 for RISC OS using autoconf:
|
The following commands can be used to build SDL2 for RISC OS using autoconf:
|
||||||
|
|
||||||
./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
|
./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
The following commands can be used to build SDL2 for RISC OS using CMake:
|
The following commands can be used to build SDL2 for RISC OS using CMake:
|
||||||
|
|
||||||
cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
|
cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
|
||||||
cmake --build build-riscos
|
cmake --build build-riscos
|
||||||
cmake --build build-riscos --target install
|
cmake --build build-riscos --target install
|
||||||
|
|
||||||
|
|
||||||
Current level of implementation
|
Current level of implementation
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
|
The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
|
||||||
|
|
||||||
The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
|
The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
|
||||||
|
|
||||||
The audio, loadso, thread and timer APIs are currently provided by UnixLib.
|
The audio, loadso, thread and timer APIs are currently provided by UnixLib.
|
||||||
|
|
||||||
GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
|
GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
|
||||||
|
|
||||||
The joystick, locale and power APIs are not yet implemented.
|
The joystick, locale and power APIs are not yet implemented.
|
@ -1,86 +1,86 @@
|
|||||||
Touch
|
Touch
|
||||||
===========================================================================
|
===========================================================================
|
||||||
System Specific Notes
|
System Specific Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Linux:
|
Linux:
|
||||||
The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
|
The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
|
||||||
|
|
||||||
Mac:
|
Mac:
|
||||||
The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
|
The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
|
||||||
|
|
||||||
iPhone:
|
iPhone:
|
||||||
Works out of box.
|
Works out of box.
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
|
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Events
|
Events
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL_FINGERDOWN:
|
SDL_FINGERDOWN:
|
||||||
Sent when a finger (or stylus) is placed on a touch device.
|
Sent when a finger (or stylus) is placed on a touch device.
|
||||||
Fields:
|
Fields:
|
||||||
* event.tfinger.touchId - the Id of the touch device.
|
* event.tfinger.touchId - the Id of the touch device.
|
||||||
* event.tfinger.fingerId - the Id of the finger which just went down.
|
* event.tfinger.fingerId - the Id of the finger which just went down.
|
||||||
* event.tfinger.x - the x coordinate of the touch (0..1)
|
* event.tfinger.x - the x coordinate of the touch (0..1)
|
||||||
* event.tfinger.y - the y coordinate of the touch (0..1)
|
* event.tfinger.y - the y coordinate of the touch (0..1)
|
||||||
* event.tfinger.pressure - the pressure of the touch (0..1)
|
* event.tfinger.pressure - the pressure of the touch (0..1)
|
||||||
|
|
||||||
SDL_FINGERMOTION:
|
SDL_FINGERMOTION:
|
||||||
Sent when a finger (or stylus) is moved on the touch device.
|
Sent when a finger (or stylus) is moved on the touch device.
|
||||||
Fields:
|
Fields:
|
||||||
Same as SDL_FINGERDOWN but with additional:
|
Same as SDL_FINGERDOWN but with additional:
|
||||||
* event.tfinger.dx - change in x coordinate during this motion event.
|
* event.tfinger.dx - change in x coordinate during this motion event.
|
||||||
* event.tfinger.dy - change in y coordinate during this motion event.
|
* event.tfinger.dy - change in y coordinate during this motion event.
|
||||||
|
|
||||||
SDL_FINGERUP:
|
SDL_FINGERUP:
|
||||||
Sent when a finger (or stylus) is lifted from the touch device.
|
Sent when a finger (or stylus) is lifted from the touch device.
|
||||||
Fields:
|
Fields:
|
||||||
Same as SDL_FINGERDOWN.
|
Same as SDL_FINGERDOWN.
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Functions
|
Functions
|
||||||
===========================================================================
|
===========================================================================
|
||||||
SDL provides the ability to access the underlying SDL_Finger structures.
|
SDL provides the ability to access the underlying SDL_Finger structures.
|
||||||
These structures should _never_ be modified.
|
These structures should _never_ be modified.
|
||||||
|
|
||||||
The following functions are included from SDL_touch.h
|
The following functions are included from SDL_touch.h
|
||||||
|
|
||||||
To get a SDL_TouchID call SDL_GetTouchDevice(int index).
|
To get a SDL_TouchID call SDL_GetTouchDevice(int index).
|
||||||
This returns a SDL_TouchID.
|
This returns a SDL_TouchID.
|
||||||
IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
|
IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
|
||||||
|
|
||||||
The number of touch devices can be queried with SDL_GetNumTouchDevices().
|
The number of touch devices can be queried with SDL_GetNumTouchDevices().
|
||||||
|
|
||||||
A SDL_TouchID may be used to get pointers to SDL_Finger.
|
A SDL_TouchID may be used to get pointers to SDL_Finger.
|
||||||
|
|
||||||
SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
|
SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
|
||||||
|
|
||||||
The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
|
The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
|
||||||
|
|
||||||
float x = event.tfinger.x;
|
float x = event.tfinger.x;
|
||||||
float y = event.tfinger.y;
|
float y = event.tfinger.y;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
|
To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
|
||||||
This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
|
This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
|
||||||
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
|
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
|
||||||
As a result, be very careful to check for NULL return values.
|
As a result, be very careful to check for NULL return values.
|
||||||
|
|
||||||
A SDL_Finger has the following fields:
|
A SDL_Finger has the following fields:
|
||||||
* x, y:
|
* x, y:
|
||||||
The current coordinates of the touch.
|
The current coordinates of the touch.
|
||||||
* pressure:
|
* pressure:
|
||||||
The pressure of the touch.
|
The pressure of the touch.
|
||||||
|
|
||||||
|
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Notes
|
Notes
|
||||||
===========================================================================
|
===========================================================================
|
||||||
For a complete example see test/testgesture.c
|
For a complete example see test/testgesture.c
|
||||||
|
|
||||||
Please direct questions/comments to:
|
Please direct questions/comments to:
|
||||||
jim.tla+sdl_touch@gmail.com
|
jim.tla+sdl_touch@gmail.com
|
||||||
(original author, API was changed since)
|
(original author, API was changed since)
|
@ -1,60 +1,60 @@
|
|||||||
# Versioning
|
# Versioning
|
||||||
|
|
||||||
## Since 2.23.0
|
## Since 2.23.0
|
||||||
|
|
||||||
SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
|
SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
|
||||||
and older versions of the Linux kernel:
|
and older versions of the Linux kernel:
|
||||||
|
|
||||||
* The major version (first part) increases when backwards compatibility
|
* The major version (first part) increases when backwards compatibility
|
||||||
is broken, which will happen infrequently.
|
is broken, which will happen infrequently.
|
||||||
|
|
||||||
* If the minor version (second part) is divisible by 2
|
* If the minor version (second part) is divisible by 2
|
||||||
(for example 2.24.x, 2.26.x), this indicates a version of SDL that
|
(for example 2.24.x, 2.26.x), this indicates a version of SDL that
|
||||||
is believed to be stable and suitable for production use.
|
is believed to be stable and suitable for production use.
|
||||||
|
|
||||||
* In stable releases, the patchlevel or micro version (third part)
|
* In stable releases, the patchlevel or micro version (third part)
|
||||||
indicates bugfix releases. Bugfix releases should not add or
|
indicates bugfix releases. Bugfix releases should not add or
|
||||||
remove ABI, so the ".0" release (for example 2.24.0) should be
|
remove ABI, so the ".0" release (for example 2.24.0) should be
|
||||||
forwards-compatible with all the bugfix releases from the
|
forwards-compatible with all the bugfix releases from the
|
||||||
same cycle (for example 2.24.1).
|
same cycle (for example 2.24.1).
|
||||||
|
|
||||||
* The minor version increases when new API or ABI is added, or when
|
* The minor version increases when new API or ABI is added, or when
|
||||||
other significant changes are made. Newer minor versions are
|
other significant changes are made. Newer minor versions are
|
||||||
backwards-compatible, but not fully forwards-compatible.
|
backwards-compatible, but not fully forwards-compatible.
|
||||||
For example, programs built against SDL 2.24.x should work fine
|
For example, programs built against SDL 2.24.x should work fine
|
||||||
with SDL 2.26.x, but programs built against SDL 2.26.x will not
|
with SDL 2.26.x, but programs built against SDL 2.26.x will not
|
||||||
necessarily work with 2.24.x.
|
necessarily work with 2.24.x.
|
||||||
|
|
||||||
* If the minor version (second part) is not divisible by 2
|
* If the minor version (second part) is not divisible by 2
|
||||||
(for example 2.23.x, 2.25.x), this indicates a development prerelease
|
(for example 2.23.x, 2.25.x), this indicates a development prerelease
|
||||||
of SDL that is not suitable for stable software distributions.
|
of SDL that is not suitable for stable software distributions.
|
||||||
Use with caution.
|
Use with caution.
|
||||||
|
|
||||||
* The patchlevel or micro version (third part) increases with
|
* The patchlevel or micro version (third part) increases with
|
||||||
each prerelease.
|
each prerelease.
|
||||||
|
|
||||||
* Each prerelease might add new API and/or ABI.
|
* Each prerelease might add new API and/or ABI.
|
||||||
|
|
||||||
* Prereleases are backwards-compatible with older stable branches.
|
* Prereleases are backwards-compatible with older stable branches.
|
||||||
For example, 2.25.x will be backwards-compatible with 2.24.x.
|
For example, 2.25.x will be backwards-compatible with 2.24.x.
|
||||||
|
|
||||||
* Prereleases are not guaranteed to be backwards-compatible with
|
* Prereleases are not guaranteed to be backwards-compatible with
|
||||||
each other. For example, new API or ABI added in 2.25.1
|
each other. For example, new API or ABI added in 2.25.1
|
||||||
might be removed or changed in 2.25.2.
|
might be removed or changed in 2.25.2.
|
||||||
If this would be a problem for you, please do not use prereleases.
|
If this would be a problem for you, please do not use prereleases.
|
||||||
|
|
||||||
* Only upgrade to a prerelease if you can guarantee that you will
|
* Only upgrade to a prerelease if you can guarantee that you will
|
||||||
promptly upgrade to the stable release that follows it.
|
promptly upgrade to the stable release that follows it.
|
||||||
For example, do not upgrade to 2.23.x unless you will be able to
|
For example, do not upgrade to 2.23.x unless you will be able to
|
||||||
upgrade to 2.24.0 when it becomes available.
|
upgrade to 2.24.0 when it becomes available.
|
||||||
|
|
||||||
* Software distributions that have a freeze policy (in particular Linux
|
* Software distributions that have a freeze policy (in particular Linux
|
||||||
distributions with a release cycle, such as Debian and Fedora)
|
distributions with a release cycle, such as Debian and Fedora)
|
||||||
should usually only package stable releases, and not prereleases.
|
should usually only package stable releases, and not prereleases.
|
||||||
|
|
||||||
## Before 2.23.0
|
## Before 2.23.0
|
||||||
|
|
||||||
Older versions of SDL followed a similar policy, but instead of the
|
Older versions of SDL followed a similar policy, but instead of the
|
||||||
odd/even rule applying to the minor version, it applied to the patchlevel
|
odd/even rule applying to the minor version, it applied to the patchlevel
|
||||||
(micro version, third part). For example, 2.0.22 was a stable release
|
(micro version, third part). For example, 2.0.22 was a stable release
|
||||||
and 2.0.21 was a prerelease.
|
and 2.0.21 was a prerelease.
|
@ -1,114 +1,114 @@
|
|||||||
Using SDL with Microsoft Visual C++
|
Using SDL with Microsoft Visual C++
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
### by Lion Kimbro with additions by James Turk
|
### by Lion Kimbro with additions by James Turk
|
||||||
|
|
||||||
You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
|
You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
|
||||||
yourself.
|
yourself.
|
||||||
|
|
||||||
### Building SDL
|
### Building SDL
|
||||||
|
|
||||||
0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
|
0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
|
||||||
the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
|
the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
|
||||||
_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
|
_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
|
||||||
|
|
||||||
1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
|
1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
|
||||||
|
|
||||||
2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
|
2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
|
||||||
all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
|
all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
|
||||||
the `Platform Toolset`.
|
the `Platform Toolset`.
|
||||||
|
|
||||||
If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
|
If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
|
||||||
|
|
||||||
3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
|
3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
|
||||||
panel in the _FileView_ tab), and selecting `Build`.
|
panel in the _FileView_ tab), and selecting `Build`.
|
||||||
|
|
||||||
You may get a few warnings, but you should not get any errors.
|
You may get a few warnings, but you should not get any errors.
|
||||||
|
|
||||||
Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
|
Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
|
||||||
|
|
||||||
- `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
|
- `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
|
||||||
- `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
|
- `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
|
||||||
- `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
|
- `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
|
||||||
|
|
||||||
_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
|
_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
|
||||||
|
|
||||||
### Creating a Project with SDL
|
### Creating a Project with SDL
|
||||||
|
|
||||||
- Create a project as a `Win32 Application`.
|
- Create a project as a `Win32 Application`.
|
||||||
|
|
||||||
- Create a C++ file for your project.
|
- Create a C++ file for your project.
|
||||||
|
|
||||||
- Set the C runtime to `Multi-threaded DLL` in the menu:
|
- Set the C runtime to `Multi-threaded DLL` in the menu:
|
||||||
`Project|Settings|C/C++ tab|Code Generation|Runtime Library `.
|
`Project|Settings|C/C++ tab|Code Generation|Runtime Library `.
|
||||||
|
|
||||||
- Add the SDL `include` directory to your list of includes in the menu:
|
- Add the SDL `include` directory to your list of includes in the menu:
|
||||||
`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
|
`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
|
||||||
|
|
||||||
*VC7 Specific: Instead of doing this, I find it easier to add the
|
*VC7 Specific: Instead of doing this, I find it easier to add the
|
||||||
include and library directories to the list that VC7 keeps. Do this by
|
include and library directories to the list that VC7 keeps. Do this by
|
||||||
selecting Tools|Options|Projects|VC++ Directories and under the "Show
|
selecting Tools|Options|Projects|VC++ Directories and under the "Show
|
||||||
Directories For:" dropbox select "Include Files", and click the "New
|
Directories For:" dropbox select "Include Files", and click the "New
|
||||||
Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
|
Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
|
||||||
installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
|
installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
|
||||||
dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
|
dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
|
||||||
|
|
||||||
The "include directory" I am referring to is the `./include` folder.
|
The "include directory" I am referring to is the `./include` folder.
|
||||||
|
|
||||||
Now we're going to use the files that we had created earlier in the *Build SDL* step.
|
Now we're going to use the files that we had created earlier in the *Build SDL* step.
|
||||||
|
|
||||||
Copy the following file into your Project directory:
|
Copy the following file into your Project directory:
|
||||||
|
|
||||||
- `SDL2.dll`
|
- `SDL2.dll`
|
||||||
|
|
||||||
Add the following files to your project (It is not necessary to copy them to your project directory):
|
Add the following files to your project (It is not necessary to copy them to your project directory):
|
||||||
|
|
||||||
- `SDL2.lib`
|
- `SDL2.lib`
|
||||||
- `SDL2main.lib`
|
- `SDL2main.lib`
|
||||||
|
|
||||||
To add them to your project, right click on your project, and select
|
To add them to your project, right click on your project, and select
|
||||||
`Add files to project`.
|
`Add files to project`.
|
||||||
|
|
||||||
**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
|
**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
|
||||||
and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
|
and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
|
||||||
(e.g. Release,Debug).**
|
(e.g. Release,Debug).**
|
||||||
|
|
||||||
### Hello SDL2
|
### Hello SDL2
|
||||||
|
|
||||||
Here's a sample SDL snippet to verify everything is setup in your IDE:
|
Here's a sample SDL snippet to verify everything is setup in your IDE:
|
||||||
|
|
||||||
```
|
```
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
int main( int argc, char* argv[] )
|
int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
const int WIDTH = 640;
|
const int WIDTH = 640;
|
||||||
const int HEIGHT = 480;
|
const int HEIGHT = 480;
|
||||||
SDL_Window* window = NULL;
|
SDL_Window* window = NULL;
|
||||||
SDL_Renderer* renderer = NULL;
|
SDL_Renderer* renderer = NULL;
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
|
window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||||
|
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(renderer);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### That's it!
|
### That's it!
|
||||||
|
|
||||||
I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
|
I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
|
||||||
Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
|
Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
|
||||||
|
|
||||||
### Credits
|
### Credits
|
||||||
|
|
||||||
Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port.
|
Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port.
|
||||||
|
|
||||||
This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org).
|
This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org).
|
||||||
|
|
||||||
Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com).
|
Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com).
|
||||||
|
|
||||||
Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:james@conceptofzero.net)
|
Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:james@conceptofzero.net)
|
@ -1,33 +1,33 @@
|
|||||||
PS Vita
|
PS Vita
|
||||||
=======
|
=======
|
||||||
SDL port for the Sony Playstation Vita and Sony Playstation TV
|
SDL port for the Sony Playstation Vita and Sony Playstation TV
|
||||||
|
|
||||||
Credit to
|
Credit to
|
||||||
* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
|
* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
|
||||||
* vitasdk/dolcesdk devs
|
* vitasdk/dolcesdk devs
|
||||||
* CBPS discord (Namely Graphene and SonicMastr)
|
* CBPS discord (Namely Graphene and SonicMastr)
|
||||||
|
|
||||||
Building
|
Building
|
||||||
--------
|
--------
|
||||||
To build for the PSVita, make sure you have vitasdk and cmake installed and run:
|
To build for the PSVita, make sure you have vitasdk and cmake installed and run:
|
||||||
```
|
```
|
||||||
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build build
|
cmake --build build
|
||||||
cmake --install build
|
cmake --install build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
-----
|
-----
|
||||||
* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
|
* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
|
||||||
These renderers support 720p and 1080i resolutions. These can be specified with:
|
These renderers support 720p and 1080i resolutions. These can be specified with:
|
||||||
`SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
|
`SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
|
||||||
* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
|
* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
|
||||||
They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
|
They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
|
||||||
anytime before video subsystem initialization.
|
anytime before video subsystem initialization.
|
||||||
* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
|
* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
|
||||||
* By default SDL emits mouse events for touch events on every touchscreen.
|
* By default SDL emits mouse events for touch events on every touchscreen.
|
||||||
Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
|
Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
|
||||||
Individual touchscreens can be disabled with:
|
Individual touchscreens can be disabled with:
|
||||||
`SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
|
`SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
|
||||||
* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
|
* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
|
@ -1,10 +1,10 @@
|
|||||||
WinCE
|
WinCE
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Windows CE is no longer supported by SDL.
|
Windows CE is no longer supported by SDL.
|
||||||
|
|
||||||
We have left the CE support in SDL 1.2 for those that must have it, and we
|
We have left the CE support in SDL 1.2 for those that must have it, and we
|
||||||
have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
|
have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
|
||||||
|
|
||||||
--ryan.
|
--ryan.
|
||||||
|
|
@ -1,58 +1,58 @@
|
|||||||
# Windows
|
# Windows
|
||||||
|
|
||||||
## LLVM and Intel C++ compiler support
|
## LLVM and Intel C++ compiler support
|
||||||
|
|
||||||
SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
|
SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
|
||||||
compiler, but you'll have to manually add the "-msse3" command line option
|
compiler, but you'll have to manually add the "-msse3" command line option
|
||||||
to at least the SDL_audiocvt.c source file, and possibly others. This may
|
to at least the SDL_audiocvt.c source file, and possibly others. This may
|
||||||
not be necessary if you build SDL with CMake instead of the included Visual
|
not be necessary if you build SDL with CMake instead of the included Visual
|
||||||
Studio solution.
|
Studio solution.
|
||||||
|
|
||||||
Details are here: https://github.com/libsdl-org/SDL/issues/5186
|
Details are here: https://github.com/libsdl-org/SDL/issues/5186
|
||||||
|
|
||||||
|
|
||||||
## OpenGL ES 2.x support
|
## OpenGL ES 2.x support
|
||||||
|
|
||||||
SDL has support for OpenGL ES 2.x under Windows via two alternative
|
SDL has support for OpenGL ES 2.x under Windows via two alternative
|
||||||
implementations.
|
implementations.
|
||||||
|
|
||||||
The most straightforward method consists in running your app in a system with
|
The most straightforward method consists in running your app in a system with
|
||||||
a graphic card paired with a relatively recent (as of November of 2013) driver
|
a graphic card paired with a relatively recent (as of November of 2013) driver
|
||||||
which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
|
which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
|
||||||
to ship said extension on Windows currently include nVidia and Intel.
|
to ship said extension on Windows currently include nVidia and Intel.
|
||||||
|
|
||||||
The other method involves using the
|
The other method involves using the
|
||||||
[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
|
[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
|
||||||
context is requested and no WGL_EXT_create_context_es2_profile extension is
|
context is requested and no WGL_EXT_create_context_es2_profile extension is
|
||||||
found, SDL will try to load the libEGL.dll library provided by ANGLE.
|
found, SDL will try to load the libEGL.dll library provided by ANGLE.
|
||||||
|
|
||||||
To obtain the ANGLE binaries, you can either compile from source from
|
To obtain the ANGLE binaries, you can either compile from source from
|
||||||
https://chromium.googlesource.com/angle/angle or copy the relevant binaries
|
https://chromium.googlesource.com/angle/angle or copy the relevant binaries
|
||||||
from a recent Chrome/Chromium install for Windows. The files you need are:
|
from a recent Chrome/Chromium install for Windows. The files you need are:
|
||||||
|
|
||||||
- libEGL.dll
|
- libEGL.dll
|
||||||
- libGLESv2.dll
|
- libGLESv2.dll
|
||||||
- d3dcompiler_46.dll (supports Windows Vista or later, better shader
|
- d3dcompiler_46.dll (supports Windows Vista or later, better shader
|
||||||
compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
|
compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
|
||||||
|
|
||||||
If you compile ANGLE from source, you can configure it so it does not need the
|
If you compile ANGLE from source, you can configure it so it does not need the
|
||||||
d3dcompiler_* DLL at all (for details on this, see their documentation).
|
d3dcompiler_* DLL at all (for details on this, see their documentation).
|
||||||
However, by default SDL will try to preload the d3dcompiler_46.dll to
|
However, by default SDL will try to preload the d3dcompiler_46.dll to
|
||||||
comply with ANGLE's requirements. If you wish SDL to preload
|
comply with ANGLE's requirements. If you wish SDL to preload
|
||||||
d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
|
d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
|
||||||
can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
|
can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
|
||||||
details).
|
details).
|
||||||
|
|
||||||
Known Bugs:
|
Known Bugs:
|
||||||
|
|
||||||
- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
|
- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
|
||||||
that there's a bug in the library which prevents the window contents from
|
that there's a bug in the library which prevents the window contents from
|
||||||
refreshing if this is set to anything other than the default value.
|
refreshing if this is set to anything other than the default value.
|
||||||
|
|
||||||
## Vulkan Surface Support
|
## Vulkan Surface Support
|
||||||
|
|
||||||
Support for creating Vulkan surfaces is configured on by default. To disable
|
Support for creating Vulkan surfaces is configured on by default. To disable
|
||||||
it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
|
it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
|
||||||
must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
|
must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
|
||||||
use Vulkan graphics in your application.
|
use Vulkan graphics in your application.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,63 +1,63 @@
|
|||||||
# Simple DirectMedia Layer
|
# Simple DirectMedia Layer
|
||||||
|
|
||||||
https://www.libsdl.org/
|
https://www.libsdl.org/
|
||||||
|
|
||||||
Simple DirectMedia Layer is a cross-platform development library designed
|
Simple DirectMedia Layer is a cross-platform development library designed
|
||||||
to provide low level access to audio, keyboard, mouse, joystick, and graphics
|
to provide low level access to audio, keyboard, mouse, joystick, and graphics
|
||||||
hardware via OpenGL and Direct3D. It is used by video playback software,
|
hardware via OpenGL and Direct3D. It is used by video playback software,
|
||||||
emulators, and popular games including Valve's award winning catalog
|
emulators, and popular games including Valve's award winning catalog
|
||||||
and many Humble Bundle games.
|
and many Humble Bundle games.
|
||||||
|
|
||||||
SDL officially supports Windows, macOS, Linux, iOS, and Android.
|
SDL officially supports Windows, macOS, Linux, iOS, and Android.
|
||||||
Support for other platforms may be found in the source code.
|
Support for other platforms may be found in the source code.
|
||||||
|
|
||||||
SDL is written in C, works natively with C++, and there are bindings
|
SDL is written in C, works natively with C++, and there are bindings
|
||||||
available for several other languages, including C# and Python.
|
available for several other languages, including C# and Python.
|
||||||
|
|
||||||
This library is distributed under the zlib license, which can be found
|
This library is distributed under the zlib license, which can be found
|
||||||
in the file "LICENSE.txt".
|
in the file "LICENSE.txt".
|
||||||
|
|
||||||
The best way to learn how to use SDL is to check out the header files in
|
The best way to learn how to use SDL is to check out the header files in
|
||||||
the "include" subdirectory and the programs in the "test" subdirectory.
|
the "include" subdirectory and the programs in the "test" subdirectory.
|
||||||
The header files and test programs are well commented and always up to date.
|
The header files and test programs are well commented and always up to date.
|
||||||
|
|
||||||
More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
|
More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
|
||||||
|
|
||||||
- [Android](README-android.md)
|
- [Android](README-android.md)
|
||||||
- [CMake](README-cmake.md)
|
- [CMake](README-cmake.md)
|
||||||
- [DirectFB](README-directfb.md)
|
- [DirectFB](README-directfb.md)
|
||||||
- [DynAPI](README-dynapi.md)
|
- [DynAPI](README-dynapi.md)
|
||||||
- [Emscripten](README-emscripten.md)
|
- [Emscripten](README-emscripten.md)
|
||||||
- [GDK](README-gdk.md)
|
- [GDK](README-gdk.md)
|
||||||
- [Gesture](README-gesture.md)
|
- [Gesture](README-gesture.md)
|
||||||
- [Git](README-git.md)
|
- [Git](README-git.md)
|
||||||
- [iOS](README-ios.md)
|
- [iOS](README-ios.md)
|
||||||
- [Linux](README-linux.md)
|
- [Linux](README-linux.md)
|
||||||
- [macOS](README-macos.md)
|
- [macOS](README-macos.md)
|
||||||
- [OS/2](README-os2.md)
|
- [OS/2](README-os2.md)
|
||||||
- [Native Client](README-nacl.md)
|
- [Native Client](README-nacl.md)
|
||||||
- [Pandora](README-pandora.md)
|
- [Pandora](README-pandora.md)
|
||||||
- [Supported Platforms](README-platforms.md)
|
- [Supported Platforms](README-platforms.md)
|
||||||
- [Porting information](README-porting.md)
|
- [Porting information](README-porting.md)
|
||||||
- [PSP](README-psp.md)
|
- [PSP](README-psp.md)
|
||||||
- [PS2](README-ps2.md)
|
- [PS2](README-ps2.md)
|
||||||
- [Raspberry Pi](README-raspberrypi.md)
|
- [Raspberry Pi](README-raspberrypi.md)
|
||||||
- [Touch](README-touch.md)
|
- [Touch](README-touch.md)
|
||||||
- [Versions](README-versions.md)
|
- [Versions](README-versions.md)
|
||||||
- [WinCE](README-wince.md)
|
- [WinCE](README-wince.md)
|
||||||
- [Windows](README-windows.md)
|
- [Windows](README-windows.md)
|
||||||
- [WinRT](README-winrt.md)
|
- [WinRT](README-winrt.md)
|
||||||
- [PSVita](README-vita.md)
|
- [PSVita](README-vita.md)
|
||||||
- [Nokia N-Gage](README-ngage.md)
|
- [Nokia N-Gage](README-ngage.md)
|
||||||
|
|
||||||
If you need help with the library, or just want to discuss SDL related
|
If you need help with the library, or just want to discuss SDL related
|
||||||
issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),
|
issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),
|
||||||
which can be used as a web forum or a mailing list, at your preference.
|
which can be used as a web forum or a mailing list, at your preference.
|
||||||
|
|
||||||
If you want to report bugs or contribute patches, please submit them to
|
If you want to report bugs or contribute patches, please submit them to
|
||||||
[our bug tracker](https://github.com/libsdl-org/SDL/issues)
|
[our bug tracker](https://github.com/libsdl-org/SDL/issues)
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
|
|
||||||
Sam Lantinga <mailto:slouken@libsdl.org>
|
Sam Lantinga <mailto:slouken@libsdl.org>
|
@ -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
322
third_party/SDL2/include/SDL_assert.h
vendored
Normal 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: */
|
@ -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_ */
|
||||||
|
|
@ -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
126
third_party/SDL2/include/SDL_bits.h
vendored
Normal 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: */
|
@ -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_ */
|
||||||
|
|
@ -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
333
third_party/SDL2/include/SDL_config.h
vendored
Normal 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: */
|
@ -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
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
348
third_party/SDL2/include/SDL_endian.h
vendored
Normal 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: */
|
@ -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
1159
third_party/SDL2/include/SDL_events.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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
2892
third_party/SDL2/include/SDL_hints.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -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_ */
|
||||||
|
|
@ -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.
|
||||||
@ -300,7 +301,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
|
|||||||
* Set the rectangle used to type Unicode text inputs. Native input methods
|
* Set the rectangle used to type Unicode text inputs. Native input methods
|
||||||
* will place a window with word suggestions near it, without covering the
|
* will place a window with word suggestions near it, without covering the
|
||||||
* text being inputted.
|
* text being inputted.
|
||||||
*
|
*
|
||||||
* To start text input in a given location, this function is intended to be
|
* To start text input in a given location, this function is intended to be
|
||||||
* called before SDL_StartTextInput, although some platforms support moving
|
* called before SDL_StartTextInput, although some platforms support moving
|
||||||
* the rectangle even while text input (and a composition) is active.
|
* the rectangle even while text input (and a composition) is active.
|
||||||
@ -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
358
third_party/SDL2/include/SDL_keycode.h
vendored
Normal 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: */
|
@ -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_ */
|
||||||
|
|
@ -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 */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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_ */
|
||||||
|
|
@ -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
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
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
Loading…
Reference in New Issue
Block a user