SDL 3.0
|
#include <SDL3/SDL_platform_defines.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <SDL3/SDL_begin_code.h>
#include <SDL3/SDL_close_code.h>
Go to the source code of this file.
Macros | |
#define | SDL_SIZE_MAX ((size_t) -1) |
#define | SDL_HAS_BUILTIN(x) 0 |
#define | SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) |
#define | SDL_STRINGIFY_ARG(arg) #arg |
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). | |
#define | SDL_reinterpret_cast(type, expression) ((type)(expression)) |
#define | SDL_static_cast(type, expression) ((type)(expression)) |
#define | SDL_const_cast(type, expression) ((type)(expression)) |
#define | SDL_FOURCC(A, B, C, D) |
Functions | |
void * | alloca (size_t) |
Basic data types | |
#define | SDL_FALSE 0 |
#define | SDL_TRUE 1 |
#define | SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ |
#define | SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ |
#define | SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ |
#define | SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ |
#define | SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ |
#define | SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ |
#define | SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ |
#define | SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ |
#define | SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ |
#define | SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ |
#define | SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ |
#define | SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ |
#define | SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ |
#define | SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ |
#define | SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ |
#define | SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ |
#define | SDL_MAX_TIME SDL_MAX_SINT64 |
#define | SDL_MIN_TIME SDL_MIN_SINT64 |
typedef int | SDL_bool |
typedef int8_t | Sint8 |
typedef uint8_t | Uint8 |
typedef int16_t | Sint16 |
typedef uint16_t | Uint16 |
typedef int32_t | Sint32 |
typedef uint32_t | Uint32 |
typedef int64_t | Sint64 |
typedef uint64_t | Uint64 |
typedef Sint64 | SDL_Time |
Floating-point constants | |
#define | SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */ |
#define | SDL_PRIs64 "lld" |
#define | SDL_PRIu64 "llu" |
#define | SDL_PRIx64 "llx" |
#define | SDL_PRIX64 "llX" |
#define | SDL_PRIs32 "d" |
#define | SDL_PRIu32 "u" |
#define | SDL_PRIx32 "x" |
#define | SDL_PRIX32 "X" |
#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) |
#define | SDL_WPRINTF_VARARG_FUNC(fmtargnumber) |
#define | SDL_WSCANF_VARARG_FUNC(fmtargnumber) |
#define | SDL_COMPILE_TIME_ASSERT(name, x) typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] |
#define | SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) |
#define | SDL_stack_free(data) |
#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))) |
#define | SDL_memcpy memcpy |
#define | SDL_copyp(dst, src) |
#define | SDL_memmove memmove |
#define | SDL_memset memset |
#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_PI_D 3.141592653589793238462643383279502884 |
#define | SDL_PI_F 3.141592653589793238462643383279502884F |
#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 |
#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)) |
typedef void *(* | SDL_malloc_func) (size_t size) |
typedef void *(* | SDL_calloc_func) (size_t nmemb, size_t size) |
typedef void *(* | SDL_realloc_func) (void *mem, size_t size) |
typedef void(* | SDL_free_func) (void *mem) |
typedef struct SDL_iconv_data_t * | SDL_iconv_t |
typedef void(* | SDL_FunctionPointer) (void) |
SDL_MALLOC size_t | size |
SDL_MALLOC void * | SDL_malloc (size_t size) |
SDL_MALLOC | SDL_ALLOC_SIZE2 (1, 2) void *SDL_calloc(size_t nmemb |
SDL_ALLOC_SIZE (2) void *SDL_realloc(void *mem | |
void | SDL_free (void *mem) |
void | SDL_GetOriginalMemoryFunctions (SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func) |
void | SDL_GetMemoryFunctions (SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func) |
int | SDL_SetMemoryFunctions (SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func) |
SDL_MALLOC void * | SDL_aligned_alloc (size_t alignment, size_t size) |
void | SDL_aligned_free (void *mem) |
int | SDL_GetNumAllocations (void) |
char * | SDL_getenv (const char *name) |
int | SDL_setenv (const char *name, const char *value, int overwrite) |
void | SDL_qsort (void *base, size_t nmemb, size_t size, int(*compare)(const void *, const void *)) |
void * | SDL_bsearch (const void *key, const void *base, size_t nmemb, size_t size, int(*compare)(const void *, const void *)) |
void | SDL_qsort_r (void *base, size_t nmemb, size_t size, int(*compare)(void *, const void *, const void *), void *userdata) |
void * | SDL_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size, int(*compare)(void *, const void *, const void *), void *userdata) |
int | SDL_abs (int x) |
int | SDL_isalpha (int x) |
int | SDL_isalnum (int x) |
int | SDL_isblank (int x) |
int | SDL_iscntrl (int x) |
int | SDL_isdigit (int x) |
int | SDL_isxdigit (int x) |
int | SDL_ispunct (int x) |
int | SDL_isspace (int x) |
int | SDL_isupper (int x) |
int | SDL_islower (int x) |
int | SDL_isprint (int x) |
int | SDL_isgraph (int x) |
int | SDL_toupper (int x) |
int | SDL_tolower (int x) |
Uint16 | SDL_crc16 (Uint16 crc, const void *data, size_t len) |
Uint32 | SDL_crc32 (Uint32 crc, const void *data, size_t len) |
void * | SDL_memcpy (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) |
void * | SDL_memmove (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) |
void * | SDL_memset (SDL_OUT_BYTECAP(len) void *dst, int c, size_t len) |
void * | SDL_memset4 (void *dst, Uint32 val, size_t dwords) |
int | SDL_memcmp (const void *s1, const void *s2, size_t len) |
size_t | SDL_wcslen (const wchar_t *wstr) |
size_t | SDL_wcsnlen (const wchar_t *wstr, size_t maxlen) |
size_t | SDL_wcslcpy (SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen) |
size_t | SDL_wcslcat (SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen) |
wchar_t * | SDL_wcsdup (const wchar_t *wstr) |
wchar_t * | SDL_wcsstr (const wchar_t *haystack, const wchar_t *needle) |
wchar_t * | SDL_wcsnstr (const wchar_t *haystack, const wchar_t *needle, size_t maxlen) |
int | SDL_wcscmp (const wchar_t *str1, const wchar_t *str2) |
int | SDL_wcsncmp (const wchar_t *str1, const wchar_t *str2, size_t maxlen) |
int | SDL_wcscasecmp (const wchar_t *str1, const wchar_t *str2) |
int | SDL_wcsncasecmp (const wchar_t *str1, const wchar_t *str2, size_t maxlen) |
long | SDL_wcstol (const wchar_t *str, wchar_t **endp, int base) |
size_t | SDL_strlen (const char *str) |
size_t | SDL_strnlen (const char *str, size_t maxlen) |
size_t | SDL_strlcpy (SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) |
size_t | SDL_utf8strlcpy (SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) |
size_t | SDL_strlcat (SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) |
SDL_MALLOC char * | SDL_strdup (const char *str) |
SDL_MALLOC char * | SDL_strndup (const char *str, size_t maxlen) |
char * | SDL_strrev (char *str) |
char * | SDL_strupr (char *str) |
char * | SDL_strlwr (char *str) |
char * | SDL_strchr (const char *str, int c) |
char * | SDL_strrchr (const char *str, int c) |
char * | SDL_strstr (const char *haystack, const char *needle) |
char * | SDL_strnstr (const char *haystack, const char *needle, size_t maxlen) |
char * | SDL_strcasestr (const char *haystack, const char *needle) |
char * | SDL_strtok_r (char *s1, const char *s2, char **saveptr) |
size_t | SDL_utf8strlen (const char *str) |
size_t | SDL_utf8strnlen (const char *str, size_t bytes) |
char * | SDL_itoa (int value, char *str, int radix) |
char * | SDL_uitoa (unsigned int value, char *str, int radix) |
char * | SDL_ltoa (long value, char *str, int radix) |
char * | SDL_ultoa (unsigned long value, char *str, int radix) |
char * | SDL_lltoa (Sint64 value, char *str, int radix) |
char * | SDL_ulltoa (Uint64 value, char *str, int radix) |
int | SDL_atoi (const char *str) |
double | SDL_atof (const char *str) |
long | SDL_strtol (const char *str, char **endp, int base) |
unsigned long | SDL_strtoul (const char *str, char **endp, int base) |
Sint64 | SDL_strtoll (const char *str, char **endp, int base) |
Uint64 | SDL_strtoull (const char *str, char **endp, int base) |
double | SDL_strtod (const char *str, char **endp) |
int | SDL_strcmp (const char *str1, const char *str2) |
int | SDL_strncmp (const char *str1, const char *str2, size_t maxlen) |
int | SDL_strcasecmp (const char *str1, const char *str2) |
int | SDL_strncasecmp (const char *str1, const char *str2, size_t maxlen) |
int | SDL_sscanf (const char *text, SDL_SCANF_FORMAT_STRING const char *fmt,...) SDL_SCANF_VARARG_FUNC(2) |
int | SDL_vsscanf (const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2) |
int | SDL_snprintf (SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(3) |
int | SDL_swprintf (SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt,...) SDL_WPRINTF_VARARG_FUNC(3) |
int | 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) |
int | SDL_vswprintf (SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, const wchar_t *fmt, va_list ap) |
int | SDL_asprintf (char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(2) |
int | SDL_vasprintf (char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2) |
double | SDL_acos (double x) |
float | SDL_acosf (float x) |
double | SDL_asin (double x) |
float | SDL_asinf (float x) |
double | SDL_atan (double x) |
float | SDL_atanf (float x) |
double | SDL_atan2 (double y, double x) |
float | SDL_atan2f (float y, float x) |
double | SDL_ceil (double x) |
float | SDL_ceilf (float x) |
double | SDL_copysign (double x, double y) |
float | SDL_copysignf (float x, float y) |
double | SDL_cos (double x) |
float | SDL_cosf (float x) |
double | SDL_exp (double x) |
float | SDL_expf (float x) |
double | SDL_fabs (double x) |
float | SDL_fabsf (float x) |
double | SDL_floor (double x) |
float | SDL_floorf (float x) |
double | SDL_trunc (double x) |
float | SDL_truncf (float x) |
double | SDL_fmod (double x, double y) |
float | SDL_fmodf (float x, float y) |
double | SDL_log (double x) |
float | SDL_logf (float x) |
double | SDL_log10 (double x) |
float | SDL_log10f (float x) |
double | SDL_modf (double x, double *y) |
float | SDL_modff (float x, float *y) |
double | SDL_pow (double x, double y) |
float | SDL_powf (float x, float y) |
double | SDL_round (double x) |
float | SDL_roundf (float x) |
long | SDL_lround (double x) |
long | SDL_lroundf (float x) |
double | SDL_scalbn (double x, int n) |
float | SDL_scalbnf (float x, int n) |
double | SDL_sin (double x) |
float | SDL_sinf (float x) |
double | SDL_sqrt (double x) |
float | SDL_sqrtf (float x) |
double | SDL_tan (double x) |
float | SDL_tanf (float x) |
SDL_iconv_t | SDL_iconv_open (const char *tocode, const char *fromcode) |
int | SDL_iconv_close (SDL_iconv_t cd) |
size_t | SDL_iconv (SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
char * | SDL_iconv_string (const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft) |
SDL_FORCE_INLINE int | SDL_size_mul_overflow (size_t a, size_t b, size_t *ret) |
SDL_FORCE_INLINE int | SDL_size_add_overflow (size_t a, size_t b, size_t *ret) |
This is a general header that includes C language support. It implements a subset of the C runtime: these should all behave the same way as their C runtime equivalents, but with an SDL_ prefix.
Definition in file SDL_stdinc.h.
#define SDL_arraysize | ( | array | ) | (sizeof(array)/sizeof(array[0])) |
The number of elements in an array.
NOTE: This macro double-evaluates the argument, so you should never have side effects in the parameter.
Definition at line 99 of file SDL_stdinc.h.
#define SDL_clamp | ( | x, | |
a, | |||
b | |||
) | (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x))) |
Definition at line 578 of file SDL_stdinc.h.
#define SDL_COMPILE_TIME_ASSERT | ( | name, | |
x | |||
) | typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] |
Definition at line 417 of file SDL_stdinc.h.
#define SDL_const_cast | ( | type, | |
expression | |||
) | ((type)(expression)) |
Definition at line 128 of file SDL_stdinc.h.
#define SDL_copyp | ( | dst, | |
src | |||
) |
Definition at line 829 of file SDL_stdinc.h.
#define SDL_FALSE 0 |
A boolean false.
Definition at line 151 of file SDL_stdinc.h.
#define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */ |
Definition at line 268 of file SDL_stdinc.h.
#define SDL_FOURCC | ( | A, | |
B, | |||
C, | |||
D | |||
) |
Definition at line 133 of file SDL_stdinc.h.
#define SDL_HAS_BUILTIN | ( | x | ) | 0 |
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.
Definition at line 88 of file SDL_stdinc.h.
#define SDL_ICONV_E2BIG (size_t)-2 |
Definition at line 2369 of file SDL_stdinc.h.
#define SDL_ICONV_EILSEQ (size_t)-3 |
Definition at line 2370 of file SDL_stdinc.h.
#define SDL_ICONV_EINVAL (size_t)-4 |
Definition at line 2371 of file SDL_stdinc.h.
#define SDL_ICONV_ERROR (size_t)-1 |
Definition at line 2368 of file SDL_stdinc.h.
#define SDL_iconv_utf8_locale | ( | S | ) | SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) |
Definition at line 2392 of file SDL_stdinc.h.
#define SDL_iconv_utf8_ucs2 | ( | S | ) | (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) |
Definition at line 2393 of file SDL_stdinc.h.
#define SDL_iconv_utf8_ucs4 | ( | S | ) | (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) |
Definition at line 2394 of file SDL_stdinc.h.
#define SDL_iconv_wchar_utf8 | ( | S | ) | SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t)) |
Definition at line 2395 of file SDL_stdinc.h.
#define SDL_IN_BYTECAP | ( | x | ) |
Definition at line 379 of file SDL_stdinc.h.
#define SDL_INOUT_Z_CAP | ( | x | ) |
Definition at line 380 of file SDL_stdinc.h.
#define SDL_max | ( | x, | |
y | |||
) | (((x) > (y)) ? (x) : (y)) |
Definition at line 577 of file SDL_stdinc.h.
#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ |
A signed 16-bit integer type.
Definition at line 195 of file SDL_stdinc.h.
#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ |
A signed 32-bit integer type.
Definition at line 213 of file SDL_stdinc.h.
#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ |
A signed 64-bit integer type.
Definition at line 231 of file SDL_stdinc.h.
#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ |
A signed 8-bit integer type.
Definition at line 177 of file SDL_stdinc.h.
#define SDL_MAX_TIME SDL_MAX_SINT64 |
SDL times are signed, 64-bit integers representing nanoseconds since the Unix epoch (Jan 1, 1970).
They can be converted between POSIX time_t values with SDL_NS_TO_SECONDS() and SDL_SECONDS_TO_NS(), and between Windows FILETIME values with SDL_TimeToWindows() and SDL_TimeFromWindows().
Definition at line 254 of file SDL_stdinc.h.
#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ |
An unsigned 16-bit integer type.
Definition at line 204 of file SDL_stdinc.h.
#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ |
An unsigned 32-bit integer type.
Definition at line 222 of file SDL_stdinc.h.
#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ |
An unsigned 64-bit integer type.
Definition at line 240 of file SDL_stdinc.h.
#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ |
An unsigned 8-bit integer type.
Definition at line 186 of file SDL_stdinc.h.
#define SDL_memcpy memcpy |
Definition at line 826 of file SDL_stdinc.h.
#define SDL_memmove memmove |
Definition at line 840 of file SDL_stdinc.h.
#define SDL_memset memset |
Definition at line 851 of file SDL_stdinc.h.
#define SDL_min | ( | x, | |
y | |||
) | (((x) < (y)) ? (x) : (y)) |
Definition at line 576 of file SDL_stdinc.h.
#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ |
Definition at line 196 of file SDL_stdinc.h.
#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ |
Definition at line 214 of file SDL_stdinc.h.
#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ |
Definition at line 232 of file SDL_stdinc.h.
#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ |
Definition at line 178 of file SDL_stdinc.h.
#define SDL_MIN_TIME SDL_MIN_SINT64 |
Definition at line 255 of file SDL_stdinc.h.
#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ |
Definition at line 205 of file SDL_stdinc.h.
#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ |
Definition at line 223 of file SDL_stdinc.h.
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ |
Definition at line 241 of file SDL_stdinc.h.
#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ |
Definition at line 187 of file SDL_stdinc.h.
#define SDL_OUT_BYTECAP | ( | x | ) |
Definition at line 383 of file SDL_stdinc.h.
#define SDL_OUT_CAP | ( | x | ) |
Definition at line 382 of file SDL_stdinc.h.
#define SDL_OUT_Z_BYTECAP | ( | x | ) |
Definition at line 384 of file SDL_stdinc.h.
#define SDL_OUT_Z_CAP | ( | x | ) |
Definition at line 381 of file SDL_stdinc.h.
#define SDL_PI_D 3.141592653589793238462643383279502884 |
pi (double)
Definition at line 1192 of file SDL_stdinc.h.
#define SDL_PI_F 3.141592653589793238462643383279502884F |
pi (float)
Definition at line 1195 of file SDL_stdinc.h.
#define SDL_PRINTF_FORMAT_STRING |
Definition at line 385 of file SDL_stdinc.h.
#define SDL_PRINTF_VARARG_FUNC | ( | fmtargnumber | ) |
Definition at line 396 of file SDL_stdinc.h.
#define SDL_PRINTF_VARARG_FUNCV | ( | fmtargnumber | ) |
Definition at line 397 of file SDL_stdinc.h.
#define SDL_PRIs32 "d" |
Definition at line 324 of file SDL_stdinc.h.
#define SDL_PRIs64 "lld" |
Definition at line 284 of file SDL_stdinc.h.
#define SDL_PRIu32 "u" |
Definition at line 331 of file SDL_stdinc.h.
#define SDL_PRIu64 "llu" |
Definition at line 295 of file SDL_stdinc.h.
#define SDL_PRIx32 "x" |
Definition at line 338 of file SDL_stdinc.h.
#define SDL_PRIX32 "X" |
Definition at line 345 of file SDL_stdinc.h.
#define SDL_PRIx64 "llx" |
Definition at line 306 of file SDL_stdinc.h.
#define SDL_PRIX64 "llX" |
Definition at line 317 of file SDL_stdinc.h.
#define SDL_reinterpret_cast | ( | type, | |
expression | |||
) | ((type)(expression)) |
Definition at line 126 of file SDL_stdinc.h.
#define SDL_SCANF_FORMAT_STRING |
Definition at line 386 of file SDL_stdinc.h.
#define SDL_SCANF_VARARG_FUNC | ( | fmtargnumber | ) |
Definition at line 398 of file SDL_stdinc.h.
#define SDL_SCANF_VARARG_FUNCV | ( | fmtargnumber | ) |
Definition at line 399 of file SDL_stdinc.h.
#define SDL_SIZE_MAX ((size_t) -1) |
Definition at line 77 of file SDL_stdinc.h.
#define SDL_stack_alloc | ( | type, | |
count | |||
) | (type*)alloca(sizeof(type)*(count)) |
Definition at line 461 of file SDL_stdinc.h.
#define SDL_stack_free | ( | data | ) |
Definition at line 462 of file SDL_stdinc.h.
#define SDL_static_cast | ( | type, | |
expression | |||
) | ((type)(expression)) |
Definition at line 127 of file SDL_stdinc.h.
#define SDL_STRINGIFY_ARG | ( | arg | ) | #arg |
Macro useful for building other macros with strings in them.
For example:
Definition at line 112 of file SDL_stdinc.h.
#define SDL_TRUE 1 |
A boolean true.
Definition at line 160 of file SDL_stdinc.h.
#define SDL_WPRINTF_VARARG_FUNC | ( | fmtargnumber | ) |
Definition at line 400 of file SDL_stdinc.h.
#define SDL_WSCANF_VARARG_FUNC | ( | fmtargnumber | ) |
Definition at line 401 of file SDL_stdinc.h.
#define SDL_zero | ( | x | ) | SDL_memset(&(x), 0, sizeof((x))) |
Definition at line 854 of file SDL_stdinc.h.
#define SDL_zeroa | ( | x | ) | SDL_memset((x), 0, sizeof((x))) |
Definition at line 856 of file SDL_stdinc.h.
#define SDL_zerop | ( | x | ) | SDL_memset((x), 0, sizeof(*(x))) |
Definition at line 855 of file SDL_stdinc.h.
typedef int SDL_bool |
A boolean type: true or false.
Definition at line 170 of file SDL_stdinc.h.
typedef void *(* SDL_calloc_func) (size_t nmemb, size_t size) |
Definition at line 474 of file SDL_stdinc.h.
typedef void(* SDL_free_func) (void *mem) |
Definition at line 476 of file SDL_stdinc.h.
typedef void(* SDL_FunctionPointer) (void) |
Definition at line 2532 of file SDL_stdinc.h.
typedef struct SDL_iconv_data_t* SDL_iconv_t |
Definition at line 2374 of file SDL_stdinc.h.
typedef void *(* SDL_malloc_func) (size_t size) |
Definition at line 473 of file SDL_stdinc.h.
typedef void *(* SDL_realloc_func) (void *mem, size_t size) |
Definition at line 475 of file SDL_stdinc.h.
Definition at line 256 of file SDL_stdinc.h.
typedef int16_t Sint16 |
Definition at line 197 of file SDL_stdinc.h.
typedef int32_t Sint32 |
Definition at line 215 of file SDL_stdinc.h.
typedef int64_t Sint64 |
Definition at line 233 of file SDL_stdinc.h.
typedef int8_t Sint8 |
Definition at line 179 of file SDL_stdinc.h.
typedef uint16_t Uint16 |
Definition at line 206 of file SDL_stdinc.h.
typedef uint32_t Uint32 |
Definition at line 224 of file SDL_stdinc.h.
typedef uint64_t Uint64 |
Definition at line 242 of file SDL_stdinc.h.
typedef uint8_t Uint8 |
Definition at line 188 of file SDL_stdinc.h.
void * alloca | ( | size_t | ) |
|
extern |
|
extern |
Compute the arc cosine of x
.
The definition of y = acos(x)
is x = cos(y)
.
Domain: -1 <= x <= 1
Range: 0 <= y <= Pi
This function operates on double-precision floating point values, use SDL_acosf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value |
x
, in radians\threadsafety It is safe to call this function from any thread.
|
extern |
Compute the arc cosine of x
.
The definition of y = acos(x)
is x = cos(y)
.
Domain: -1 <= x <= 1
Range: 0 <= y <= Pi
This function operates on single-precision floating point values, use SDL_acos for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. |
x
, in radians
|
extern |
Allocate memory aligned to a specific value.
If alignment
is less than the size of void *
, then it will be increased to match that.
The returned memory address will be a multiple of the alignment value, and the amount of memory allocated will be a multiple of the alignment value.
The memory returned by this function must be freed with SDL_aligned_free()
alignment | the alignment requested |
size | the size to allocate |
|
extern |
Free memory allocated by SDL_aligned_alloc().
|
extern |
|
extern |
|
extern |
Compute the arc sine of x
.
The definition of y = asin(x)
is x = sin(y)
.
Domain: -1 <= x <= 1
Range: -Pi/2 <= y <= Pi/2
This function operates on double-precision floating point values, use SDL_asinf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. |
x
, in radians.
|
extern |
Compute the arc sine of x
.
The definition of y = asin(x)
is x = sin(y)
.
Domain: -1 <= x <= 1
Range: -Pi/2 <= y <= Pi/2
This function operates on single-precision floating point values, use SDL_asin for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. |
x
, in radians.
|
extern |
|
extern |
Compute the arc tangent of x
.
The definition of y = atan(x)
is x = tan(y)
.
Domain: -INF <= x <= INF
Range: -Pi/2 <= y <= Pi/2
This function operates on double-precision floating point values, use SDL_atanf for single-precision floats.
To calculate the arc tangent of y / x, use SDL_atan2.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. |
x
in radians, or 0 if x = 0
.
|
extern |
Compute the arc tangent of y / x
, using the signs of x and y to adjust the result's quadrant.
The definition of z = atan2(x, y)
is y = x tan(z)
, where the quadrant of z is determined based on the signs of x and y.
Domain: -INF <= x <= INF
, -INF <= y <= INF
Range: -Pi/2 <= y <= Pi/2
This function operates on double-precision floating point values, use SDL_atan2f for single-precision floats.
To calculate the arc tangent of a single value, use SDL_atan.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value of the denominator (x coordinate). |
y | floating point value of the numerator (y coordinate) |
y / x
in radians, or, if x = 0
, either -Pi/2
, 0
, or Pi/2
, depending on the value of y
.
|
extern |
Compute the arc tangent of y / x
, using the signs of x and y to adjust the result's quadrant.
The definition of z = atan2(x, y)
is y = x tan(z)
, where the quadrant of z is determined based on the signs of x and y.
Domain: -INF <= x <= INF
, -INF <= y <= INF
Range: -Pi/2 <= y <= Pi/2
This function operates on single-precision floating point values, use SDL_atan2 for double-precision floats.
To calculate the arc tangent of a single value, use SDL_atanf.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value of the denominator (x coordinate). |
y | floating point value of the numerator (y coordinate) |
y / x
in radians, or, if x = 0
, either -Pi/2
, 0
, or Pi/2
, depending on the value of y
.
|
extern |
Compute the arc tangent of x
.
The definition of y = atan(x)
is x = tan(y)
.
Domain: -INF <= x <= INF
Range: -Pi/2 <= y <= Pi/2
This function operates on single-precision floating point values, use SDL_atan for dboule-precision floats.
To calculate the arc tangent of y / x, use SDL_atan2f.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. |
x
in radians, or 0 if x = 0
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Compute the ceiling of x
.
The ceiling of x
is the smallest integer y
such that y > x
, i.e x
rounded up to the nearest integer.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on double-precision floating point values, use SDL_ceilf for single-precision floats.
x | floating point value |
x
|
extern |
Compute the ceiling of x
.
The ceiling of x
is the smallest integer y
such that y > x
, i.e x
rounded up to the nearest integer.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on single-precision floating point values, use SDL_ceil for double-precision floats.
x | floating point value |
x
|
extern |
Copy the sign of one floating-point value to another.
The definition of copysign is that copysign(x, y) = abs(x) * sign(y)
.
Domain: -INF <= x <= INF
, -INF <= y <= f
Range: -INF <= z <= INF
This function operates on double-precision floating point values, use SDL_copysignf for single-precision floats.
x | floating point value to use as the magnitude |
y | floating point value to use as the sign |
|
extern |
Copy the sign of one floating-point value to another.
The definition of copysign is that copysign(x, y) = abs(x) * sign(y)
.
Domain: -INF <= x <= INF
, -INF <= y <= f
Range: -INF <= z <= INF
This function operates on single-precision floating point values, use SDL_copysign for double-precision floats.
x | floating point value to use as the magnitude |
y | floating point value to use as the sign |
|
extern |
Compute the cosine of x
.
Domain: -INF <= x <= INF
Range: -1 <= y <= 1
This function operates on double-precision floating point values, use SDL_cosf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value, in radians |
x
|
extern |
Compute the cosine of x
.
Domain: -INF <= x <= INF
Range: -1 <= y <= 1
This function operates on single-precision floating point values, use SDL_cos for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value, in radians |
x
|
extern |
Compute the exponential of x
.
The definition of y = exp(x)
is y = e^x
, where e
is the base of the natural logarithm. The inverse is the natural logarithm, SDL_log.
Domain: -INF <= x <= INF
Range: 0 <= y <= INF
The output will overflow if exp(x)
is too large to be represented.
This function operates on double-precision floating point values, use SDL_expf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value |
e^x
|
extern |
Compute the exponential of x
.
The definition of y = exp(x)
is y = e^x
, where e
is the base of the natural logarithm. The inverse is the natural logarithm, SDL_logf.
Domain: -INF <= x <= INF
Range: 0 <= y <= INF
The output will overflow if exp(x)
is too large to be represented.
This function operates on single-precision floating point values, use SDL_exp for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value |
e^x
|
extern |
Compute the absolute value of x
Domain: -INF <= x <= INF
Range: 0 <= y <= INF
This function operates on double-precision floating point values, use SDL_copysignf for single-precision floats.
x | floating point value to use as the magnitude |
x
|
extern |
Compute the absolute value of x
Domain: -INF <= x <= INF
Range: 0 <= y <= INF
This function operates on single-precision floating point values, use SDL_copysignf for double-precision floats.
x | floating point value to use as the magnitude |
x
Referenced by SDL_RectsEqualEpsilon().
|
extern |
Compute the floor of x
.
The floor of x
is the largest integer y
such that y > x
, i.e x
rounded down to the nearest integer.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on double-precision floating point values, use SDL_floorf for single-precision floats.
x | floating point value |
x
|
extern |
Compute the floor of x
.
The floor of x
is the largest integer y
such that y > x
, i.e x
rounded down to the nearest integer.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on single-precision floating point values, use SDL_floorf for double-precision floats.
x | floating point value |
x
|
extern |
Return the floating-point remainder of x / y
Divides x
by y
, and returns the remainder.
Domain: -INF <= x <= INF
, -INF <= y <= INF
, y != 0
Range: -y <= z <= y
This function operates on double-precision floating point values, use SDL_fmodf for single-precision floats.
x | the numerator |
y | the denominator. Must not be 0. |
x / y
|
extern |
Return the floating-point remainder of x / y
Divides x
by y
, and returns the remainder.
Domain: -INF <= x <= INF
, -INF <= y <= INF
, y != 0
Range: -y <= z <= y
This function operates on single-precision floating point values, use SDL_fmod for single-precision floats.
x | the numerator |
y | the denominator. Must not be 0. |
x / y
|
extern |
|
extern |
|
extern |
Get the current set of SDL memory functions.
malloc_func | filled with malloc function |
calloc_func | filled with calloc function |
realloc_func | filled with realloc function |
free_func | filled with free function |
|
extern |
Get the number of outstanding (unfreed) allocations.
|
extern |
Get the original set of SDL memory functions.
malloc_func | filled with malloc function |
calloc_func | filled with calloc function |
realloc_func | filled with realloc function |
free_func | filled with free function |
|
extern |
|
extern |
|
extern |
|
extern |
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.
|
extern |
Query if a character is alphabetic (a letter) or a number.
WARNING: Regardless of system locale, this will only treat ASCII values for English 'a-z', 'A-Z', and '0-9' as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Query if a character is alphabetic (a letter).
WARNING: Regardless of system locale, this will only treat ASCII values for English 'a-z' and 'A-Z' as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is blank (a space or tab).
WARNING: Regardless of system locale, this will only treat ASCII values 0x20 (space) or 0x9 (tab) as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is a control character.
WARNING: Regardless of system locale, this will only treat ASCII values 0 through 0x1F, and 0x7F, as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is a numeric digit.
WARNING: Regardless of system locale, this will only treat ASCII values '0' (0x30) through '9' (0x39), as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is any "printable" except space.
Be advised that "printable" has a definition that goes back to text terminals from the dawn of computing, making this a sort of special case function that is not suitable for Unicode (or most any) text management.
WARNING: Regardless of system locale, this is equivalent to ‘(SDL_isprint(x)) && ((x) != ’ ')`.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is lower case.
WARNING: Regardless of system locale, this will only treat ASCII values 'a' through 'z' as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is "printable".
Be advised that "printable" has a definition that goes back to text terminals from the dawn of computing, making this a sort of special case function that is not suitable for Unicode (or most any) text management.
WARNING: Regardless of system locale, this will only treat ASCII values ' ' (0x20) through '~' (0x7E) as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is a punctuation mark.
WARNING: Regardless of system locale, this is equivalent to ((SDL_isgraph(x)) && (!SDL_isalnum(x)))
.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is whitespace.
WARNING: Regardless of system locale, this will only treat the following ASCII values as true:
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is upper case.
WARNING: Regardless of system locale, this will only treat ASCII values 'A' through 'Z' as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Report if a character is a hexadecimal digit.
WARNING: Regardless of system locale, this will only treat ASCII values 'A' through 'F', 'a' through 'f', and '0' through '9', as true.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
|
extern |
Compute the natural logarithm of x
.
Domain: 0 < x <= INF
Range: -INF <= y <= INF
It is an error for x
to be less than or equal to 0.
This function operates on double-precision floating point values, use SDL_logf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. Must be greater than 0. |
x
|
extern |
Compute the base-10 logarithm of x
.
Domain: 0 < x <= INF
Range: -INF <= y <= INF
It is an error for x
to be less than or equal to 0.
This function operates on double-precision floating point values, use SDL_log10f for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. Must be greater than 0. |
x
|
extern |
Compute the base-10 logarithm of x
.
Domain: 0 < x <= INF
Range: -INF <= y <= INF
It is an error for x
to be less than or equal to 0.
This function operates on single-precision floating point values, use SDL_log10 for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. Must be greater than 0. |
x
|
extern |
Compute the natural logarithm of x
.
Domain: 0 < x <= INF
Range: -INF <= y <= INF
It is an error for x
to be less than or equal to 0.
This function operates on single-precision floating point values, use SDL_log for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. Must be greater than 0. |
x
|
extern |
Round x
to the nearest integer representable as a long
Rounds x
to the nearest integer. Values halfway between integers will be rounded away from zero.
Domain: -INF <= x <= INF
Range: MIN_LONG <= y <= MAX_LONG
This function operates on double-precision floating point values, use SDL_lround for single-precision floats. To get the result as a floating-point type, use SDL_round.
x | floating point value |
x
|
extern |
Round x
to the nearest integer representable as a long
Rounds x
to the nearest integer. Values halfway between integers will be rounded away from zero.
Domain: -INF <= x <= INF
Range: MIN_LONG <= y <= MAX_LONG
This function operates on single-precision floating point values, use SDL_lroundf for double-precision floats. To get the result as a floating-point type, use SDL_roundf,
x | floating point value |
x
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Split x
into integer and fractional parts
This function operates on double-precision floating point values, use SDL_modff for single-precision floats.
x | floating point value |
y | output pointer to store the integer part of x |
x
|
extern |
Split x
into integer and fractional parts
This function operates on single-precision floating point values, use SDL_modf for double-precision floats.
x | floating point value |
y | output pointer to store the integer part of x |
x
|
extern |
Raise x
to the power y
Domain: -INF <= x <= INF
, -INF <= y <= INF
Range: -INF <= z <= INF
If y
is the base of the natural logarithm (e), consider using SDL_exp instead.
This function operates on double-precision floating point values, use SDL_powf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | the base |
y | the exponent |
x
raised to the power y
|
extern |
Raise x
to the power y
Domain: -INF <= x <= INF
, -INF <= y <= INF
Range: -INF <= z <= INF
If y
is the base of the natural logarithm (e), consider using SDL_exp instead.
This function operates on single-precision floating point values, use SDL_powf for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | the base |
y | the exponent |
x
raised to the power y
|
extern |
|
extern |
|
extern |
Round x
to the nearest integer.
Rounds x
to the nearest integer. Values halfway between integers will be rounded away from zero.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on double-precision floating point values, use SDL_roundf for single-precision floats. To get the result as an integer type, use SDL_lround.
x | floating point value |
x
|
extern |
Round x
to the nearest integer.
Rounds x
to the nearest integer. Values halfway between integers will be rounded away from zero.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on double-precision floating point values, use SDL_roundf for single-precision floats. To get the result as an integer type, use SDL_lroundf.
x | floating point value |
x
|
extern |
Scale x
by an integer power of two.
Multiplies x
by the n
th power of the floating point radix (always 2).
Domain: -INF <= x <= INF
, n
integer
Range: -INF <= y <= INF
This function operates on double-precision floating point values, use SDL_scalbnf for single-precision floats.
x | floating point value to be scaled |
n | integer exponent |
x * 2^n
|
extern |
Scale x
by an integer power of two.
Multiplies x
by the n
th power of the floating point radix (always 2).
Domain: -INF <= x <= INF
, n
integer
Range: -INF <= y <= INF
This function operates on single-precision floating point values, use SDL_scalbn for double-precision floats.
x | floating point value to be scaled |
n | integer exponent |
x * 2^n
|
extern |
|
extern |
Replace SDL's memory allocation functions with a custom set.
malloc_func | custom malloc function |
calloc_func | custom calloc function |
realloc_func | custom realloc function |
free_func | custom free function |
|
extern |
Compute the sine of x
.
Domain: -INF <= x <= INF
Range: -1 <= y <= 1
This function operates on double-precision floating point values, use SDL_sinf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value, in radians |
x
|
extern |
Compute the sine of x
.
Domain: -INF <= x <= INF
Range: -1 <= y <= 1
This function operates on single-precision floating point values, use SDL_sinf for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value, in radians |
x
SDL_FORCE_INLINE int SDL_size_add_overflow | ( | size_t | a, |
size_t | b, | ||
size_t * | ret | ||
) |
If a + b would overflow, return -1.
Otherwise store a + b via ret and return 0.
Definition at line 2503 of file SDL_stdinc.h.
References SDL_SIZE_MAX.
SDL_FORCE_INLINE int SDL_size_mul_overflow | ( | size_t | a, |
size_t | b, | ||
size_t * | ret | ||
) |
If a * b would overflow, return -1.
Otherwise store a * b via ret and return 0.
Definition at line 2470 of file SDL_stdinc.h.
References SDL_SIZE_MAX.
|
extern |
|
extern |
Compute the square root of x
.
Domain: 0 <= x <= INF
Range: 0 <= y <= INF
This function operates on double-precision floating point values, use SDL_sqrtf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. Must be greater than or equal to 0. |
x
|
extern |
Compute the square root of x
.
Domain: 0 <= x <= INF
Range: 0 <= y <= INF
This function operates on single-precision floating point values, use SDL_sqrt for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value. Must be greater than or equal to 0. |
x
|
extern |
|
extern |
Compare two null-terminated UTF-8 strings, case-insensitively.
This will work with Unicode strings, using a technique called "case-folding" to handle the vast majority of case-sensitive human languages regardless of system locale. It can deal with expanding values: a German Eszett character can compare against two ASCII 's' chars and be considered a match, for example. A notable exception: it does not handle the Turkish 'i' character; human language is complicated!
Since this handles Unicode, it expects the string to be well-formed UTF-8 and not a null-terminated string of arbitrary bytes. Bytes that are not valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT CHARACTER), which is to say two strings of random bits may turn out to match if they convert to the same amount of replacement characters.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
|
extern |
Compare two null-terminated UTF-8 strings.
Due to the nature of UTF-8 encoding, this will work with Unicode strings, since effectively this function just compares bytes until it hits a null-terminating character. Also due to the nature of UTF-8, this can be used with SDL_qsort() to put strings in (roughly) alphabetical order.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Convert a string to lowercase.
WARNING: Regardless of system locale, this will only convert ASCII values 'A' through 'Z' to lowercase.
This function operates on a null-terminated string of bytes–even if it is malformed UTF-8!–and converts ASCII characters 'A' through 'Z' to their lowercase equivalents in-place, returning the original str
pointer.
str | The string to convert in-place. |
str
pointer passed into this function.\threadsafety It is safe to call this function from any thread.
|
extern |
Compare two UTF-8 strings, case-insensitively, up to a number of bytes.
This will work with Unicode strings, using a technique called "case-folding" to handle the vast majority of case-sensitive human languages regardless of system locale. It can deal with expanding values: a German Eszett character can compare against two ASCII 's' chars and be considered a match, for example. A notable exception: it does not handle the Turkish 'i' character; human language is complicated!
Since this handles Unicode, it expects the string to be well-formed UTF-8 and not a null-terminated string of arbitrary bytes. Bytes that are not valid UTF-8 are treated as Unicode character U+FFFD (REPLACEMENT CHARACTER), which is to say two strings of random bits may turn out to match if they convert to the same amount of replacement characters.
Note that while this function is intended to be used with UTF-8, maxlen
specifies a byte limit! If the limit lands in the middle of a multi-byte UTF-8 sequence, it may convert a portion of the final character to one or more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not to overflow a buffer.
maxlen
specifies a maximum number of bytes to compare; if the strings match to this number of bytes (or both have matched to a null-terminator character before this number of bytes), they will be considered equal.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
maxlen | The maximum number of bytes to compare. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Compare two UTF-8 strings up to a number of bytes.
Due to the nature of UTF-8 encoding, this will work with Unicode strings, since effectively this function just compares bytes until it hits a null-terminating character. Also due to the nature of UTF-8, this can be used with SDL_qsort() to put strings in (roughly) alphabetical order.
Note that while this function is intended to be used with UTF-8, it is doing a bytewise comparison, and maxlen
specifies a byte limit! If the limit lands in the middle of a multi-byte UTF-8 sequence, it will only compare a portion of the final character.
maxlen
specifies a maximum number of bytes to compare; if the strings match to this number of bytes (or both have matched to a null-terminator character before this number of bytes), they will be considered equal.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
maxlen | The maximum number of bytes to compare. |
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Convert a string to uppercase.
WARNING: Regardless of system locale, this will only convert ASCII values 'A' through 'Z' to uppercase.
This function operates on a null-terminated string of bytes–even if it is malformed UTF-8!–and converts ASCII characters 'a' through 'z' to their uppercase equivalents in-place, returning the original str
pointer.
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
Compute the tangent of x
.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
This function operates on double-precision floating point values, use SDL_tanf for single-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value, in radians |
x
|
extern |
Compute the tangent of x
.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
This function operates on single-precision floating point values, use SDL_tanf for double-precision floats.
This function may use a different approximation across different versions, platforms and configurations. i.e, it can return a different value given the same input on different machines or operating systems, or if SDL is updated.
x | floating point value, in radians |
x
|
extern |
Convert low-ASCII English letters to lowercase.
WARNING: Regardless of system locale, this will only convert ASCII values 'A' through 'Z' to lowercase.
This function returns the lowercase equivalent of x
. If a character cannot be converted, or is already lowercase, this function returns x
.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Convert low-ASCII English letters to uppercase.
WARNING: Regardless of system locale, this will only convert ASCII values 'a' through 'z' to uppercase.
This function returns the uppercase equivalent of x
. If a character cannot be converted, or is already uppercase, this function returns x
.
x | character value to check. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Truncate x
to an integer.
Rounds x
to the next closest integer to 0. This is equivalent to removing the fractional part of x
, leaving only the integer part.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on double-precision floating point values, use SDL_truncf for single-precision floats.
x | floating point value |
x
truncated to an integer
|
extern |
Truncate x
to an integer.
Rounds x
to the next closest integer to 0. This is equivalent to removing the fractional part of x
, leaving only the integer part.
Domain: -INF <= x <= INF
Range: -INF <= y <= INF
, y integer
This function operates on single-precision floating point values, use SDL_truncf for double-precision floats.
x | floating point value |
x
truncated to an integer
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Compare two null-terminated wide strings, case-insensitively.
This will work with Unicode strings, using a technique called "case-folding" to handle the vast majority of case-sensitive human languages regardless of system locale. It can deal with expanding values: a German Eszett character can compare against two ASCII 's' chars and be considered a match, for example. A notable exception: it does not handle the Turkish 'i' character; human language is complicated!
Depending on your platform, "wchar_t" might be 2 bytes, and expected to be UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this handles Unicode, it expects the string to be well-formed and not a null-terminated string of arbitrary bytes. Characters that are not valid UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT CHARACTER), which is to say two strings of random bits may turn out to match if they convert to the same amount of replacement characters.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
\threadsafety It is safe to call this function from any thread.
|
extern |
Compare two null-terminated wide strings.
This only compares wchar_t values until it hits a null-terminating character; it does not care if the string is well-formed UTF-16 (or UTF-32, depending on your platform's wchar_t size), or uses valid Unicode values.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Compare two wide strings, case-insensitively, up to a number of wchar_t.
This will work with Unicode strings, using a technique called "case-folding" to handle the vast majority of case-sensitive human languages regardless of system locale. It can deal with expanding values: a German Eszett character can compare against two ASCII 's' chars and be considered a match, for example. A notable exception: it does not handle the Turkish 'i' character; human language is complicated!
Depending on your platform, "wchar_t" might be 2 bytes, and expected to be UTF-16 encoded (like Windows), or 4 bytes in UTF-32 format. Since this handles Unicode, it expects the string to be well-formed and not a null-terminated string of arbitrary bytes. Characters that are not valid UTF-16 (or UTF-32) are treated as Unicode character U+FFFD (REPLACEMENT CHARACTER), which is to say two strings of random bits may turn out to match if they convert to the same amount of replacement characters.
Note that while this function might deal with variable-sized characters, maxlen
specifies a wchar limit! If the limit lands in the middle of a multi-byte UTF-16 sequence, it may convert a portion of the final character to one or more Unicode character U+FFFD (REPLACEMENT CHARACTER) so as not to overflow a buffer.
maxlen
specifies a maximum number of wchar_t values to compare; if the strings match to this number of wchar_t (or both have matched to a null-terminator character before this number of bytes), they will be considered equal.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
maxlen | The maximum number of wchar_t values to compare. |
\threadsafety It is safe to call this function from any thread.
|
extern |
Compare two wide strings up to a number of wchar_t values.
This only compares wchar_t values; it does not care if the string is well-formed UTF-16 (or UTF-32, depending on your platform's wchar_t size), or uses valid Unicode values.
Note that while this function is intended to be used with UTF-16 (or UTF-32, depending on your platform's definition of wchar_t), it is comparing raw wchar_t values and not Unicode codepoints: maxlen
specifies a wchar_t limit! If the limit lands in the middle of a multi-wchar UTF-16 sequence, it will only compare a portion of the final character.
maxlen
specifies a maximum number of wchar_t to compare; if the strings match to this number of wide chars (or both have matched to a null-terminator character before this count), they will be considered equal.
str1 | The first string to compare. NULL is not permitted! |
str2 | The second string to compare. NULL is not permitted! |
maxlen | The maximum number of wchar_t to compare. |
\threadsafety It is safe to call this function from any thread.
|
extern |
|
extern |
|
extern |
|
extern |
size_t size |
Definition at line 469 of file SDL_stdinc.h.