' This is file SDL2.bi.
'
' FreeBasic-Header file for libSDL2 (version 2.0.1),
' translated with help of h_2_bi.bas
'
' Licence:
' (C) 2013 Thomas{dOt]Freiherr{ aT }gmx[ DoT }net
'
' This library binding is free software; you can redistribute it
' and/or modify it under the terms of the GNU Lesser General Public
' License as published by the Free Software Foundation; either
' version 2 of the License, or (at your option) ANY later version.
'
' This library binding is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
' Lesser General Public License for more details, refer to:
' http://www.gnu.org/licenses/lgpl.html
'
' Original licence text
' /*
'   Simple DirectMedia Layer
'   Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
'
'   This software is provided 'as-is', without any express or implied
'   warranty.  In no event will the authors be held liable for any damages
'   arising from the use of this software.
'
'   Permission is granted to anyone to use this software for any purpose,
'   including commercial applications, and to alter it and redistribute it
'   freely, subject to the following restrictions:
'
'   1. The origin of this software must not be misrepresented; you must not
'      claim that you wrote the original software. If you use this software
'      in a product, an acknowledgment in the product documentation would be
'      appreciated but is not required.
'   2. Altered source versions must be plainly marked as such, and must not be
'      misrepresented as being the original software.
'   3. This notice may not be removed or altered from any source distribution.
' */

#IFDEF __FB_WIN32__
#PRAGMA push(msbitfields)
#ENDIF

#INCLIB "SDL2" ' place the name of your lib into quotes

EXTERN "C" ' (h_2_bi -P_oCD option)

' 001 start from: SDL2-2.0.1.h2bi ==> SDL2-2.0.1/include/SDL.h

#IFNDEF _SDL_H
#DEFINE _SDL_H

' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_main.h

#IFNDEF _SDL_main_h
#DEFINE _SDL_main_h

' 003 start from: SDL2-2.0.1/include/SDL_main.h ==> SDL2-2.0.1/include/SDL_stdinc.h

#IFNDEF _SDL_stdinc_h
#DEFINE _SDL_stdinc_h

' 004 start from: SDL2-2.0.1/include/SDL_stdinc.h ==> SDL2-2.0.1/include/SDL_config.h

#IFNDEF _SDL_config_h
#DEFINE _SDL_config_h

' 005 start from: SDL2-2.0.1/include/SDL_config.h ==> SDL2-2.0.1/include/SDL_platform.h

#IFNDEF _SDL_platform_h
#DEFINE _SDL_platform_h

#IF DEFINED(_AIX)
#UNDEF __AIX__
#DEFINE __AIX__ 1
#ENDIF ' DEFINED(_AIX)

#IF DEFINED(__BEOS__)
#UNDEF __BEOS__
#DEFINE __BEOS__ 1
#ENDIF ' DEFINED(__BEOS_...

#IF DEFINED(__HAIKU__)
#UNDEF __HAIKU__
#DEFINE __HAIKU__ 1
#ENDIF ' DEFINED(__HAIKU...

#IF DEFINED(bsdi) OR DEFINED(__bsdi) OR DEFINED(__bsdi__)
#UNDEF __BSDI__
#DEFINE __BSDI__ 1
#ENDIF ' DEFINED(bsdi)  ...

#IF DEFINED(_arch_dreamcast)
#UNDEF __DREAMCAST__
#DEFINE __DREAMCAST__ 1
#ENDIF ' DEFINED(_arch_d...

#IF DEFINED(__FreeBSD__) OR DEFINED(__FreeBSD_kernel__) OR DEFINED(__DragonFly__)
#UNDEF __FREEBSD__
#DEFINE __FREEBSD__ 1
#ENDIF ' DEFINED(__FreeB...

#IF DEFINED(hpux) OR DEFINED(__hpux) OR DEFINED(__hpux__)
#UNDEF __HPUX__
#DEFINE __HPUX__ 1
#ENDIF ' DEFINED(hpux)  ...

#IF DEFINED(sgi) OR DEFINED(__sgi) OR DEFINED(__sgi__) OR DEFINED(_SGI_SOURCE)
#UNDEF __IRIX__
#DEFINE __IRIX__ 1
#ENDIF ' DEFINED(sgi)  O...

#IF DEFINED(linux) OR DEFINED(__linux) OR DEFINED(__linux__)
#UNDEF __LINUX__
#DEFINE __LINUX__ 1
#ENDIF ' DEFINED(linux) ...

#IF DEFINED(ANDROID)
#UNDEF __ANDROID__
#UNDEF __LINUX__
#DEFINE __ANDROID__ 1
#ENDIF ' DEFINED(ANDROID...

#IF DEFINED(__APPLE__)
'#INCLUDE ONCE "AvailabilityMacros.bi"
'#INCLUDE ONCE "TargetConditionals.bi"
#IF TARGET_OS_IPHONE
#UNDEF __IPHONEOS__
#DEFINE __IPHONEOS__ 1
#UNDEF __MACOSX__
#ELSE ' TARGET_OS_IPHON...
#UNDEF __MACOSX__
#DEFINE __MACOSX__ 1

#IF MAC_OS_X_VERSION_MIN_REQUIRED < 1050
#ERROR SDL for Mac OS X only supports deploying on 10.5 and above.
#ENDIF ' MAC_OS_X_VERSIO...

#IF MAC_OS_X_VERSION_MAX_ALLOWED < 1060
#ERROR SDL for Mac OS X must be built with a 10.6 SDK or above.
#ENDIF ' MAC_OS_X_VERSIO...
#ENDIF ' TARGET_OS_IPHON...
#ENDIF ' DEFINED(__APPLE...

#IF DEFINED(__NetBSD__)
#UNDEF __NETBSD__
#DEFINE __NETBSD__ 1
#ENDIF ' DEFINED(__NetBS...

#IF DEFINED(__OpenBSD__)
#UNDEF __OPENBSD__
#DEFINE __OPENBSD__ 1
#ENDIF ' DEFINED(__OpenB...

#IF DEFINED(__OS2__)
#UNDEF __OS2__
#DEFINE __OS2__ 1
#ENDIF ' DEFINED(__OS2__...

#IF DEFINED(osf) OR DEFINED(__osf) OR DEFINED(__osf__) OR DEFINED(_OSF_SOURCE)
#UNDEF __OSF__
#DEFINE __OSF__ 1
#ENDIF ' DEFINED(osf)  O...

#IF DEFINED(__QNXNTO__)
#UNDEF __QNXNTO__
#DEFINE __QNXNTO__ 1
#ENDIF ' DEFINED(__QNXNT...

#IF DEFINED(riscos) OR DEFINED(__riscos) OR DEFINED(__riscos__)
#UNDEF __RISCOS__
#DEFINE __RISCOS__ 1
#ENDIF ' DEFINED(riscos)...

#IF DEFINED(__SVR4)
#UNDEF __SOLARIS__
#DEFINE __SOLARIS__ 1
#ENDIF ' DEFINED(__SVR4)

#IF DEFINED(WIN32) OR DEFINED(_WIN32) OR DEFINED(__CYGWIN__)
#UNDEF __WINDOWS__
#DEFINE __WINDOWS__ 1
#ENDIF ' DEFINED(WIN32) ...

#IF DEFINED(__WINDOWS__)
#UNDEF __WIN32__
#DEFINE __WIN32__ 1
#ENDIF ' DEFINED(__WINDO...

#IF DEFINED(__PSP__)
#UNDEF __PSP__
#DEFINE __PSP__ 1
#ENDIF ' DEFINED(__PSP__...

' 006 start from: SDL2-2.0.1/include/SDL_platform.h ==> SDL2-2.0.1/include/begin_code.h

'#DEFINE _begin_code_h

#IFNDEF SDLCALL
#DEFINE SDLCALL CDECL
#ENDIF ' SDLCALL

#IFNDEF NULL
#DEFINE NULL (CAST(ANY PTR, 0))
#ENDIF ' NULL

' 006 back from SDL2-2.0.1/include/begin_code.h ==> SDL2-2.0.1/include/SDL_platform.h

#ENDIF ' _SDL_platform_h

' 005 back from SDL2-2.0.1/include/SDL_platform.h ==> SDL2-2.0.1/include/SDL_config.h

'#IFDEF _MSC_VER
'#ERROR You should run hg revert SDL_config.h
'#ENDIF ' _MSC_VER

#IFDEF __FB_64BIT__
#DEFINE SIZEOF_VOIDP 8
#ELSE ' __LP64__
#DEFINE SIZEOF_VOIDP 4
#ENDIF ' __FB_64BIT__

#DEFINE HAVE_GCC_ATOMICS 1
#DEFINE HAVE_PTHREAD_SPINLOCK 1
#DEFINE HAVE_LIBC 1

#IF HAVE_LIBC
#DEFINE HAVE_ALLOCA_H 1
#DEFINE HAVE_SYS_TYPES_H 1
#DEFINE HAVE_STDIO_H 1
#DEFINE STDC_HEADERS 1
#DEFINE HAVE_STDLIB_H 1
#DEFINE HAVE_STDARG_H 1
#DEFINE HAVE_MALLOC_H 1
#DEFINE HAVE_MEMORY_H 1
#DEFINE HAVE_STRING_H 1
#DEFINE HAVE_STRINGS_H 1
#DEFINE HAVE_INTTYPES_H 1
#DEFINE HAVE_STDINT_H 1
#DEFINE HAVE_CTYPE_H 1
#DEFINE HAVE_MATH_H 1
#DEFINE HAVE_ICONV_H 1
#DEFINE HAVE_SIGNAL_H 1
#DEFINE HAVE_DBUS_DBUS_H 1
#DEFINE HAVE_MALLOC 1
#DEFINE HAVE_CALLOC 1
#DEFINE HAVE_REALLOC 1
#DEFINE HAVE_FREE 1
#DEFINE HAVE_ALLOCA 1

#IFNDEF __FB_WIN32__
#DEFINE HAVE_GETENV 1
#DEFINE HAVE_SETENV 1
#DEFINE HAVE_PUTENV 1
#DEFINE HAVE_UNSETENV 1
#ENDIF ' __WIN32__

#DEFINE HAVE_QSORT 1
#DEFINE HAVE_ABS 1
#DEFINE HAVE_BCOPY 1
#DEFINE HAVE_MEMSET 1
#DEFINE HAVE_MEMCPY 1
#DEFINE HAVE_MEMMOVE 1
#DEFINE HAVE_MEMCMP 1
#DEFINE HAVE_STRLEN 1
#DEFINE HAVE_STRDUP 1
#DEFINE HAVE_STRCHR 1
#DEFINE HAVE_STRRCHR 1
#DEFINE HAVE_STRSTR 1
#DEFINE HAVE_STRTOL 1
#DEFINE HAVE_STRTOUL 1
#DEFINE HAVE_STRTOLL 1
#DEFINE HAVE_STRTOULL 1
#DEFINE HAVE_STRTOD 1
#DEFINE HAVE_ATOI 1
#DEFINE HAVE_ATOF 1
#DEFINE HAVE_STRCMP 1
#DEFINE HAVE_STRNCMP 1
#DEFINE HAVE_STRCASECMP 1
#DEFINE HAVE_STRNCASECMP 1
#DEFINE HAVE_SSCANF 1
#DEFINE HAVE_SNPRINTF 1
#DEFINE HAVE_VSNPRINTF 1
#DEFINE HAVE_M_PI
#DEFINE HAVE_ATAN 1
#DEFINE HAVE_ATAN2 1
#DEFINE HAVE_CEIL 1
#DEFINE HAVE_COPYSIGN 1
#DEFINE HAVE_COS 1
#DEFINE HAVE_COSF 1
#DEFINE HAVE_FABS 1
#DEFINE HAVE_FLOOR 1
#DEFINE HAVE_LOG 1
#DEFINE HAVE_POW 1
#DEFINE HAVE_SCALBN 1
#DEFINE HAVE_SIN 1
#DEFINE HAVE_SINF 1
#DEFINE HAVE_SQRT 1
#DEFINE HAVE_FSEEKO 1
#DEFINE HAVE_FSEEKO64 1
#DEFINE HAVE_SIGACTION 1
#DEFINE HAVE_SA_SIGACTION 1
#DEFINE HAVE_SETJMP 1
#DEFINE HAVE_NANOSLEEP 1
#DEFINE HAVE_SYSCONF 1
#DEFINE HAVE_CLOCK_GETTIME 1
#DEFINE HAVE_MPROTECT 1
#DEFINE HAVE_ICONV 1
#DEFINE HAVE_PTHREAD_SETNAME_NP 1
#DEFINE HAVE_SEM_TIMEDWAIT 1
#ELSE ' HAVE_LIBC
#DEFINE HAVE_STDARG_H 1
#DEFINE HAVE_STDDEF_H 1
#DEFINE HAVE_STDINT_H 1
#ENDIF ' HAVE_LIBC

#IFDEF __FB_UNIX__
#DEFINE SDL_AUDIO_DRIVER_ALSA 1
#DEFINE SDL_AUDIO_DRIVER_ALSA_DYNAMIC @!"libasound.so.2"
#DEFINE SDL_AUDIO_DRIVER_PULSEAUDIO 1
#DEFINE SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @!"libpulse-simple.so.0"
#DEFINE SDL_AUDIO_DRIVER_DISK 1
#DEFINE SDL_AUDIO_DRIVER_DUMMY 1
#DEFINE SDL_AUDIO_DRIVER_OSS 1
#DEFINE SDL_INPUT_LINUXEV 1
#DEFINE SDL_INPUT_LINUXKD 1
#DEFINE SDL_JOYSTICK_LINUX 1
#DEFINE SDL_HAPTIC_LINUX 1
#DEFINE SDL_LOADSO_DLOPEN 1
#DEFINE SDL_THREAD_PTHREAD 1
#DEFINE SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
#DEFINE SDL_TIMER_UNIX 1
#DEFINE SDL_VIDEO_DRIVER_DUMMY 1
#DEFINE SDL_VIDEO_DRIVER_X11 1
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC @!"libX11.so.6"
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @!"libXext.so.6"
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @!"libXcursor.so.1"
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @!"libXinerama.so.1"
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @!"libXi.so.6"
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @!"libXrandr.so.2"
#DEFINE SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @!"libXss.so.1"
#DEFINE SDL_VIDEO_DRIVER_X11_XCURSOR 1
#DEFINE SDL_VIDEO_DRIVER_X11_XINERAMA 1
#DEFINE SDL_VIDEO_DRIVER_X11_XINPUT2 1
#DEFINE SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1
#DEFINE SDL_VIDEO_DRIVER_X11_XRANDR 1
#DEFINE SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
#DEFINE SDL_VIDEO_DRIVER_X11_XSHAPE 1
#DEFINE SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
#DEFINE SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1
#DEFINE SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
#DEFINE SDL_VIDEO_RENDER_OGL 1
#DEFINE SDL_VIDEO_OPENGL 1
#DEFINE SDL_VIDEO_OPENGL_GLX 1
#DEFINE SDL_POWER_LINUX 1
#DEFINE SDL_FILESYSTEM_UNIX 1
#DEFINE SDL_ASSEMBLY_ROUTINES 1
#ELSE ' __FB_UNIX__
#DEFINE SDL_AUDIO_DRIVER_DSOUND 1
#DEFINE SDL_AUDIO_DRIVER_XAUDIO2 1
#DEFINE SDL_AUDIO_DRIVER_WINMM 1
#DEFINE SDL_AUDIO_DRIVER_DISK 1
#DEFINE SDL_AUDIO_DRIVER_DUMMY 1
#DEFINE SDL_JOYSTICK_DINPUT 1
#DEFINE SDL_HAPTIC_DINPUT 1
#DEFINE SDL_LOADSO_WINDOWS 1
#DEFINE SDL_THREAD_WINDOWS 1
#DEFINE SDL_TIMER_WINDOWS 1
#DEFINE SDL_VIDEO_DRIVER_DUMMY 1
#DEFINE SDL_VIDEO_DRIVER_WINDOWS 1

#IFNDEF SDL_VIDEO_RENDER_D3D
#DEFINE SDL_VIDEO_RENDER_D3D 1
#ENDIF

#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

#DEFINE SDL_POWER_WINDOWS 1
#DEFINE SDL_FILESYSTEM_WINDOWS 1

#IFNDEF __FB_64BIT__
#DEFINE SDL_ASSEMBLY_ROUTINES 1
#ENDIF
#ENDIF ' __FB_UNIX__
#ENDIF ' _SDL_config_h

' 004 back from SDL2-2.0.1/include/SDL_config.h ==> SDL2-2.0.1/include/SDL_stdinc.h

#IFDEF HAVE_SYS_TYPES_H
#INCLUDE ONCE "crt/sys/types.bi" '__HEADERS__: sys/types.h
#ENDIF ' HAVE_SYS_TYPES_H

#IFDEF HAVE_STDIO_H
#INCLUDE ONCE "crt/stdio.bi" '__HEADERS__: stdio.h
#ENDIF ' HAVE_STDIO_H

#IF DEFINED(STDC_HEADERS)
#INCLUDE ONCE "crt/stdlib.bi" '__HEADERS__: stdlib.h
#INCLUDE ONCE "crt/stddef.bi" '__HEADERS__: stddef.h
#INCLUDE ONCE "crt/stdarg.bi" '__HEADERS__: stdarg.h
#ELSE ' DEFINED(STDC_HE...
#IF DEFINED(HAVE_STDLIB_H)
#INCLUDE ONCE "crt/stdlib.bi" '__HEADERS__: stdlib.h
#ELSEIF DEFINED(HAVE_MALLOC_H)
#INCLUDE ONCE "crt/malloc.bi" '__HEADERS__: malloc.h
#ENDIF ' DEFINED(HAVE_ST...

#IF DEFINED(HAVE_STDDEF_H)
#INCLUDE ONCE "crt/stddef.bi" '__HEADERS__: stddef.h
#ENDIF ' DEFINED(HAVE_ST...

#IF DEFINED(HAVE_STDARG_H)
#INCLUDE ONCE "crt/stdarg.bi" '__HEADERS__: stdarg.h
#ENDIF ' DEFINED(HAVE_ST...
#ENDIF ' DEFINED(STDC_HE...

#IFDEF HAVE_STRING_H
#IF  NOT DEFINED(STDC_HEADERS)  AND DEFINED(HAVE_MEMORY_H)

' file not found: memory.h

#ENDIF ' NOT DEFINED(STD...
#INCLUDE ONCE "crt/string.bi" '__HEADERS__: string.h
#ENDIF ' HAVE_STRING_H

#IFDEF HAVE_STRINGS_H

' file not found: strings.h

#ENDIF ' HAVE_STRINGS_H

#IF DEFINED(HAVE_INTTYPES_H)

' file not found: inttypes.h

#ELSEIF DEFINED(HAVE_STDINT_H)
#INCLUDE ONCE "crt/stdint.bi" '__HEADERS__: stdint.h
#ENDIF ' DEFINED(HAVE_IN...

#IFDEF HAVE_CTYPE_H
#INCLUDE ONCE "crt/ctype.bi" '__HEADERS__: ctype.h
#ENDIF ' HAVE_CTYPE_H

#IFDEF HAVE_MATH_H
#INCLUDE ONCE "crt/math.bi" '__HEADERS__: math.h
#ENDIF ' HAVE_MATH_H

#IF DEFINED(HAVE_ICONV) AND DEFINED(HAVE_ICONV_H)
#INCLUDE ONCE "iconv.bi" '__HEADERS__: iconv.h
#ENDIF ' DEFINED(HAVE_IC...

'#DEFINE SDL_arraysize(array) (SIZEOF(array)/SIZEOF(array[0]))
#DEFINE SDL_arraysize(array) (UBOUND(array) + 1)
#DEFINE SDL_TABLESIZE(table) SDL_arraysize(table)

#DEFINE SDL_reinterpret_cast(type, expression) (CAST(type, (expression)))
#DEFINE SDL_static_cast(type, expression) (CAST(type, (expression)))
#DEFINE SDL_const_cast(type, expression) (CAST(type, (expression)))

#DEFINE SDL_FOURCC(A, B, C, D) _
    ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A)))) OR _
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) SHL 8) OR _
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) SHL 16) OR _
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) SHL 24))

ENUM SDL_bool
	SDL_FALSE = 0
	SDL_TRUE = 1
END ENUM

TYPE Sint8 AS BYTE
TYPE Uint8 AS UBYTE
TYPE Sint16 AS SHORT
TYPE Uint16 AS USHORT
TYPE Sint32 AS INTEGER
TYPE Uint32 AS UINTEGER
TYPE Sint64 AS LONGINT
TYPE Uint64 AS ULONGINT

#DEFINE SDL_COMPILE_TIME_ASSERT(name, x) _
       DIM AS INTEGER SDL_dummy_##name(-(SIZEOF(name) = x) - 1)

#IFNDEF DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(Uint8, 1)
SDL_COMPILE_TIME_ASSERT(Sint8, 1)
SDL_COMPILE_TIME_ASSERT(Uint16, 2)
SDL_COMPILE_TIME_ASSERT(Sint16, 2)
SDL_COMPILE_TIME_ASSERT(Uint32, 4)
SDL_COMPILE_TIME_ASSERT(Sint32, 4)
SDL_COMPILE_TIME_ASSERT(Uint64, 8)
SDL_COMPILE_TIME_ASSERT(Sint64, 8)
#ENDIF ' DOXYGEN_SHOULD_IGNORE_THIS

#IFNDEF DOXYGEN_SHOULD_IGNORE_THIS
#IF NOT DEFINED(__ANDROID__)

ENUM SDL_DUMMY_ENUM
	DUMMY_ENUM_VALUE
END ENUM
DIM AS INTEGER SDL_DUMMY_ENUM_(-(SIZEOF(SDL_DUMMY_ENUM) = SIZEOF(INTEGER)) - 1)

#ENDIF ' NOT DEFINED(__A...
#ENDIF ' DOXYGEN_SHOULD_IGNORE_THIS

#IF DEFINED(HAVE_ALLOCA) AND NOT DEFINED(alloca)
#IF DEFINED(HAVE_ALLOCA_H)

' file not found: alloca.h

#ELSEIF DEFINED(__GNUC__)
#DEFINE alloca __builtin_alloca
#ELSEIF DEFINED(_MSC_VER)
#INCLUDE ONCE "crt/malloc.bi" '__HEADERS__: malloc.h
#DEFINE alloca _alloca
#ELSEIF DEFINED(__WATCOMC__)
#INCLUDE ONCE "crt/malloc.bi" '__HEADERS__: malloc.h
#ELSEIF DEFINED(__BORLANDC__)
#INCLUDE ONCE "crt/malloc.bi" '__HEADERS__: malloc.h
#ELSEIF DEFINED(__DMC__)
#INCLUDE ONCE "crt/stdlib.bi" '__HEADERS__: malloc.h
#ELSEIF DEFINED(__AIX__)
' #pragma alloca
#ELSEIF DEFINED(__MRC__)

DECLARE FUNCTION alloca(BYVAL AS UINTEGER) AS ANY PTR

#ELSE ' DEFINED(HAVE_AL...

DECLARE FUNCTION alloca() AS ZSTRING PTR

#ENDIF ' DEFINED(HAVE_AL...
#ENDIF ' DEFINED(HAVE_AL...

#IFDEF HAVE_ALLOCA
#DEFINE SDL_stack_alloc(type, count) CAST(type PTR, alloca(SIZEOF(type)*(count)))
#DEFINE SDL_stack_free(data)
#ELSE ' HAVE_ALLOCA
#DEFINE SDL_stack_alloc(type, count) CAST(type PTR, SDL_malloc(SIZEOF(type)*(count)))
#DEFINE SDL_stack_free(data) SDL_free(data)
#ENDIF ' HAVE_ALLOCA

DECLARE FUNCTION SDL_malloc(BYVAL AS size_t) AS ANY PTR
DECLARE FUNCTION SDL_calloc(BYVAL AS size_t, BYVAL AS size_t) AS ANY PTR
DECLARE FUNCTION SDL_realloc(BYVAL AS ANY PTR, BYVAL AS size_t) AS ANY PTR
DECLARE SUB SDL_free(BYVAL AS ANY PTR)
DECLARE FUNCTION SDL_getenv(BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_setenv(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_qsort(BYVAL AS ANY PTR, BYVAL AS size_t, BYVAL AS size_t, BYVAL AS FUNCTION(BYVAL AS CONST ANY PTR, BYVAL AS CONST ANY PTR) AS INTEGER)
DECLARE FUNCTION SDL_abs(BYVAL AS INTEGER) AS INTEGER

#DEFINE SDL_min(x, y) IIF((x) < (y), (x) , (y))
#DEFINE SDL_max(x, y) IIF((x) > (y), (x) , (y))

DECLARE FUNCTION SDL_isdigit(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_isspace(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_toupper(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_tolower(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_memset(BYVAL AS ANY PTR, BYVAL AS INTEGER, BYVAL AS size_t) AS ANY PTR

#DEFINE SDL_zero(x) SDL_memset(@(x), 0, SIZEOF((x)))
#DEFINE SDL_zerop(x) SDL_memset((x), 0, SIZEOF(*(x)))

DECLARE FUNCTION SDL_memcpy(BYVAL AS ANY PTR, BYVAL AS CONST ANY PTR, BYVAL AS size_t) AS ANY PTR
DECLARE FUNCTION SDL_memmove(BYVAL AS ANY PTR, BYVAL AS CONST ANY PTR, BYVAL AS size_t) AS ANY PTR
DECLARE FUNCTION SDL_memcmp(BYVAL AS CONST ANY PTR, BYVAL AS CONST ANY PTR, BYVAL AS size_t) AS INTEGER
DECLARE FUNCTION SDL_wcslen(BYVAL AS CONST wchar_t PTR) AS size_t
DECLARE FUNCTION SDL_wcslcpy(BYVAL AS wchar_t PTR, BYVAL AS CONST wchar_t PTR, BYVAL AS size_t) AS size_t
DECLARE FUNCTION SDL_wcslcat(BYVAL AS wchar_t PTR, BYVAL AS CONST wchar_t PTR, BYVAL AS size_t) AS size_t
DECLARE FUNCTION SDL_strlen(BYVAL AS CONST ZSTRING PTR) AS size_t
DECLARE FUNCTION SDL_strlcpy(BYVAL AS ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS size_t) AS size_t
DECLARE FUNCTION SDL_utf8strlcpy(BYVAL AS ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS size_t) AS size_t
DECLARE FUNCTION SDL_strlcat(BYVAL AS ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS size_t) AS size_t
DECLARE FUNCTION SDL_strdup(BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_strrev(BYVAL AS ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_strupr(BYVAL AS ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_strlwr(BYVAL AS ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_strchr(BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_strrchr(BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_strstr(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_itoa(BYVAL AS INTEGER, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_uitoa(BYVAL AS UINTEGER, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_ltoa(BYVAL AS INTEGER, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_ultoa(BYVAL AS UINTEGER, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_lltoa(BYVAL AS Sint64, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_ulltoa(BYVAL AS Uint64, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER) AS ZSTRING PTR
DECLARE FUNCTION SDL_atoi(BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE FUNCTION SDL_atof(BYVAL AS CONST ZSTRING PTR) AS DOUBLE
DECLARE FUNCTION SDL_strtol(BYVAL AS CONST ZSTRING PTR, BYVAL AS ZSTRING PTR PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_strtoul(BYVAL AS CONST ZSTRING PTR, BYVAL AS ZSTRING PTR PTR, BYVAL AS INTEGER) AS UINTEGER
DECLARE FUNCTION SDL_strtoll(BYVAL AS CONST ZSTRING PTR, BYVAL AS ZSTRING PTR PTR, BYVAL AS INTEGER) AS Sint64
DECLARE FUNCTION SDL_strtoull(BYVAL AS CONST ZSTRING PTR, BYVAL AS ZSTRING PTR PTR, BYVAL AS INTEGER) AS Uint64
DECLARE FUNCTION SDL_strtod(BYVAL AS CONST ZSTRING PTR, BYVAL AS ZSTRING PTR PTR) AS DOUBLE
DECLARE FUNCTION SDL_strcmp(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE FUNCTION SDL_strncmp(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS size_t) AS INTEGER
DECLARE FUNCTION SDL_strcasecmp(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE FUNCTION SDL_strncasecmp(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS size_t) AS INTEGER
DECLARE FUNCTION SDL_sscanf(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, ...) AS INTEGER
DECLARE FUNCTION SDL_snprintf(BYVAL AS ZSTRING PTR, BYVAL AS size_t, BYVAL AS CONST ZSTRING PTR, ...) AS INTEGER
DECLARE FUNCTION SDL_vsnprintf(BYVAL AS ZSTRING PTR, BYVAL AS size_t, BYVAL AS CONST ZSTRING PTR, BYVAL AS va_list) AS INTEGER

#IFNDEF HAVE_M_PI
#IFNDEF M_PI
#DEFINE M_PI 3.14159265358979323846264338327950288
#ENDIF ' M_PI
#ENDIF ' HAVE_M_PI

DECLARE FUNCTION SDL_atan(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_atan2(BYVAL AS DOUBLE, BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_ceil(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_copysign(BYVAL AS DOUBLE, BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_cos(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_cosf(BYVAL AS SINGLE) AS SINGLE
DECLARE FUNCTION SDL_fabs(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_floor(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_log_ ALIAS "SDL_log"(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_pow(BYVAL AS DOUBLE, BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_scalbn(BYVAL AS DOUBLE, BYVAL AS INTEGER) AS DOUBLE
DECLARE FUNCTION SDL_sin(BYVAL AS DOUBLE) AS DOUBLE
DECLARE FUNCTION SDL_sinf(BYVAL AS SINGLE) AS SINGLE
DECLARE FUNCTION SDL_sqrt(BYVAL AS DOUBLE) AS DOUBLE

#DEFINE SDL_ICONV_ERROR CAST(size_t, -1)
#DEFINE SDL_ICONV_E2BIG CAST(size_t, -2)
#DEFINE SDL_ICONV_EILSEQ CAST(size_t, -3)
#DEFINE SDL_ICONV_EINVAL CAST(size_t, -4)

TYPE AS _SDL_iconv_t PTR SDL_iconv_t

DECLARE FUNCTION SDL_iconv_open(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS SDL_iconv_t
DECLARE FUNCTION SDL_iconv_close(BYVAL AS SDL_iconv_t) AS INTEGER
DECLARE FUNCTION SDL_iconv(BYVAL AS SDL_iconv_t, BYVAL AS CONST ZSTRING PTR PTR, BYVAL AS size_t PTR, BYVAL AS ZSTRING PTR PTR, BYVAL AS size_t PTR) AS size_t
DECLARE FUNCTION SDL_iconv_string(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS size_t) AS ZSTRING PTR

#DEFINE SDL_iconv_utf8_locale(S) SDL_iconv_string(@!"", @!"UTF-8", S, SDL_strlen(S) + 1)
#DEFINE SDL_iconv_utf8_ucs2(S) CAST(Uint16 PTR, SDL_iconv_string(@!"UCS-2-INTERNAL", @!"UTF-8", S, SDL_strlen(S) + 1))
#DEFINE SDL_iconv_utf8_ucs4(S) CAST(Uint32 PTR, SDL_iconv_string(@!"UCS-4-INTERNAL", @!"UTF-8", S, SDL_strlen(S) + 1))

#ENDIF ' _SDL_stdinc_h

' 003 back from SDL2-2.0.1/include/SDL_stdinc.h ==> SDL2-2.0.1/include/SDL_main.h

#IFNDEF SDL_MAIN_HANDLED
#IF DEFINED(__WIN32__)
#DEFINE SDL_MAIN_AVAILABLE
#ELSEIF DEFINED(__IPHONEOS__)
#DEFINE SDL_MAIN_NEEDED
#ELSEIF DEFINED(__ANDROID__)
#DEFINE SDL_MAIN_NEEDED
#ENDIF ' DEFINED(__WIN32...
#ENDIF ' SDL_MAIN_HANDLED

#IF DEFINED(SDL_MAIN_NEEDED)  OR DEFINED(SDL_MAIN_AVAILABLE)
#DEFINE main SDL_main
#ENDIF ' DEFINED(SDL_MAI...

DECLARE FUNCTION SDL_main(BYVAL AS INTEGER, BYVAL AS ZSTRING PTR PTR) AS INTEGER

#ENDIF ' _SDL_main_h

' 002 back from SDL2-2.0.1/include/SDL_main.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_assert.h

#IFNDEF _SDL_assert_h
#DEFINE _SDL_assert_h

'#IFNDEF SDL_ASSERT_LEVEL
'#IFDEF SDL_DEFAULT_ASSERT_LEVEL
'#DEFINE SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
'#ELSEIF DEFINED(_DEBUG) OR DEFINED(DEBUG) OR _
      '(DEFINED(__GNUC__) AND NOT DEFINED(__OPTIMIZE__))
'#DEFINE SDL_ASSERT_LEVEL 2
'#ELSE ' SDL_DEFAULT_ASSERT_LEVEL
'#DEFINE SDL_ASSERT_LEVEL 1
'#ENDIF ' SDL_DEFAULT_ASSERT_LEVEL
'#ENDIF ' SDL_ASSERT_LEVEL

'#IF DEFINED(_MSC_VER)

''DECLARE FUNCTION __debugbreak() AS ANY

'#DEFINE SDL_TriggerBreakpoint() __debugbreak()
'#ELSEIF (DEFINED(__GNUC__)  AND (DEFINED(__i386__)  OR DEFINED(__x86_64__)))
'#DEFINE SDL_TriggerBreakpoint() __asm__ __volatile__ ( @!"int $3\n\t" )
'#ELSEIF DEFINED(HAVE_SIGNAL_H)

'' file not found: signal.h

'#DEFINE SDL_TriggerBreakpoint() raise(SIGTRAP)
'#ELSE ' DEFINED(_MSC_VE...
'#DEFINE SDL_TriggerBreakpoint()
'#ENDIF ' DEFINED(_MSC_VE...

#DEFINE SDL_FUNCTION __FUNCTION__
#DEFINE SDL_FILE __FILE__
#DEFINE SDL_LINE __LINE__

'#IFDEF _MSC_VER
'#DEFINE SDL_NULL_WHILE_LOOP_CONDITION (-1 = __LINE__)
'#ELSE ' _MSC_VER
'#DEFINE SDL_NULL_WHILE_LOOP_CONDITION (0)
'#ENDIF ' _MSC_VER

' #define SDL_disabled_assert(condition) \
'     do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
' #DEFINE SDL_disabled_assert(condition) _
'     do { CAST(ANY, SIZEOF ((condition))); } while (SDL_NULL_WHILE_LOOP_CONDITION) '??? unsave DEFINE line(s)

ENUM SDL_assert_state
	SDL_ASSERTION_RETRY
	SDL_ASSERTION_BREAK
	SDL_ASSERTION_ABORT
	SDL_ASSERTION_IGNORE
	SDL_ASSERTION_ALWAYS_IGNORE
END ENUM

TYPE SDL_assert_data
	AS INTEGER always_ignore
	AS UINTEGER trigger_count
	AS CONST ZSTRING PTR condition
	AS CONST ZSTRING PTR filename
	AS INTEGER linenum
	AS CONST ZSTRING PTR function
	AS CONST SDL_assert_data PTR next
END TYPE

'#IF (SDL_ASSERT_LEVEL > 0)

'DECLARE FUNCTION SDL_ReportAssertion(BYVAL AS SDL_assert_data PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER) AS SDL_assert_state

' #define SDL_enabled_assert(condition) \
'     do { \
'         while ( !(condition) ) { \
'             static struct SDL_assert_data assert_data = { \
'                 0, 0, #condition, 0, 0, 0, 0 \
'             }; \
'             const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \
'                                                                SDL_FUNCTION, \
'                                                                SDL_FILE, \
'                                                                SDL_LINE); \
'             if (state == SDL_ASSERTION_RETRY) { \
'                 continue;  \
'             } else if (state == SDL_ASSERTION_BREAK) { \
'                 SDL_TriggerBreakpoint(); \
'             } \
'             break;  \
'         } \
'     } while (SDL_NULL_WHILE_LOOP_CONDITION)
' #DEFINE SDL_enabled_assert(condition) _
'     do { _
'         while (  0 = (condition) ) { _
'             static struct SDL_assert_data assert_data = { _
'                 0, 0, #condition, 0, 0, 0, 0 _
'             }; _
'             const SDL_assert_state state = SDL_ReportAssertion(@assert_data, _
'                                                                SDL_FUNCTION, _
'                                                                SDL_FILE, _
'                                                                SDL_LINE); _
'             if (state = SDL_ASSERTION_RETRY) { _
'                 continue; _
'             } else if (state = SDL_ASSERTION_BREAK) { _
'                 SDL_TriggerBreakpoint(); _
'             } _
'             break; _
'         } _
'     } while (SDL_NULL_WHILE_LOOP_CONDITION) '??? unsave DEFINE line(s)

'#ENDIF ' (SDL_ASSERT_LEV...

'#IF SDL_ASSERT_LEVEL = 0
'#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)
'#ELSEIF SDL_ASSERT_LEVEL = 1
'#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)
'#ELSEIF SDL_ASSERT_LEVEL = 2
'#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)
'#ELSEIF SDL_ASSERT_LEVEL = 3
'#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 ' SDL_ASSERT_LEVE...
'#ERROR Unknown assertion level.
'#ENDIF ' SDL_ASSERT_LEVE...

#DEFINE SDL_assert_always(condition) SDL_enabled_assert(condition)

TYPE SDL_AssertionHandler AS FUNCTION(BYVAL AS CONST SDL_assert_data PTR, BYVAL AS ANY PTR) AS SDL_assert_state

DECLARE SUB SDL_SetAssertionHandler(BYVAL AS SDL_AssertionHandler, BYVAL AS ANY PTR)
DECLARE FUNCTION SDL_GetAssertionReport() AS CONST SDL_assert_data PTR
DECLARE SUB SDL_ResetAssertionReport()

#ENDIF ' _SDL_assert_h

' 002 back from SDL2-2.0.1/include/SDL_assert.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_atomic.h

'#IFNDEF _SDL_atomic_h_
'#DEFINE _SDL_atomic_h_

'#IF DEFINED(_MSC_VER)
'#IF _MSC_VER >= 1500
'#INCLUDE ONCE "intrin.bi"
'#DEFINE HAVE_MSC_ATOMICS 1
'#ENDIF ' _MSC_VER >= 1500
'#ENDIF ' DEFINED(_MSC_VE...

'TYPE SDL_SpinLock AS INTEGER

'DECLARE FUNCTION SDL_AtomicTryLock(BYVAL AS SDL_SpinLock PTR) AS SDL_bool
'DECLARE SUB SDL_AtomicLock(BYVAL AS SDL_SpinLock PTR)
'DECLARE SUB SDL_AtomicUnlock(BYVAL AS SDL_SpinLock PTR)

''' #define SDL_CompilerBarrier()   \
''' { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
'#DEFINE SDL_CompilerBarrier() _
  'SCOPE : DIM AS SDL_SpinLock _tmp = 0 : SDL_AtomicLock(@_tmp) : SDL_AtomicUnlock(@_tmp) : END SCOPE

'#IF DEFINED(__GNUC__)  AND (DEFINED(__powerpc__)  OR DEFINED(__ppc__))
 '#DEFINE SDL_MemoryBarrierRelease() __asm__ __volatile__ (@!"lwsync" : : : @!"memory")
 '#DEFINE SDL_MemoryBarrierAcquire() __asm__ __volatile__ (@!"lwsync" : : : @!"memory")
'#ELSEIF DEFINED(__GNUC__)  AND DEFINED(__arm__)
 '#IF DEFINED(__ARM_ARCH_7__)  OR DEFINED(__ARM_ARCH_7A__)  OR DEFINED(__ARM_ARCH_7EM__)  OR DEFINED(__ARM_ARCH_7R__)  OR DEFINED(__ARM_ARCH_7M__)  OR DEFINED(__ARM_ARCH_7S__)
  '#DEFINE SDL_MemoryBarrierRelease() __asm__ __volatile__ (@!"dmb ish" : : : @!"memory")
  '#DEFINE SDL_MemoryBarrierAcquire() __asm__ __volatile__ (@!"dmb ish" : : : @!"memory")
 '#ELSEIF DEFINED(__ARM_ARCH_6__)  OR DEFINED(__ARM_ARCH_6J__)  OR DEFINED(__ARM_ARCH_6K__)  OR DEFINED(__ARM_ARCH_6T2__)  OR DEFINED(__ARM_ARCH_6Z__)  OR DEFINED(__ARM_ARCH_6ZK__)
  '#IFDEF __thumb__

   'DECLARE SUB SDL_MemoryBarrierRelease()
   'DECLARE SUB SDL_MemoryBarrierAcquire()

  '#ELSE ' __thumb__
   '#DEFINE SDL_MemoryBarrierRelease() __asm__ __volatile__ (@!"mcr p15, 0, %0, c7, c10, 5" : : @!"r"(0) : @!"memory")
   '#DEFINE SDL_MemoryBarrierAcquire() __asm__ __volatile__ (@!"mcr p15, 0, %0, c7, c10, 5" : : @!"r"(0) : @!"memory")
  '#ENDIF ' __thumb__
 '#ELSE ' DEFINED(__ARM_A...
  '#DEFINE SDL_MemoryBarrierRelease() __asm__ __volatile__ (@!"" : : : @!"memory")
  '#DEFINE SDL_MemoryBarrierAcquire() __asm__ __volatile__ (@!"" : : : @!"memory")
 '#ENDIF ' DEFINED(__ARM_A...
'#ELSE ' DEFINED(__GNUC_...
 '#DEFINE SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
 '#DEFINE SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
'#ENDIF ' DEFINED(__GNUC_...

'#IF DEFINED(SDL_ATOMIC_DISABLED) AND SDL_ATOMIC_DISABLED
#DEFINE SDL_DISABLE_ATOMIC_INLINE
'#ENDIF ' DEFINED(SDL_ATO...

'#IFNDEF SDL_DISABLE_ATOMIC_INLINE
 '#IFDEF HAVE_MSC_ATOMICS
  '#DEFINE SDL_AtomicSet(a, v) _InterlockedExchange((long*)@(a)->value, (v))
  '#DEFINE SDL_AtomicAdd(a, v) _InterlockedExchangeAdd((long*)@(a)->value, (v))
  '#DEFINE SDL_AtomicCAS(a, oldval, newval) (_InterlockedCompareExchange((long*)@(a)->value, (newval), (oldval)) = (oldval))
  '#DEFINE SDL_AtomicSetPtr(a, v) _InterlockedExchangePointer((a), (v))

  '#IF _M_IX86
   '#DEFINE SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchange(CAST(INTEGER PTR, (a)), CAST(INTEGER, (newval)), CAST(INTEGER, (oldval))) = CAST(INTEGER, (oldval)))
  '#ELSE ' _M_IX86
   '#DEFINE SDL_AtomicCASPtr(a, oldval, newval) (_InterlockedCompareExchangePointer((a), (newval), (oldval)) = (oldval))
  '#ENDIF ' _M_IX86
 '#ELSEIF DEFINED(__MACOSX__)

  '' file not found: libkern/OSAtomic.h

  '#DEFINE SDL_AtomicCAS(a, oldval, newval) OSAtomicCompareAndSwap32Barrier((oldval), (newval), @(a)->value)

  '#IFDEF __LP64__
  '#DEFINE SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap64Barrier(CAST(LONGINT, (oldval)), CAST(LONGINT, (newval)), CAST(LONGINT PTR, (a)))
  '#ELSE ' __LP64__
  '#DEFINE SDL_AtomicCASPtr(a, oldval, newval) OSAtomicCompareAndSwap32Barrier(CAST(INTEGER, (oldval)), CAST(INTEGER, (newval)), CAST(INTEGER PTR, (a)))
  '#ENDIF ' __LP64__
 '#ELSEIF DEFINED(HAVE_GCC_ATOMICS)
  '#DEFINE SDL_AtomicSet(a, v) __sync_lock_test_and_set(@(a)->value, v)
  '#DEFINE SDL_AtomicAdd(a, v) __sync_fetch_and_add(@(a)->value, v)
  '#DEFINE SDL_AtomicSetPtr(a, v) __sync_lock_test_and_set(a, v)
  '#DEFINE SDL_AtomicCAS(a, oldval, newval) __sync_bool_compare_and_swap(@(a)->value, oldval, newval)
  '#DEFINE SDL_AtomicCASPtr(a, oldval, newval) __sync_bool_compare_and_swap(a, oldval, newval)
 '#ENDIF ' HAVE_MSC_ATOMICS
'#ENDIF ' SDL_DISABLE_ATOMIC_INLINE ???

'#IFNDEF SDL_atomic_t_defined

'TYPE SDL_atomic_t
	'AS INTEGER value
'END TYPE

'#ENDIF ' SDL_atomic_t_defined

'#IFNDEF SDL_AtomicCAS

'DECLARE FUNCTION SDL_AtomicCAS(BYVAL AS SDL_atomic_t PTR, BYVAL AS INTEGER, BYVAL AS INTEGER) AS SDL_bool

'#ENDIF ' SDL_AtomicCAS

'#IFNDEF SDL_AtomicSet
'???
'SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
'{
    'int value;
    'do {
        'value = a->value;
    '} while (!SDL_AtomicCAS(a, value, v));
    'return value;
'}
'#ENDIF ' SDL_AtomicSet

'#IFNDEF SDL_AtomicGet
'???
'SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
'{
    'int value = a->value;
    'SDL_CompilerBarrier();
    'return value;
'}
'#ENDIF ' SDL_AtomicGet

'#IFNDEF SDL_AtomicAdd
'???
'SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
'{
    'int value;
    'do {
        'value = a->value;
    '} while (!SDL_AtomicCAS(a, value, (value + v)));
    'return value;
'}
'#ENDIF ' SDL_AtomicAdd

'#IFNDEF SDL_AtomicIncRef
'#DEFINE SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
'#ENDIF ' SDL_AtomicIncRef

'#IFNDEF SDL_AtomicDecRef
'#DEFINE SDL_AtomicDecRef(a) IIF(SDL_AtomicAdd(a, -1) = 1, SDL_TRUE, SDL_FALSE)
'#ENDIF ' SDL_AtomicDecRef

'#IFNDEF SDL_AtomicCASPtr

'DECLARE FUNCTION SDL_AtomicCASPtr(BYVAL AS ANY PTR PTR, BYVAL AS ANY PTR, BYVAL AS ANY PTR) AS SDL_bool

'#ENDIF ' SDL_AtomicCASPtr

'#IFNDEF SDL_AtomicSetPtr
'???
'SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
'{
    'void* value;
    'do {
        'value = *a;
    '} while (!SDL_AtomicCASPtr(a, value, v));
    'return value;
'}
'#ENDIF ' SDL_AtomicSetPtr

'#IFNDEF SDL_AtomicGetPtr
'???
'SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
'{
    'void* value = *a;
    'SDL_CompilerBarrier();
    'return value;
'}
'#ENDIF ' SDL_AtomicGetPtr

'#ENDIF ' _SDL_atomic_h_

' 002 back from SDL2-2.0.1/include/SDL_atomic.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_audio.h

#IFNDEF _SDL_audio_h
#DEFINE _SDL_audio_h

' 003 start from: SDL2-2.0.1/include/SDL_audio.h ==> SDL2-2.0.1/include/SDL_error.h

#IFNDEF _SDL_error_h
#DEFINE _SDL_error_h

DECLARE FUNCTION SDL_SetError(BYVAL AS CONST ZSTRING PTR, ...) AS INTEGER
DECLARE FUNCTION SDL_GetError() AS CONST ZSTRING PTR
DECLARE SUB SDL_ClearError()

#DEFINE SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
#DEFINE SDL_Unsupported_() SDL_Error(SDL_UNSUPPORTED)
#DEFINE SDL_InvalidParamError(param) SDL_SetError(@!"Parameter '%s' is invalid", (param))

ENUM SDL_errorcode
	SDL_ENOMEM
	SDL_EFREAD
	SDL_EFWRITE
	SDL_EFSEEK
	SDL_UNSUPPORTED
	SDL_LASTERROR
END ENUM

DECLARE FUNCTION SDL_Error(BYVAL AS SDL_errorcode) AS INTEGER

#ENDIF ' _SDL_error_h

' 003 back from SDL2-2.0.1/include/SDL_error.h ==> SDL2-2.0.1/include/SDL_audio.h
' 003 start from: SDL2-2.0.1/include/SDL_audio.h ==> SDL2-2.0.1/include/SDL_endian.h

#IFNDEF _SDL_endian_h
#DEFINE _SDL_endian_h

#DEFINE SDL_LIL_ENDIAN 1234
#DEFINE SDL_BIG_ENDIAN 4321

#IFNDEF __FB_BIGENDIAN__
#DEFINE SDL_BYTEORDER SDL_BIG_ENDIAN
#ELSE ' __FB_BIGENDIAN__
#DEFINE SDL_BYTEORDER SDL_LIL_ENDIAN
#ENDIF ' __FB_BIGENDIAN__

#DEFINE SDL_Swap16(x) SDL_static_cast(Uint16, _
                       (x AND &hFF) SHL 8 _
                     + (x AND &hFF00) SHR 8)
#DEFINE SDL_Swap32(x) SDL_static_cast(Uint32, _
                       (x AND &hFF) SHL 24 _
                     + (x AND &hFF00) SHL 8 _
                     + (x AND &hFF0000) SHR 8 _
                     + (x AND &hFF000000) SHR 24)
#DEFINE SDL_Swap64(x) SDL_static_cast(Uint64, _
                       (x AND &hFFull) SHL 56 _
                     + (x AND &hFF00ull) SHL 40 _
                     + (x AND &hFF0000ull) SHL 24 _
                     + (x AND &hFF000000ull) SHL 8 _
                     + (x AND &hFF00000000ull) SHR 8 _
                     + (x AND &hFF0000000000ull) SHR 24 _
                     + (x AND &hFF000000000000ull) SHR 40 _
                     + (x AND &hFF00000000000000ull) SHR 56)
#DEFINE SDL_SwapFloat(x) SDL_static_cast(SINGLE, _
                       (PEEK(Uint32, @x) AND &hFF) SHL 24 _
                     + (PEEK(Uint32, @x) AND &hFF00) SHL 8 _
                     + (PEEK(Uint32, @x) AND &hFF0000) SHR 8 _
                     + (PEEK(Uint32, @x) AND &hFF000000) SHR 24)

#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 ' SDL_BYTEORDER =...
#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 ' SDL_BYTEORDER =...

#ENDIF ' _SDL_endian_h

' 003 back from SDL2-2.0.1/include/SDL_endian.h ==> SDL2-2.0.1/include/SDL_audio.h
' 003 start from: SDL2-2.0.1/include/SDL_audio.h ==> SDL2-2.0.1/include/SDL_mutex.h

#IFNDEF _SDL_mutex_h
#DEFINE _SDL_mutex_h

#DEFINE SDL_MUTEX_TIMEDOUT 1
#DEFINE SDL_MUTEX_MAXWAIT ( NOT CAST(Uint32, 0))

TYPE SDL_mutex AS SDL_mutex_

DECLARE FUNCTION SDL_CreateMutex() AS SDL_mutex PTR

#DEFINE SDL_mutexP(m) SDL_LockMutex(m)

DECLARE FUNCTION SDL_LockMutex(BYVAL AS SDL_mutex PTR) AS INTEGER
DECLARE FUNCTION SDL_TryLockMutex(BYVAL AS SDL_mutex PTR) AS INTEGER

#DEFINE SDL_mutexV(m) SDL_UnlockMutex(m)

DECLARE FUNCTION SDL_UnlockMutex(BYVAL AS SDL_mutex PTR) AS INTEGER
DECLARE SUB SDL_DestroyMutex(BYVAL AS SDL_mutex PTR)

TYPE SDL_sem AS SDL_semaphore

DECLARE FUNCTION SDL_CreateSemaphore(BYVAL AS Uint32) AS SDL_sem PTR
DECLARE SUB SDL_DestroySemaphore(BYVAL AS SDL_sem PTR)
DECLARE FUNCTION SDL_SemWait(BYVAL AS SDL_sem PTR) AS INTEGER
DECLARE FUNCTION SDL_SemTryWait(BYVAL AS SDL_sem PTR) AS INTEGER
DECLARE FUNCTION SDL_SemWaitTimeout(BYVAL AS SDL_sem PTR, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_SemPost(BYVAL AS SDL_sem PTR) AS INTEGER
DECLARE FUNCTION SDL_SemValue(BYVAL AS SDL_sem PTR) AS Uint32

TYPE SDL_cond AS SDL_cond_

DECLARE FUNCTION SDL_CreateCond() AS SDL_cond PTR
DECLARE SUB SDL_DestroyCond(BYVAL AS SDL_cond PTR)
DECLARE FUNCTION SDL_CondSignal(BYVAL AS SDL_cond PTR) AS INTEGER
DECLARE FUNCTION SDL_CondBroadcast(BYVAL AS SDL_cond PTR) AS INTEGER
DECLARE FUNCTION SDL_CondWait(BYVAL AS SDL_cond PTR, BYVAL AS SDL_mutex PTR) AS INTEGER
DECLARE FUNCTION SDL_CondWaitTimeout(BYVAL AS SDL_cond PTR, BYVAL AS SDL_mutex PTR, BYVAL AS Uint32) AS INTEGER

#ENDIF ' _SDL_mutex_h

' 003 back from SDL2-2.0.1/include/SDL_mutex.h ==> SDL2-2.0.1/include/SDL_audio.h
' 003 start from: SDL2-2.0.1/include/SDL_audio.h ==> SDL2-2.0.1/include/SDL_thread.h

#IFNDEF _SDL_thread_h
#DEFINE _SDL_thread_h

TYPE SDL_Thread AS SDL_Thread_
TYPE SDL_threadID AS UINTEGER
TYPE SDL_TLSID AS UINTEGER

ENUM SDL_ThreadPriority
	SDL_THREAD_PRIORITY_LOW
	SDL_THREAD_PRIORITY_NORMAL
	SDL_THREAD_PRIORITY_HIGH
END ENUM

TYPE SDL_ThreadFunction AS FUNCTION(BYVAL AS ANY PTR) AS INTEGER

#IF DEFINED(__WIN32__)  AND  NOT DEFINED(HAVE_LIBC)
#DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD
#INCLUDE ONCE "crt/process.bi" '__HEADERS__: process.h

TYPE pfnSDL_CurrentBeginThread AS FUNCTION(BYVAL AS ANY PTR, BYVAL AS UINTEGER, BYVAL AS FUNCTION CDECL(BYVAL AS ANY PTR) AS UINTEGER, BYVAL AS ANY PTR, BYVAL AS UINTEGER, BYVAL AS UINTEGER PTR) AS uintptr_t
TYPE pfnSDL_CurrentEndThread AS SUB CDECL(BYVAL AS UINTEGER)

DECLARE FUNCTION SDL_CreateThread(BYVAL AS SDL_ThreadFunction, BYVAL AS CONST ZSTRING PTR, BYVAL AS ANY PTR, BYVAL AS pfnSDL_CurrentBeginThread, BYVAL AS pfnSDL_CurrentEndThread) AS SDL_Thread PTR

#DEFINE SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, CAST(pfnSDL_CurrentBeginThread, _beginthreadex), CAST(pfnSDL_CurrentEndThread, _endthreadex))
#ELSE ' DEFINED(__WIN32...

DECLARE FUNCTION SDL_CreateThread(BYVAL AS SDL_ThreadFunction, BYVAL AS CONST ZSTRING PTR, BYVAL AS ANY PTR) AS SDL_Thread PTR

#ENDIF ' DEFINED(__WIN32...

DECLARE FUNCTION SDL_GetThreadName(BYVAL AS SDL_Thread PTR) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_ThreadID() AS SDL_threadID
DECLARE FUNCTION SDL_GetThreadID(BYVAL AS SDL_Thread PTR) AS SDL_threadID
DECLARE FUNCTION SDL_SetThreadPriority(BYVAL AS SDL_ThreadPriority) AS INTEGER
DECLARE SUB SDL_WaitThread(BYVAL AS SDL_Thread PTR, BYVAL AS INTEGER PTR)
DECLARE FUNCTION SDL_TLSCreate() AS SDL_TLSID
DECLARE FUNCTION SDL_TLSGet(BYVAL AS SDL_TLSID) AS ANY PTR
DECLARE FUNCTION SDL_TLSSet(BYVAL AS SDL_TLSID, BYVAL AS CONST ANY PTR, BYVAL AS SUB(BYVAL AS ANY PTR)) AS INTEGER

#ENDIF ' _SDL_thread_h

' 003 back from SDL2-2.0.1/include/SDL_thread.h ==> SDL2-2.0.1/include/SDL_audio.h
' 003 start from: SDL2-2.0.1/include/SDL_audio.h ==> SDL2-2.0.1/include/SDL_rwops.h

#IFNDEF _SDL_rwops_h
#DEFINE _SDL_rwops_h

#DEFINE SDL_RWOPS_UNKNOWN 0
#DEFINE SDL_RWOPS_WINFILE 1
#DEFINE SDL_RWOPS_STDFILE 2
#DEFINE SDL_RWOPS_JNIFILE 3
#DEFINE SDL_RWOPS_MEMORY 4
#DEFINE SDL_RWOPS_MEMORY_RO 5

TYPE SDL_RWops_androidio
	AS ANY PTR fileNameRef
	AS ANY PTR inputStreamRef
	AS ANY PTR readableByteChannelRef
	AS ANY PTR readMethod
	AS ANY PTR assetFileDescriptorRef
	AS INTEGER position
	AS INTEGER size
	AS INTEGER offset
	AS INTEGER fd
END TYPE

TYPE SDL_RWops_buffer
	AS ANY PTR data
	AS size_t size
	AS size_t left
END TYPE

TYPE SDL_RWops_windowsio
	AS SDL_bool append
	AS ANY PTR h
	AS SDL_RWops_buffer buffer
END TYPE

TYPE SDL_RWops_stdio
	AS SDL_bool autoclose
	AS FILE PTR fp
END TYPE

TYPE SDL_RWops_mem
	AS Uint8 PTR base
	AS Uint8 PTR here
	AS Uint8 PTR stop
END TYPE

TYPE SDL_RWops_unknown_
	AS ANY PTR data1
	AS ANY PTR data2
END TYPE

UNION SDL_RWops_hidden
#IF DEFINED(ANDROID)
	AS SDL_RWops_androidio androidio
#ELSEIF DEFINED(__WIN32__)
	AS SDL_RWops_windowsio windowsio
#ENDIF ' DEFINED(ANDROID...
#IFDEF HAVE_STDIO_H
	AS SDL_RWops_stdio stdio
#ENDIF ' HAVE_STDIO_H
	AS SDL_RWops_mem mem
	AS SDL_RWops_unknown_ unknown
END UNION

TYPE SDL_RWops
	size AS FUNCTION(BYVAL AS SDL_RWops PTR) AS Sint64
	seek_ AS FUNCTION(BYVAL AS SDL_RWops PTR, BYVAL AS Sint64, BYVAL AS INTEGER) AS Sint64
	read_ AS FUNCTION(BYVAL AS SDL_RWops PTR, BYVAL AS ANY PTR, BYVAL AS size_t, BYVAL AS size_t) AS size_t
	write_ AS FUNCTION(BYVAL AS SDL_RWops PTR, BYVAL AS CONST ANY PTR, BYVAL AS size_t, BYVAL AS size_t) AS size_t
	close_ AS FUNCTION(BYVAL AS SDL_RWops PTR) AS INTEGER
	AS Uint32 type
	AS SDL_RWops_hidden hidden
END TYPE

DECLARE FUNCTION SDL_RWFromFile(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS SDL_RWops PTR

#IFDEF HAVE_STDIO_H

DECLARE FUNCTION SDL_RWFromFP(BYVAL AS FILE PTR, BYVAL AS SDL_bool) AS SDL_RWops PTR

#ELSE ' HAVE_STDIO_H

DECLARE FUNCTION SDL_RWFromFP(BYVAL AS ANY PTR, BYVAL AS SDL_bool) AS SDL_RWops PTR

#ENDIF ' HAVE_STDIO_H

DECLARE FUNCTION SDL_RWFromMem(BYVAL AS ANY PTR, BYVAL AS INTEGER) AS SDL_RWops PTR
DECLARE FUNCTION SDL_RWFromConstMem(BYVAL AS CONST ANY PTR, BYVAL AS INTEGER) AS SDL_RWops PTR
DECLARE FUNCTION SDL_AllocRW() AS SDL_RWops PTR
DECLARE SUB SDL_FreeRW(BYVAL AS SDL_RWops PTR)

#DEFINE RW_SEEK_SET 0
#DEFINE RW_SEEK_CUR 1
#DEFINE RW_SEEK_END 2
#DEFINE SDL_RWsize(ctx) (ctx)->size(ctx)
#DEFINE SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#DEFINE SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#DEFINE SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
#DEFINE SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
#DEFINE SDL_RWclose(ctx) (ctx)->close(ctx)

DECLARE FUNCTION SDL_ReadU8(BYVAL AS SDL_RWops PTR) AS Uint8
DECLARE FUNCTION SDL_ReadLE16(BYVAL AS SDL_RWops PTR) AS Uint16
DECLARE FUNCTION SDL_ReadBE16(BYVAL AS SDL_RWops PTR) AS Uint16
DECLARE FUNCTION SDL_ReadLE32(BYVAL AS SDL_RWops PTR) AS Uint32
DECLARE FUNCTION SDL_ReadBE32(BYVAL AS SDL_RWops PTR) AS Uint32
DECLARE FUNCTION SDL_ReadLE64(BYVAL AS SDL_RWops PTR) AS Uint64
DECLARE FUNCTION SDL_ReadBE64(BYVAL AS SDL_RWops PTR) AS Uint64
DECLARE FUNCTION SDL_WriteU8(BYVAL AS SDL_RWops PTR, BYVAL AS Uint8) AS size_t
DECLARE FUNCTION SDL_WriteLE16(BYVAL AS SDL_RWops PTR, BYVAL AS Uint16) AS size_t
DECLARE FUNCTION SDL_WriteBE16(BYVAL AS SDL_RWops PTR, BYVAL AS Uint16) AS size_t
DECLARE FUNCTION SDL_WriteLE32(BYVAL AS SDL_RWops PTR, BYVAL AS Uint32) AS size_t
DECLARE FUNCTION SDL_WriteBE32(BYVAL AS SDL_RWops PTR, BYVAL AS Uint32) AS size_t
DECLARE FUNCTION SDL_WriteLE64(BYVAL AS SDL_RWops PTR, BYVAL AS Uint64) AS size_t
DECLARE FUNCTION SDL_WriteBE64(BYVAL AS SDL_RWops PTR, BYVAL AS Uint64) AS size_t

#ENDIF ' _SDL_rwops_h

' 003 back from SDL2-2.0.1/include/SDL_rwops.h ==> SDL2-2.0.1/include/SDL_audio.h

TYPE SDL_AudioFormat AS Uint16

#DEFINE SDL_AUDIO_MASK_BITSIZE (&hFF)
#DEFINE SDL_AUDIO_MASK_DATATYPE (1 SHL 8)
#DEFINE SDL_AUDIO_MASK_ENDIAN (1 SHL 12)
#DEFINE SDL_AUDIO_MASK_SIGNED (1 SHL 15)
#DEFINE SDL_AUDIO_BITSIZE(x) (x AND SDL_AUDIO_MASK_BITSIZE)
#DEFINE SDL_AUDIO_ISFLOAT(x) (x AND SDL_AUDIO_MASK_DATATYPE)
#DEFINE SDL_AUDIO_ISBIGENDIAN(x) (x AND SDL_AUDIO_MASK_ENDIAN)
#DEFINE SDL_AUDIO_ISSIGNED(x) (x AND SDL_AUDIO_MASK_SIGNED)
#DEFINE SDL_AUDIO_ISINT(x) IIF(0 = SDL_AUDIO_ISFLOAT(x), SDL_TRUE, SDL_FALSE)
#DEFINE SDL_AUDIO_ISLITTLEENDIAN(x) IIF(0 = SDL_AUDIO_ISBIGENDIAN(x), SDL_TRUE, SDL_FALSE)
#DEFINE SDL_AUDIO_ISUNSIGNED(x) IIF(0 = SDL_AUDIO_ISSIGNED(x), SDL_TRUE, SDL_FALSE)
#DEFINE AUDIO_U8 &h0008
#DEFINE AUDIO_S8 &h8008
#DEFINE AUDIO_U16LSB &h0010
#DEFINE AUDIO_S16LSB &h8010
#DEFINE AUDIO_U16MSB &h1010
#DEFINE AUDIO_S16MSB &h9010
#DEFINE AUDIO_U16 AUDIO_U16LSB
#DEFINE AUDIO_S16 AUDIO_S16LSB
#DEFINE AUDIO_S32LSB &h8020
#DEFINE AUDIO_S32MSB &h9020
#DEFINE AUDIO_S32 AUDIO_S32LSB
#DEFINE AUDIO_F32LSB &h8120
#DEFINE AUDIO_F32MSB &h9120
#DEFINE AUDIO_F32 AUDIO_F32LSB

#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 ' SDL_BYTEORDER =...
#DEFINE AUDIO_U16SYS AUDIO_U16MSB
#DEFINE AUDIO_S16SYS AUDIO_S16MSB
#DEFINE AUDIO_S32SYS AUDIO_S32MSB
#DEFINE AUDIO_F32SYS AUDIO_F32MSB
#ENDIF ' SDL_BYTEORDER =...

#DEFINE SDL_AUDIO_ALLOW_FREQUENCY_CHANGE &h00000001
#DEFINE SDL_AUDIO_ALLOW_FORMAT_CHANGE &h00000002
#DEFINE SDL_AUDIO_ALLOW_CHANNELS_CHANGE &h00000004
#DEFINE SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE OR SDL_AUDIO_ALLOW_FORMAT_CHANGE OR SDL_AUDIO_ALLOW_CHANNELS_CHANGE)

TYPE SDL_AudioCallback AS SUB(BYVAL AS ANY PTR, BYVAL AS Uint8 PTR, BYVAL AS INTEGER)

TYPE SDL_AudioSpec
	AS INTEGER freq
	AS SDL_AudioFormat format
	AS Uint8 channels
	AS Uint8 silence
	AS Uint16 samples
	AS Uint16 padding
	AS Uint32 size
	AS SDL_AudioCallback callback
	AS ANY PTR userdata
END TYPE

TYPE SDL_AudioCVT_ AS SDL_AudioCVT
TYPE SDL_AudioFilter AS SUB(BYVAL AS SDL_AudioCVT_ PTR, BYVAL AS SDL_AudioFormat)

#IFDEF __GNUC__
#DEFINE SDL_AUDIOCVT_PACKED __attribute__((packed))
#ELSE ' __GNUC__
#DEFINE SDL_AUDIOCVT_PACKED
#ENDIF ' __GNUC__

TYPE SDL_AudioCVT
	AS INTEGER needed
	AS SDL_AudioFormat src_format
	AS SDL_AudioFormat dst_format
	AS DOUBLE rate_incr
	AS Uint8 PTR buf
	AS INTEGER len
	AS INTEGER len_cvt
	AS INTEGER len_mult
	AS DOUBLE len_ratio
	AS SDL_AudioFilter filters(9)
	AS INTEGER filter_index
END TYPE

TYPE SDL_AUDIOCVT_PACKED_ AS SDL_AudioCVT

DECLARE FUNCTION SDL_GetNumAudioDrivers() AS INTEGER
DECLARE FUNCTION SDL_GetAudioDriver(BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_AudioInit(BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE SUB SDL_AudioQuit()
DECLARE FUNCTION SDL_GetCurrentAudioDriver() AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_OpenAudio(BYVAL AS SDL_AudioSpec PTR, BYVAL AS SDL_AudioSpec PTR) AS INTEGER

TYPE SDL_AudioDeviceID AS Uint32

DECLARE FUNCTION SDL_GetNumAudioDevices(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_GetAudioDeviceName(BYVAL AS INTEGER, BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_OpenAudioDevice(BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER, BYVAL AS CONST SDL_AudioSpec PTR, BYVAL AS SDL_AudioSpec PTR, BYVAL AS INTEGER) AS SDL_AudioDeviceID

ENUM SDL_AudioStatus
	SDL_AUDIO_STOPPED = 0
	SDL_AUDIO_PLAYING
	SDL_AUDIO_PAUSED
END ENUM

DECLARE FUNCTION SDL_GetAudioStatus() AS SDL_AudioStatus
DECLARE FUNCTION SDL_GetAudioDeviceStatus(BYVAL AS SDL_AudioDeviceID) AS SDL_AudioStatus
DECLARE SUB SDL_PauseAudio(BYVAL AS INTEGER)
DECLARE SUB SDL_PauseAudioDevice(BYVAL AS SDL_AudioDeviceID, BYVAL AS INTEGER)
DECLARE FUNCTION SDL_LoadWAV_RW(BYVAL AS SDL_RWops PTR, BYVAL AS INTEGER, BYVAL AS SDL_AudioSpec PTR, BYVAL AS Uint8 PTR PTR, BYVAL AS Uint32 PTR) AS SDL_AudioSpec PTR

#DEFINE SDL_LoadWAV(file, spec, audio_buf, audio_len) _
    SDL_LoadWAV_RW(SDL_RWFromFile(file, @!"rb"),1, spec,audio_buf,audio_len)

DECLARE SUB SDL_FreeWAV(BYVAL AS Uint8 PTR)
DECLARE FUNCTION SDL_BuildAudioCVT(BYVAL AS SDL_AudioCVT PTR, BYVAL AS SDL_AudioFormat, BYVAL AS Uint8, BYVAL AS INTEGER, BYVAL AS SDL_AudioFormat, BYVAL AS Uint8, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_ConvertAudio(BYVAL AS SDL_AudioCVT PTR) AS INTEGER

#DEFINE SDL_MIX_MAXVOLUME 128

DECLARE SUB SDL_MixAudio(BYVAL AS Uint8 PTR, BYVAL AS CONST Uint8 PTR, BYVAL AS Uint32, BYVAL AS INTEGER)
DECLARE SUB SDL_MixAudioFormat(BYVAL AS Uint8 PTR, BYVAL AS CONST Uint8 PTR, BYVAL AS SDL_AudioFormat, BYVAL AS Uint32, BYVAL AS INTEGER)
DECLARE SUB SDL_LockAudio()
DECLARE SUB SDL_LockAudioDevice(BYVAL AS SDL_AudioDeviceID)
DECLARE SUB SDL_UnlockAudio()
DECLARE SUB SDL_UnlockAudioDevice(BYVAL AS SDL_AudioDeviceID)
DECLARE SUB SDL_CloseAudio()
DECLARE SUB SDL_CloseAudioDevice(BYVAL AS SDL_AudioDeviceID)

#ENDIF ' _SDL_audio_h

' 002 back from SDL2-2.0.1/include/SDL_audio.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_clipboard.h

#IFNDEF _SDL_clipboard_h
#DEFINE _SDL_clipboard_h

DECLARE FUNCTION SDL_SetClipboardText(BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE FUNCTION SDL_GetClipboardText() AS ZSTRING PTR
DECLARE FUNCTION SDL_HasClipboardText() AS SDL_bool

#ENDIF ' _SDL_clipboard_h

' 002 back from SDL2-2.0.1/include/SDL_clipboard.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_cpuinfo.h

#IFNDEF _SDL_cpuinfo_h
#DEFINE _SDL_cpuinfo_h

'#IF DEFINED(_MSC_VER)  AND (_MSC_VER  >= 1500)
'???
'' file already missed: intrin.h

'#IFNDEF _WIN64
'#DEFINE __MMX__
'#DEFINE __3dNOW__
'#ENDIF ' _WIN64

'#DEFINE __SSE__
'#DEFINE __SSE2__
'#ELSEIF DEFINED(__MINGW64_VERSION_MAJOR)

'' file already missed: intrin.h

'#ELSE ' DEFINED(_MSC_VE...
'#IFDEF __ALTIVEC__
'#IF HAVE_ALTIVEC_H  AND  NOT DEFINED(__APPLE_ALTIVEC__)

'' file not found: altivec.h

'#UNDEF pixel
'#ENDIF ' HAVE_ALTIVEC_H ...
'#ENDIF ' __ALTIVEC__

'#IFDEF __MMX__

'' file not found: mmintrin.h

'#ENDIF ' __MMX__

'#IFDEF __3dNOW__

'' file not found: mm3dnow.h

'#ENDIF ' __3dNOW__

'#IFDEF __SSE__

'' file not found: xmmintrin.h

'#ENDIF ' __SSE__

'#IFDEF __SSE2__

'' file not found: emmintrin.h

'#ENDIF ' __SSE2__
'#ENDIF ' DEFINED(_MSC_VE...

#DEFINE SDL_CACHELINE_SIZE 128

DECLARE FUNCTION SDL_GetCPUCount() AS INTEGER
DECLARE FUNCTION SDL_GetCPUCacheLineSize() AS INTEGER
DECLARE FUNCTION SDL_HasRDTSC() AS SDL_bool
DECLARE FUNCTION SDL_HasAltiVec() AS SDL_bool
DECLARE FUNCTION SDL_HasMMX() AS SDL_bool
DECLARE FUNCTION SDL_Has3DNow() AS SDL_bool
DECLARE FUNCTION SDL_HasSSE() AS SDL_bool
DECLARE FUNCTION SDL_HasSSE2() AS SDL_bool
DECLARE FUNCTION SDL_HasSSE3() AS SDL_bool
DECLARE FUNCTION SDL_HasSSE41() AS SDL_bool
DECLARE FUNCTION SDL_HasSSE42() AS SDL_bool
DECLARE FUNCTION SDL_GetSystemRAM() AS INTEGER

#ENDIF ' _SDL_cpuinfo_h

' 002 back from SDL2-2.0.1/include/SDL_cpuinfo.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_events.h

#IFNDEF _SDL_events_h
#DEFINE _SDL_events_h

' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_video.h

#IFNDEF _SDL_video_h
#DEFINE _SDL_video_h

' 004 start from: SDL2-2.0.1/include/SDL_video.h ==> SDL2-2.0.1/include/SDL_pixels.h

#IFNDEF _SDL_pixels_h
#DEFINE _SDL_pixels_h

#DEFINE SDL_ALPHA_OPAQUE 255
#DEFINE SDL_ALPHA_TRANSPARENT 0

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
END ENUM

ENUM
	SDL_BITMAPORDER_NONE
	SDL_BITMAPORDER_4321
	SDL_BITMAPORDER_1234
END ENUM

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
END ENUM

ENUM
	SDL_ARRAYORDER_NONE
	SDL_ARRAYORDER_RGB
	SDL_ARRAYORDER_RGBA
	SDL_ARRAYORDER_ARGB
	SDL_ARRAYORDER_BGR
	SDL_ARRAYORDER_BGRA
	SDL_ARRAYORDER_ABGR
END ENUM

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
END ENUM

#DEFINE SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
#DEFINE SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) _
    ((1 SHL 28) OR ((type) SHL 24) OR ((order) SHL 20) OR ((layout) SHL 16) OR _
     ((bits) SHL 8) OR ((bytes) SHL 0))
#DEFINE SDL_PIXELFLAG(X) (((X) SHR 28) AND &h0F)
#DEFINE SDL_PIXELTYPE(X) (((X) SHR 24) AND &h0F)
#DEFINE SDL_PIXELORDER(X) (((X) SHR 20) AND &h0F)
#DEFINE SDL_PIXELLAYOUT(X) (((X) SHR 16) AND &h0F)
#DEFINE SDL_BITSPERPIXEL(X) (((X) SHR 8) AND &hFF)
#DEFINE SDL_BYTESPERPIXEL(X) _
    IIF(SDL_ISPIXELFORMAT_FOURCC(X) , _
        IIF((((X) = SDL_PIXELFORMAT_YUY2) ORELSE _
          ((X) = SDL_PIXELFORMAT_UYVY) ORELSE _
          ((X) = SDL_PIXELFORMAT_YVYU)) , 2 , 1), (((X) SHR 0) AND &hFF))
#DEFINE SDL_ISPIXELFORMAT_INDEXED(format) _
    IIF(0 = SDL_ISPIXELFORMAT_FOURCC(format) ANDALSO _
     ((SDL_PIXELTYPE(format) = SDL_PIXELTYPE_INDEX1) ORELSE _
      (SDL_PIXELTYPE(format) = SDL_PIXELTYPE_INDEX4) ORELSE _
      (SDL_PIXELTYPE(format) = SDL_PIXELTYPE_INDEX8)), SDL_TRUE, SDL_FALSE)
#DEFINE SDL_ISPIXELFORMAT_ALPHA(format) _
    IIF(0 = SDL_ISPIXELFORMAT_FOURCC(format) ANDALSO _
     ((SDL_PIXELORDER(format) = SDL_PACKEDORDER_ARGB) ORELSE _
      (SDL_PIXELORDER(format) = SDL_PACKEDORDER_RGBA) ORELSE _
      (SDL_PIXELORDER(format) = SDL_PACKEDORDER_ABGR) ORELSE _
      (SDL_PIXELORDER(format) = SDL_PACKEDORDER_BGRA)), SDL_TRUE, SDL_FALSE)
#DEFINE SDL_ISPIXELFORMAT_FOURCC(format) _
    IIF((format) ANDALSO (SDL_PIXELFLAG(format) <> 1), SDL_TRUE, SDL_FALSE)

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_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_RGB444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_4444, 12, 2)
	SDL_PIXELFORMAT_RGB555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_1555, 15, 2)
	SDL_PIXELFORMAT_BGR555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_1555, 15, 2)
	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_RGB888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_8888, 24, 4)
	SDL_PIXELFORMAT_RGBX8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, SDL_PACKEDLAYOUT_8888, 24, 4)
	SDL_PIXELFORMAT_BGR888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_8888, 24, 4)
	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)
	SDL_PIXELFORMAT_YV12 = SDL_DEFINE_PIXELFOURCC(ASC(!"Y"), ASC(!"V"), ASC(!"1"), ASC(!"2"))
	SDL_PIXELFORMAT_IYUV = SDL_DEFINE_PIXELFOURCC(ASC(!"I"), ASC(!"Y"), ASC(!"U"), ASC(!"V"))
	SDL_PIXELFORMAT_YUY2 = SDL_DEFINE_PIXELFOURCC(ASC(!"Y"), ASC(!"U"), ASC(!"Y"), ASC(!"2"))
	SDL_PIXELFORMAT_UYVY = SDL_DEFINE_PIXELFOURCC(ASC(!"U"), ASC(!"Y"), ASC(!"V"), ASC(!"Y"))
	SDL_PIXELFORMAT_YVYU = SDL_DEFINE_PIXELFOURCC(ASC(!"Y"), ASC(!"V"), ASC(!"Y"), ASC(!"U"))
END ENUM

TYPE SDL_Color
	AS Uint8 r
	AS Uint8 g
	AS Uint8 b
	AS Uint8 a
END TYPE

#DEFINE SDL_Colour SDL_Color

TYPE SDL_Palette
	AS INTEGER ncolors
	AS SDL_Color PTR colors
	AS Uint32 version
	AS INTEGER refcount
END TYPE

TYPE SDL_PixelFormat
	AS Uint32 format
	AS SDL_Palette PTR palette
	AS Uint8 BitsPerPixel
	AS Uint8 BytesPerPixel
	AS Uint8 padding(1)
	AS Uint32 Rmask
	AS Uint32 Gmask
	AS Uint32 Bmask
	AS Uint32 Amask
	AS Uint8 Rloss
	AS Uint8 Gloss
	AS Uint8 Bloss
	AS Uint8 Aloss
	AS Uint8 Rshift
	AS Uint8 Gshift
	AS Uint8 Bshift
	AS Uint8 Ashift
	AS INTEGER refcount
	AS SDL_PixelFormat PTR next
END TYPE

DECLARE FUNCTION SDL_GetPixelFormatName(BYVAL AS Uint32) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_PixelFormatEnumToMasks(BYVAL AS Uint32, BYVAL AS INTEGER PTR, BYVAL AS Uint32 PTR, BYVAL AS Uint32 PTR, BYVAL AS Uint32 PTR, BYVAL AS Uint32 PTR) AS SDL_bool
DECLARE FUNCTION SDL_MasksToPixelFormatEnum(BYVAL AS INTEGER, BYVAL AS Uint32, BYVAL AS Uint32, BYVAL AS Uint32, BYVAL AS Uint32) AS Uint32
DECLARE FUNCTION SDL_AllocFormat(BYVAL AS Uint32) AS SDL_PixelFormat PTR
DECLARE SUB SDL_FreeFormat(BYVAL AS SDL_PixelFormat PTR)
DECLARE FUNCTION SDL_AllocPalette(BYVAL AS INTEGER) AS SDL_Palette PTR
DECLARE FUNCTION SDL_SetPixelFormatPalette(BYVAL AS SDL_PixelFormat PTR, BYVAL AS SDL_Palette PTR) AS INTEGER
DECLARE FUNCTION SDL_SetPaletteColors(BYVAL AS SDL_Palette PTR, BYVAL AS CONST SDL_Color PTR, BYVAL AS INTEGER, BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_FreePalette(BYVAL AS SDL_Palette PTR)
DECLARE FUNCTION SDL_MapRGB(BYVAL AS CONST SDL_PixelFormat PTR, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8) AS Uint32
DECLARE FUNCTION SDL_MapRGBA(BYVAL AS CONST SDL_PixelFormat PTR, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8) AS Uint32
DECLARE SUB SDL_GetRGB(BYVAL AS Uint32, BYVAL AS CONST SDL_PixelFormat PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR)
DECLARE SUB SDL_GetRGBA(BYVAL AS Uint32, BYVAL AS CONST SDL_PixelFormat PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR)
DECLARE SUB SDL_CalculateGammaRamp(BYVAL AS SINGLE, BYVAL AS Uint16 PTR)

#ENDIF ' _SDL_pixels_h

' 004 back from SDL2-2.0.1/include/SDL_pixels.h ==> SDL2-2.0.1/include/SDL_video.h
' 004 start from: SDL2-2.0.1/include/SDL_video.h ==> SDL2-2.0.1/include/SDL_rect.h

#IFNDEF _SDL_rect_h
#DEFINE _SDL_rect_h

TYPE SDL_Point
	AS INTEGER x
	AS INTEGER y
END TYPE

TYPE SDL_Rect
	AS INTEGER x, y
	AS INTEGER w, h
END TYPE

DECLARE FUNCTION SDL_HasIntersection(BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST SDL_Rect PTR) AS SDL_bool
DECLARE FUNCTION SDL_IntersectRect(BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS SDL_Rect PTR) AS SDL_bool
DECLARE SUB SDL_UnionRect(BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS SDL_Rect PTR)
DECLARE FUNCTION SDL_EnclosePoints(BYVAL AS CONST SDL_Point PTR, BYVAL AS INTEGER, BYVAL AS CONST SDL_Rect PTR, BYVAL AS SDL_Rect PTR) AS SDL_bool
DECLARE FUNCTION SDL_IntersectRectAndLine(BYVAL AS CONST SDL_Rect PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS SDL_bool

#ENDIF ' _SDL_rect_h

' 004 back from SDL2-2.0.1/include/SDL_rect.h ==> SDL2-2.0.1/include/SDL_video.h
' 004 start from: SDL2-2.0.1/include/SDL_video.h ==> SDL2-2.0.1/include/SDL_surface.h

#IFNDEF _SDL_surface_h
#DEFINE _SDL_surface_h

' 005 start from: SDL2-2.0.1/include/SDL_surface.h ==> SDL2-2.0.1/include/SDL_blendmode.h

#IFNDEF _SDL_blendmode_h
#DEFINE _SDL_blendmode_h

ENUM SDL_BlendMode
	SDL_BLENDMODE_NONE = &h00000000
	SDL_BLENDMODE_BLEND = &h00000001
	SDL_BLENDMODE_ADD = &h00000002
	SDL_BLENDMODE_MOD = &h00000004
END ENUM

#ENDIF ' _SDL_blendmode_h

' 005 back from SDL2-2.0.1/include/SDL_blendmode.h ==> SDL2-2.0.1/include/SDL_surface.h

#DEFINE SDL_SWSURFACE 0
#DEFINE SDL_PREALLOC &h00000001
#DEFINE SDL_RLEACCEL &h00000002
#DEFINE SDL_DONTFREE &h00000004
#DEFINE SDL_MUSTLOCK(S) (((S)->flags  AND SDL_RLEACCEL)  <> 0)

TYPE SDL_Surface
	AS Uint32 flags
	AS SDL_PixelFormat PTR format
	AS INTEGER w, h
	AS INTEGER pitch
	AS ANY PTR pixels
	AS ANY PTR userdata
	AS INTEGER locked
	AS ANY PTR lock_data
	AS SDL_Rect clip_rect
	AS ANY PTR map
	AS INTEGER refcount
END TYPE

TYPE SDL_blit AS FUNCTION(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR, BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR) AS INTEGER

DECLARE FUNCTION SDL_CreateRGBSurface(BYVAL AS Uint32, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS Uint32, BYVAL AS Uint32, BYVAL AS Uint32, BYVAL AS Uint32) AS SDL_Surface PTR
DECLARE FUNCTION SDL_CreateRGBSurfaceFrom(BYVAL AS ANY PTR, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS Uint32, BYVAL AS Uint32, BYVAL AS Uint32, BYVAL AS Uint32) AS SDL_Surface PTR
DECLARE SUB SDL_FreeSurface(BYVAL AS SDL_Surface PTR)
DECLARE FUNCTION SDL_SetSurfacePalette(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Palette PTR) AS INTEGER
DECLARE FUNCTION SDL_LockSurface(BYVAL AS SDL_Surface PTR) AS INTEGER
DECLARE SUB SDL_UnlockSurface(BYVAL AS SDL_Surface PTR)
DECLARE FUNCTION SDL_LoadBMP_RW(BYVAL AS SDL_RWops PTR, BYVAL AS INTEGER) AS SDL_Surface PTR

#DEFINE SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, @!"rb"), 1)

DECLARE FUNCTION SDL_SaveBMP_RW(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_RWops PTR, BYVAL AS INTEGER) AS INTEGER

#DEFINE SDL_SaveBMP(surface, file) _
        SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, @!"wb"), 1)

DECLARE FUNCTION SDL_SetSurfaceRLE(BYVAL AS SDL_Surface PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_SetColorKey(BYVAL AS SDL_Surface PTR, BYVAL AS INTEGER, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_GetColorKey(BYVAL AS SDL_Surface PTR, BYVAL AS Uint32 PTR) AS INTEGER
DECLARE FUNCTION SDL_SetSurfaceColorMod(BYVAL AS SDL_Surface PTR, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8) AS INTEGER
DECLARE FUNCTION SDL_GetSurfaceColorMod(BYVAL AS SDL_Surface PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR) AS INTEGER
DECLARE FUNCTION SDL_SetSurfaceAlphaMod(BYVAL AS SDL_Surface PTR, BYVAL AS Uint8) AS INTEGER
DECLARE FUNCTION SDL_GetSurfaceAlphaMod(BYVAL AS SDL_Surface PTR, BYVAL AS Uint8 PTR) AS INTEGER
DECLARE FUNCTION SDL_SetSurfaceBlendMode(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_BlendMode) AS INTEGER
DECLARE FUNCTION SDL_GetSurfaceBlendMode(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_BlendMode PTR) AS INTEGER
DECLARE FUNCTION SDL_SetClipRect(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR) AS SDL_bool
DECLARE SUB SDL_GetClipRect(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR)
DECLARE FUNCTION SDL_ConvertSurface(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_PixelFormat PTR, BYVAL AS Uint32) AS SDL_Surface PTR
DECLARE FUNCTION SDL_ConvertSurfaceFormat(BYVAL AS SDL_Surface PTR, BYVAL AS Uint32, BYVAL AS Uint32) AS SDL_Surface PTR
DECLARE FUNCTION SDL_ConvertPixels(BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS Uint32, BYVAL AS CONST ANY PTR, BYVAL AS INTEGER, BYVAL AS Uint32, BYVAL AS ANY PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_FillRect(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_FillRects(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS INTEGER, BYVAL AS Uint32) AS INTEGER

#DEFINE SDL_BlitSurface SDL_UpperBlit

DECLARE FUNCTION SDL_UpperBlit(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_LowerBlit(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR, BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_SoftStretch(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR) AS INTEGER

#DEFINE SDL_BlitScaled SDL_UpperBlitScaled

DECLARE FUNCTION SDL_UpperBlitScaled(BYVAL AS SDL_Surface PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_LowerBlitScaled(BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR, BYVAL AS SDL_Surface PTR, BYVAL AS SDL_Rect PTR) AS INTEGER

#ENDIF ' _SDL_surface_h

' 004 back from SDL2-2.0.1/include/SDL_surface.h ==> SDL2-2.0.1/include/SDL_video.h

TYPE SDL_DisplayMode
	AS Uint32 format
	AS INTEGER w
	AS INTEGER h
	AS INTEGER refresh_rate
	AS ANY PTR driverdata
END TYPE

TYPE SDL_Window AS SDL_Window_

ENUM SDL_WindowFlags
	SDL_WINDOW_FULLSCREEN = &h00000001
	SDL_WINDOW_OPENGL = &h00000002
	SDL_WINDOW_SHOWN = &h00000004
	SDL_WINDOW_HIDDEN = &h00000008
	SDL_WINDOW_BORDERLESS = &h00000010
	SDL_WINDOW_RESIZABLE = &h00000020
	SDL_WINDOW_MINIMIZED = &h00000040
	SDL_WINDOW_MAXIMIZED = &h00000080
	SDL_WINDOW_INPUT_GRABBED = &h00000100
	SDL_WINDOW_INPUT_FOCUS = &h00000200
	SDL_WINDOW_MOUSE_FOCUS = &h00000400
	SDL_WINDOW_FULLSCREEN_DESKTOP = (SDL_WINDOW_FULLSCREEN OR &h00001000)
	SDL_WINDOW_FOREIGN = &h00000800
	SDL_WINDOW_ALLOW_HIGHDPI = &h00002000
END ENUM

#DEFINE SDL_WINDOWPOS_UNDEFINED_MASK &h1FFF0000
#DEFINE SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK OR(X))
#DEFINE SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
#DEFINE SDL_WINDOWPOS_ISUNDEFINED(X) _
            IIF(((X) AND &hFFFF0000) = SDL_WINDOWPOS_UNDEFINED_MASK, SDL_TRUE, SDL_FALSE)
#DEFINE SDL_WINDOWPOS_CENTERED_MASK &h2FFF0000
#DEFINE SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK OR(X))
#DEFINE SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
#DEFINE SDL_WINDOWPOS_ISCENTERED(X) _
            IIF(((X) AND &hFFFF0000) = SDL_WINDOWPOS_CENTERED_MASK, SDL_TRUE, SDL_FALSE)

ENUM SDL_WindowEventID
	SDL_WINDOWEVENT_NONE
	SDL_WINDOWEVENT_SHOWN
	SDL_WINDOWEVENT_HIDDEN
	SDL_WINDOWEVENT_EXPOSED
	SDL_WINDOWEVENT_MOVED
	SDL_WINDOWEVENT_RESIZED
	SDL_WINDOWEVENT_SIZE_CHANGED
	SDL_WINDOWEVENT_MINIMIZED
	SDL_WINDOWEVENT_MAXIMIZED
	SDL_WINDOWEVENT_RESTORED
	SDL_WINDOWEVENT_ENTER
	SDL_WINDOWEVENT_LEAVE
	SDL_WINDOWEVENT_FOCUS_GAINED
	SDL_WINDOWEVENT_FOCUS_LOST
	SDL_WINDOWEVENT_CLOSE
END ENUM

TYPE AS ANY PTR SDL_GLContext

ENUM SDL_GLattr
	SDL_GL_RED_SIZE
	SDL_GL_GREEN_SIZE
	SDL_GL_BLUE_SIZE
	SDL_GL_ALPHA_SIZE
	SDL_GL_BUFFER_SIZE
	SDL_GL_DOUBLEBUFFER
	SDL_GL_DEPTH_SIZE
	SDL_GL_STENCIL_SIZE
	SDL_GL_ACCUM_RED_SIZE
	SDL_GL_ACCUM_GREEN_SIZE
	SDL_GL_ACCUM_BLUE_SIZE
	SDL_GL_ACCUM_ALPHA_SIZE
	SDL_GL_STEREO
	SDL_GL_MULTISAMPLEBUFFERS
	SDL_GL_MULTISAMPLESAMPLES
	SDL_GL_ACCELERATED_VISUAL
	SDL_GL_RETAINED_BACKING
	SDL_GL_CONTEXT_MAJOR_VERSION
	SDL_GL_CONTEXT_MINOR_VERSION
	SDL_GL_CONTEXT_EGL
	SDL_GL_CONTEXT_FLAGS
	SDL_GL_CONTEXT_PROFILE_MASK
	SDL_GL_SHARE_WITH_CURRENT_CONTEXT
	SDL_GL_FRAMEBUFFER_SRGB_CAPABLE
END ENUM

ENUM SDL_GLprofile
	SDL_GL_CONTEXT_PROFILE_CORE = &h0001
	SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = &h0002
	SDL_GL_CONTEXT_PROFILE_ES = &h0004
END ENUM

ENUM SDL_GLcontextFlag
	SDL_GL_CONTEXT_DEBUG_FLAG = &h0001
	SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = &h0002
	SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = &h0004
	SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = &h0008
END ENUM

DECLARE FUNCTION SDL_GetNumVideoDrivers() AS INTEGER
DECLARE FUNCTION SDL_GetVideoDriver(BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_VideoInit(BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE SUB SDL_VideoQuit()
DECLARE FUNCTION SDL_GetCurrentVideoDriver() AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GetNumVideoDisplays() AS INTEGER
DECLARE FUNCTION SDL_GetDisplayName(BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GetDisplayBounds(BYVAL AS INTEGER, BYVAL AS SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_GetNumDisplayModes(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_GetDisplayMode(BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS SDL_DisplayMode PTR) AS INTEGER
DECLARE FUNCTION SDL_GetDesktopDisplayMode(BYVAL AS INTEGER, BYVAL AS SDL_DisplayMode PTR) AS INTEGER
DECLARE FUNCTION SDL_GetCurrentDisplayMode(BYVAL AS INTEGER, BYVAL AS SDL_DisplayMode PTR) AS INTEGER
DECLARE FUNCTION SDL_GetClosestDisplayMode(BYVAL AS INTEGER, BYVAL AS CONST SDL_DisplayMode PTR, BYVAL AS SDL_DisplayMode PTR) AS SDL_DisplayMode PTR
DECLARE FUNCTION SDL_GetWindowDisplayIndex(BYVAL AS SDL_Window PTR) AS INTEGER
DECLARE FUNCTION SDL_SetWindowDisplayMode(BYVAL AS SDL_Window PTR, BYVAL AS CONST SDL_DisplayMode PTR) AS INTEGER
DECLARE FUNCTION SDL_GetWindowDisplayMode(BYVAL AS SDL_Window PTR, BYVAL AS SDL_DisplayMode PTR) AS INTEGER
DECLARE FUNCTION SDL_GetWindowPixelFormat(BYVAL AS SDL_Window PTR) AS Uint32
DECLARE FUNCTION SDL_CreateWindow(BYVAL AS CONST ZSTRING PTR, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS Uint32) AS SDL_Window PTR
DECLARE FUNCTION SDL_CreateWindowFrom(BYVAL AS CONST ANY PTR) AS SDL_Window PTR
DECLARE FUNCTION SDL_GetWindowID(BYVAL AS SDL_Window PTR) AS Uint32
DECLARE FUNCTION SDL_GetWindowFromID(BYVAL AS Uint32) AS SDL_Window PTR
DECLARE FUNCTION SDL_GetWindowFlags(BYVAL AS SDL_Window PTR) AS Uint32
DECLARE SUB SDL_SetWindowTitle(BYVAL AS SDL_Window PTR, BYVAL AS CONST ZSTRING PTR)
DECLARE FUNCTION SDL_GetWindowTitle(BYVAL AS SDL_Window PTR) AS CONST ZSTRING PTR
DECLARE SUB SDL_SetWindowIcon(BYVAL AS SDL_Window PTR, BYVAL AS SDL_Surface PTR)
DECLARE FUNCTION SDL_SetWindowData(BYVAL AS SDL_Window PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS ANY PTR) AS ANY PTR
DECLARE FUNCTION SDL_GetWindowData(BYVAL AS SDL_Window PTR, BYVAL AS CONST ZSTRING PTR) AS ANY PTR
DECLARE SUB SDL_SetWindowPosition(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS INTEGER)
DECLARE SUB SDL_GetWindowPosition(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR)
DECLARE SUB SDL_SetWindowSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS INTEGER)
DECLARE SUB SDL_GetWindowSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR)
DECLARE SUB SDL_SetWindowMinimumSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS INTEGER)
DECLARE SUB SDL_GetWindowMinimumSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR)
DECLARE SUB SDL_SetWindowMaximumSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS INTEGER)
DECLARE SUB SDL_GetWindowMaximumSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR)
DECLARE SUB SDL_SetWindowBordered(BYVAL AS SDL_Window PTR, BYVAL AS SDL_bool)
DECLARE SUB SDL_ShowWindow(BYVAL AS SDL_Window PTR)
DECLARE SUB SDL_HideWindow(BYVAL AS SDL_Window PTR)
DECLARE SUB SDL_RaiseWindow(BYVAL AS SDL_Window PTR)
DECLARE SUB SDL_MaximizeWindow(BYVAL AS SDL_Window PTR)
DECLARE SUB SDL_MinimizeWindow(BYVAL AS SDL_Window PTR)
DECLARE SUB SDL_RestoreWindow(BYVAL AS SDL_Window PTR)
DECLARE FUNCTION SDL_SetWindowFullscreen(BYVAL AS SDL_Window PTR, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_GetWindowSurface(BYVAL AS SDL_Window PTR) AS SDL_Surface PTR
DECLARE FUNCTION SDL_UpdateWindowSurface(BYVAL AS SDL_Window PTR) AS INTEGER
DECLARE FUNCTION SDL_UpdateWindowSurfaceRects(BYVAL AS SDL_Window PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_SetWindowGrab(BYVAL AS SDL_Window PTR, BYVAL AS SDL_bool)
DECLARE FUNCTION SDL_GetWindowGrab(BYVAL AS SDL_Window PTR) AS SDL_bool
DECLARE FUNCTION SDL_SetWindowBrightness(BYVAL AS SDL_Window PTR, BYVAL AS SINGLE) AS INTEGER
DECLARE FUNCTION SDL_GetWindowBrightness(BYVAL AS SDL_Window PTR) AS SINGLE
DECLARE FUNCTION SDL_SetWindowGammaRamp(BYVAL AS SDL_Window PTR, BYVAL AS CONST Uint16 PTR, BYVAL AS CONST Uint16 PTR, BYVAL AS CONST Uint16 PTR) AS INTEGER
DECLARE FUNCTION SDL_GetWindowGammaRamp(BYVAL AS SDL_Window PTR, BYVAL AS Uint16 PTR, BYVAL AS Uint16 PTR, BYVAL AS Uint16 PTR) AS INTEGER
DECLARE SUB SDL_DestroyWindow(BYVAL AS SDL_Window PTR)
DECLARE FUNCTION SDL_IsScreenSaverEnabled() AS SDL_bool
DECLARE SUB SDL_EnableScreenSaver()
DECLARE SUB SDL_DisableScreenSaver()
DECLARE FUNCTION SDL_GL_LoadLibrary(BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE FUNCTION SDL_GL_GetProcAddress(BYVAL AS CONST ZSTRING PTR) AS ANY PTR
DECLARE SUB SDL_GL_UnloadLibrary()
DECLARE FUNCTION SDL_GL_ExtensionSupported(BYVAL AS CONST ZSTRING PTR) AS SDL_bool
DECLARE FUNCTION SDL_GL_SetAttribute(BYVAL AS SDL_GLattr, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_GL_GetAttribute(BYVAL AS SDL_GLattr, BYVAL AS INTEGER PTR) AS INTEGER
DECLARE FUNCTION SDL_GL_CreateContext(BYVAL AS SDL_Window PTR) AS SDL_GLContext
DECLARE FUNCTION SDL_GL_MakeCurrent(BYVAL AS SDL_Window PTR, BYVAL AS SDL_GLContext) AS INTEGER
DECLARE FUNCTION SDL_GL_GetCurrentWindow() AS SDL_Window PTR
DECLARE FUNCTION SDL_GL_GetCurrentContext() AS SDL_GLContext
DECLARE SUB SDL_GL_GetDrawableSize(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR)
DECLARE FUNCTION SDL_GL_SetSwapInterval(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_GL_GetSwapInterval() AS INTEGER
DECLARE SUB SDL_GL_SwapWindow(BYVAL AS SDL_Window PTR)
DECLARE SUB SDL_GL_DeleteContext(BYVAL AS SDL_GLContext)

#ENDIF ' _SDL_video_h

' 003 back from SDL2-2.0.1/include/SDL_video.h ==> SDL2-2.0.1/include/SDL_events.h
' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_keyboard.h

#IFNDEF _SDL_keyboard_h
#DEFINE _SDL_keyboard_h

' 004 start from: SDL2-2.0.1/include/SDL_keyboard.h ==> SDL2-2.0.1/include/SDL_keycode.h

#IFNDEF _SDL_keycode_h
#DEFINE _SDL_keycode_h

' 005 start from: SDL2-2.0.1/include/SDL_keycode.h ==> SDL2-2.0.1/include/SDL_scancode.h

#IFNDEF _SDL_scancode_h
#DEFINE _SDL_scancode_h

ENUM SDL_Scancode
	SDL_SCANCODE_UNKNOWN = 0
	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
	SDL_SCANCODE_NONUSHASH = 50
	SDL_SCANCODE_SEMICOLON = 51
	SDL_SCANCODE_APOSTROPHE = 52
	SDL_SCANCODE_GRAVE = 53
	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
	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
	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
	SDL_SCANCODE_APPLICATION = 101
	SDL_SCANCODE_POWER = 102
	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
	SDL_SCANCODE_MENU = 118
	SDL_SCANCODE_SELECT = 119
	SDL_SCANCODE_STOP = 120
	SDL_SCANCODE_AGAIN = 121
	SDL_SCANCODE_UNDO = 122
	SDL_SCANCODE_CUT = 123
	SDL_SCANCODE_COPY = 124
	SDL_SCANCODE_PASTE = 125
	SDL_SCANCODE_FIND = 126
	SDL_SCANCODE_MUTE = 127
	SDL_SCANCODE_VOLUMEUP = 128
	SDL_SCANCODE_VOLUMEDOWN = 129
	SDL_SCANCODE_KP_COMMA = 133
	SDL_SCANCODE_KP_EQUALSAS400 = 134
	SDL_SCANCODE_INTERNATIONAL1 = 135
	SDL_SCANCODE_INTERNATIONAL2 = 136
	SDL_SCANCODE_INTERNATIONAL3 = 137
	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
	SDL_SCANCODE_LANG2 = 145
	SDL_SCANCODE_LANG3 = 146
	SDL_SCANCODE_LANG4 = 147
	SDL_SCANCODE_LANG5 = 148
	SDL_SCANCODE_LANG6 = 149
	SDL_SCANCODE_LANG7 = 150
	SDL_SCANCODE_LANG8 = 151
	SDL_SCANCODE_LANG9 = 152
	SDL_SCANCODE_ALTERASE = 153
	SDL_SCANCODE_SYSREQ = 154
	SDL_SCANCODE_CANCEL = 155
	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
	SDL_SCANCODE_LGUI = 227
	SDL_SCANCODE_RCTRL = 228
	SDL_SCANCODE_RSHIFT = 229
	SDL_SCANCODE_RALT = 230
	SDL_SCANCODE_RGUI = 231
	SDL_SCANCODE_MODE = 257
	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
	SDL_SCANCODE_MAIL = 265
	SDL_SCANCODE_CALCULATOR = 266
	SDL_SCANCODE_COMPUTER = 267
	SDL_SCANCODE_AC_SEARCH = 268
	SDL_SCANCODE_AC_HOME = 269
	SDL_SCANCODE_AC_BACK = 270
	SDL_SCANCODE_AC_FORWARD = 271
	SDL_SCANCODE_AC_STOP = 272
	SDL_SCANCODE_AC_REFRESH = 273
	SDL_SCANCODE_AC_BOOKMARKS = 274
	SDL_SCANCODE_BRIGHTNESSDOWN = 275
	SDL_SCANCODE_BRIGHTNESSUP = 276
	SDL_SCANCODE_DISPLAYSWITCH = 277
	SDL_SCANCODE_KBDILLUMTOGGLE = 278
	SDL_SCANCODE_KBDILLUMDOWN = 279
	SDL_SCANCODE_KBDILLUMUP = 280
	SDL_SCANCODE_EJECT = 281
	SDL_SCANCODE_SLEEP = 282
	SDL_SCANCODE_APP1 = 283
	SDL_SCANCODE_APP2 = 284
	SDL_NUM_SCANCODES = 512
END ENUM

#ENDIF ' _SDL_scancode_h

' 005 back from SDL2-2.0.1/include/SDL_scancode.h ==> SDL2-2.0.1/include/SDL_keycode.h

TYPE SDL_Keycode AS Sint32

#DEFINE SDLK_SCANCODE_MASK (1 SHL 30)
#DEFINE SDL_SCANCODE_TO_KEYCODE(X) (X OR SDLK_SCANCODE_MASK)

ENUM
	SDLK_UNKNOWN = 0
	SDLK_RETURN = ASC(!"\r")
	SDLK_ESCAPE = ASC(!"\&o033")
	SDLK_BACKSPACE = ASC(!"\b")
	SDLK_TAB = ASC(!"\t")
	SDLK_SPACE = ASC(!" ")
	SDLK_EXCLAIM = ASC(!"!")
	SDLK_QUOTEDBL = ASC(!"\"")
	SDLK_HASH = ASC(!"#")
	SDLK_PERCENT = ASC(!"%")
	SDLK_DOLLAR = ASC(!"$")
	SDLK_AMPERSAND = ASC(!"&")
	SDLK_QUOTE = ASC(!"\'")
	SDLK_LEFTPAREN = ASC(!"(")
	SDLK_RIGHTPAREN = ASC(!")")
	SDLK_ASTERISK = ASC(!"*")
	SDLK_PLUS = ASC(!"+")
	SDLK_COMMA = ASC(!",")
	SDLK_MINUS = ASC(!"-")
	SDLK_PERIOD = ASC(!".")
	SDLK_SLASH = ASC(!"/")
	SDLK_0 = ASC(!"0")
	SDLK_1 = ASC(!"1")
	SDLK_2 = ASC(!"2")
	SDLK_3 = ASC(!"3")
	SDLK_4 = ASC(!"4")
	SDLK_5 = ASC(!"5")
	SDLK_6 = ASC(!"6")
	SDLK_7 = ASC(!"7")
	SDLK_8 = ASC(!"8")
	SDLK_9 = ASC(!"9")
	SDLK_COLON = ASC(!":")
	SDLK_SEMICOLON = ASC(!";")
	SDLK_LESS = ASC(!"<")
	SDLK_EQUALS = ASC(!"=")
	SDLK_GREATER = ASC(!">")
	SDLK_QUESTION = ASC(!"?")
	SDLK_AT = ASC(!"@")
	SDLK_LEFTBRACKET = ASC(!"[")
	SDLK_BACKSLASH = ASC(!"\\")
	SDLK_RIGHTBRACKET = ASC(!"]")
	SDLK_CARET = ASC(!"^")
	SDLK_UNDERSCORE = ASC(!"_")
	SDLK_BACKQUOTE = ASC(!"`")
	SDLK_a = ASC(!"a")
	SDLK_b = ASC(!"b")
	SDLK_c = ASC(!"c")
	SDLK_d = ASC(!"d")
	SDLK_e = ASC(!"e")
	SDLK_f = ASC(!"f")
	SDLK_g = ASC(!"g")
	SDLK_h = ASC(!"h")
	SDLK_i = ASC(!"i")
	SDLK_j = ASC(!"j")
	SDLK_k = ASC(!"k")
	SDLK_l = ASC(!"l")
	SDLK_m = ASC(!"m")
	SDLK_n = ASC(!"n")
	SDLK_o = ASC(!"o")
	SDLK_p = ASC(!"p")
	SDLK_q = ASC(!"q")
	SDLK_r = ASC(!"r")
	SDLK_s = ASC(!"s")
	SDLK_t = ASC(!"t")
	SDLK_u = ASC(!"u")
	SDLK_v = ASC(!"v")
	SDLK_w = ASC(!"w")
	SDLK_x = ASC(!"x")
	SDLK_y = ASC(!"y")
	SDLK_z = ASC(!"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 = ASC(!"\&o177")
	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)
END ENUM

ENUM SDL_Keymod
	KMOD_NONE = &h0000
	KMOD_LSHIFT = &h0001
	KMOD_RSHIFT = &h0002
	KMOD_LCTRL = &h0040
	KMOD_RCTRL = &h0080
	KMOD_LALT = &h0100
	KMOD_RALT = &h0200
	KMOD_LGUI = &h0400
	KMOD_RGUI = &h0800
	KMOD_NUM = &h1000
	KMOD_CAPS = &h2000
	KMOD_MODE = &h4000
	KMOD_RESERVED = &h8000
END ENUM

#DEFINE KMOD_CTRL (KMOD_LCTRL ORKMOD_RCTRL)
#DEFINE KMOD_SHIFT (KMOD_LSHIFT ORKMOD_RSHIFT)
#DEFINE KMOD_ALT (KMOD_LALT ORKMOD_RALT)
#DEFINE KMOD_GUI (KMOD_LGUI ORKMOD_RGUI)
#ENDIF ' _SDL_keycode_h

' 004 back from SDL2-2.0.1/include/SDL_keycode.h ==> SDL2-2.0.1/include/SDL_keyboard.h

TYPE SDL_Keysym
	AS SDL_Scancode scancode
	AS SDL_Keycode sym
	AS Uint16 mod_
	AS Uint32 unused
END TYPE

DECLARE FUNCTION SDL_GetKeyboardFocus() AS SDL_Window PTR
DECLARE FUNCTION SDL_GetKeyboardState(BYVAL AS INTEGER PTR) AS CONST Uint8 PTR
DECLARE FUNCTION SDL_GetModState() AS SDL_Keymod
DECLARE SUB SDL_SetModState(BYVAL AS SDL_Keymod)
DECLARE FUNCTION SDL_GetKeyFromScancode(BYVAL AS SDL_Scancode) AS SDL_Keycode
DECLARE FUNCTION SDL_GetScancodeFromKey(BYVAL AS SDL_Keycode) AS SDL_Scancode
DECLARE FUNCTION SDL_GetScancodeName(BYVAL AS SDL_Scancode) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GetScancodeFromName(BYVAL AS CONST ZSTRING PTR) AS SDL_Scancode
DECLARE FUNCTION SDL_GetKeyName(BYVAL AS SDL_Keycode) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GetKeyFromName(BYVAL AS CONST ZSTRING PTR) AS SDL_Keycode
DECLARE SUB SDL_StartTextInput()
DECLARE FUNCTION SDL_IsTextInputActive() AS SDL_bool
DECLARE SUB SDL_StopTextInput()
DECLARE SUB SDL_SetTextInputRect(BYVAL AS SDL_Rect PTR)
DECLARE FUNCTION SDL_HasScreenKeyboardSupport() AS SDL_bool
DECLARE FUNCTION SDL_IsScreenKeyboardShown(BYVAL AS SDL_Window PTR) AS SDL_bool

#ENDIF ' _SDL_keyboard_h

' 003 back from SDL2-2.0.1/include/SDL_keyboard.h ==> SDL2-2.0.1/include/SDL_events.h
' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_mouse.h

#IFNDEF _SDL_mouse_h
#DEFINE _SDL_mouse_h

TYPE SDL_Cursor AS SDL_Cursor_

ENUM SDL_SystemCursor
	SDL_SYSTEM_CURSOR_ARROW
	SDL_SYSTEM_CURSOR_IBEAM
	SDL_SYSTEM_CURSOR_WAIT
	SDL_SYSTEM_CURSOR_CROSSHAIR
	SDL_SYSTEM_CURSOR_WAITARROW
	SDL_SYSTEM_CURSOR_SIZENWSE
	SDL_SYSTEM_CURSOR_SIZENESW
	SDL_SYSTEM_CURSOR_SIZEWE
	SDL_SYSTEM_CURSOR_SIZENS
	SDL_SYSTEM_CURSOR_SIZEALL
	SDL_SYSTEM_CURSOR_NO
	SDL_SYSTEM_CURSOR_HAND
	SDL_NUM_SYSTEM_CURSORS
END ENUM

DECLARE FUNCTION SDL_GetMouseFocus() AS SDL_Window PTR
DECLARE FUNCTION SDL_GetMouseState(BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS Uint32
DECLARE FUNCTION SDL_GetRelativeMouseState(BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS Uint32
DECLARE SUB SDL_WarpMouseInWindow(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS INTEGER)
DECLARE FUNCTION SDL_SetRelativeMouseMode(BYVAL AS SDL_bool) AS INTEGER
DECLARE FUNCTION SDL_GetRelativeMouseMode() AS SDL_bool
DECLARE FUNCTION SDL_CreateCursor(BYVAL AS CONST Uint8 PTR, BYVAL AS CONST Uint8 PTR, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER) AS SDL_Cursor PTR
DECLARE FUNCTION SDL_CreateColorCursor(BYVAL AS SDL_Surface PTR, BYVAL AS INTEGER, BYVAL AS INTEGER) AS SDL_Cursor PTR
DECLARE FUNCTION SDL_CreateSystemCursor(BYVAL AS SDL_SystemCursor) AS SDL_Cursor PTR
DECLARE SUB SDL_SetCursor(BYVAL AS SDL_Cursor PTR)
DECLARE FUNCTION SDL_GetCursor() AS SDL_Cursor PTR
DECLARE FUNCTION SDL_GetDefaultCursor() AS SDL_Cursor PTR
DECLARE SUB SDL_FreeCursor(BYVAL AS SDL_Cursor PTR)
DECLARE FUNCTION SDL_ShowCursor(BYVAL AS INTEGER) AS INTEGER

#DEFINE SDL_BUTTON(X) (1 SHL ((X) - 1))
#DEFINE SDL_BUTTON_LEFT 1
#DEFINE SDL_BUTTON_MIDDLE 2
#DEFINE SDL_BUTTON_RIGHT 3
#DEFINE SDL_BUTTON_X1 4
#DEFINE SDL_BUTTON_X2 5
#DEFINE SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#DEFINE SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#DEFINE SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
#DEFINE SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1)
#DEFINE SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2)

#ENDIF ' _SDL_mouse_h

' 003 back from SDL2-2.0.1/include/SDL_mouse.h ==> SDL2-2.0.1/include/SDL_events.h
' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_joystick.h

#IFNDEF _SDL_joystick_h
#DEFINE _SDL_joystick_h

TYPE SDL_Joystick AS SDL_Joystick_

TYPE SDL_JoystickGUID
	AS Uint8 data(15)
END TYPE

TYPE SDL_JoystickID AS Sint32

DECLARE FUNCTION SDL_NumJoysticks() AS INTEGER
DECLARE FUNCTION SDL_JoystickNameForIndex(BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_JoystickOpen(BYVAL AS INTEGER) AS SDL_Joystick PTR
DECLARE FUNCTION SDL_JoystickName(BYVAL AS SDL_Joystick PTR) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_JoystickGetDeviceGUID(BYVAL AS INTEGER) AS SDL_JoystickGUID
DECLARE FUNCTION SDL_JoystickGetGUID(BYVAL AS SDL_Joystick PTR) AS SDL_JoystickGUID
DECLARE SUB SDL_JoystickGetGUIDString(BYVAL AS SDL_JoystickGUID, BYVAL AS ZSTRING PTR, BYVAL AS INTEGER)
DECLARE FUNCTION SDL_JoystickGetGUIDFromString(BYVAL AS CONST ZSTRING PTR) AS SDL_JoystickGUID
DECLARE FUNCTION SDL_JoystickGetAttached(BYVAL AS SDL_Joystick PTR) AS SDL_bool
DECLARE FUNCTION SDL_JoystickInstanceID(BYVAL AS SDL_Joystick PTR) AS SDL_JoystickID
DECLARE FUNCTION SDL_JoystickNumAxes(BYVAL AS SDL_Joystick PTR) AS INTEGER
DECLARE FUNCTION SDL_JoystickNumBalls(BYVAL AS SDL_Joystick PTR) AS INTEGER
DECLARE FUNCTION SDL_JoystickNumHats(BYVAL AS SDL_Joystick PTR) AS INTEGER
DECLARE FUNCTION SDL_JoystickNumButtons(BYVAL AS SDL_Joystick PTR) AS INTEGER
DECLARE SUB SDL_JoystickUpdate()
DECLARE FUNCTION SDL_JoystickEventState(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_JoystickGetAxis(BYVAL AS SDL_Joystick PTR, BYVAL AS INTEGER) AS Sint16

#DEFINE SDL_HAT_CENTERED &h00
#DEFINE SDL_HAT_UP &h01
#DEFINE SDL_HAT_RIGHT &h02
#DEFINE SDL_HAT_DOWN &h04
#DEFINE SDL_HAT_LEFT &h08
#DEFINE SDL_HAT_RIGHTUP (SDL_HAT_RIGHT OR SDL_HAT_UP)
#DEFINE SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT OR SDL_HAT_DOWN)
#DEFINE SDL_HAT_LEFTUP (SDL_HAT_LEFT OR SDL_HAT_UP)
#DEFINE SDL_HAT_LEFTDOWN (SDL_HAT_LEFT OR SDL_HAT_DOWN)

DECLARE FUNCTION SDL_JoystickGetHat(BYVAL AS SDL_Joystick PTR, BYVAL AS INTEGER) AS Uint8
DECLARE FUNCTION SDL_JoystickGetBall(BYVAL AS SDL_Joystick PTR, BYVAL AS INTEGER, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS INTEGER
DECLARE FUNCTION SDL_JoystickGetButton(BYVAL AS SDL_Joystick PTR, BYVAL AS INTEGER) AS Uint8
DECLARE SUB SDL_JoystickClose(BYVAL AS SDL_Joystick PTR)

#ENDIF ' _SDL_joystick_h

' 003 back from SDL2-2.0.1/include/SDL_joystick.h ==> SDL2-2.0.1/include/SDL_events.h
' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_gamecontroller.h

#IFNDEF _SDL_gamecontroller_h
#DEFINE _SDL_gamecontroller_h

TYPE SDL_GameController AS SDL_GameController_

ENUM SDL_GameControllerBindType
	SDL_CONTROLLER_BINDTYPE_NONE = 0
	SDL_CONTROLLER_BINDTYPE_BUTTON
	SDL_CONTROLLER_BINDTYPE_AXIS
	SDL_CONTROLLER_BINDTYPE_HAT
END ENUM

TYPE SDL_GameControllerButtonBind_hat
	AS INTEGER hat
	AS INTEGER hat_mask
END TYPE

UNION SDL_GameControllerButtonBind_value
	AS INTEGER button
	AS INTEGER axis
	AS SDL_GameControllerButtonBind_hat hat
END UNION

TYPE SDL_GameControllerButtonBind
	AS SDL_GameControllerBindType bindType
	AS SDL_GameControllerButtonBind_value value
END TYPE

DECLARE FUNCTION SDL_GameControllerAddMapping(BYVAL AS CONST ZSTRING PTR) AS INTEGER
DECLARE FUNCTION SDL_GameControllerMappingForGUID(BYVAL AS SDL_JoystickGUID) AS ZSTRING PTR
DECLARE FUNCTION SDL_GameControllerMapping(BYVAL AS SDL_GameController PTR) AS ZSTRING PTR
DECLARE FUNCTION SDL_IsGameController(BYVAL AS INTEGER) AS SDL_bool
DECLARE FUNCTION SDL_GameControllerNameForIndex(BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GameControllerOpen(BYVAL AS INTEGER) AS SDL_GameController PTR
DECLARE FUNCTION SDL_GameControllerName(BYVAL AS SDL_GameController PTR) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GameControllerGetAttached(BYVAL AS SDL_GameController PTR) AS SDL_bool
DECLARE FUNCTION SDL_GameControllerGetJoystick(BYVAL AS SDL_GameController PTR) AS SDL_Joystick PTR
DECLARE FUNCTION SDL_GameControllerEventState(BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_GameControllerUpdate()

ENUM SDL_GameControllerAxis
	SDL_CONTROLLER_AXIS_INVALID = -1
	SDL_CONTROLLER_AXIS_LEFTX
	SDL_CONTROLLER_AXIS_LEFTY
	SDL_CONTROLLER_AXIS_RIGHTX
	SDL_CONTROLLER_AXIS_RIGHTY
	SDL_CONTROLLER_AXIS_TRIGGERLEFT
	SDL_CONTROLLER_AXIS_TRIGGERRIGHT
	SDL_CONTROLLER_AXIS_MAX
END ENUM

DECLARE FUNCTION SDL_GameControllerGetAxisFromString(BYVAL AS CONST ZSTRING PTR) AS SDL_GameControllerAxis
DECLARE FUNCTION SDL_GameControllerGetStringForAxis(BYVAL AS SDL_GameControllerAxis) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GameControllerGetBindForAxis(BYVAL AS SDL_GameController PTR, BYVAL AS SDL_GameControllerAxis) AS SDL_GameControllerButtonBind
DECLARE FUNCTION SDL_GameControllerGetAxis(BYVAL AS SDL_GameController PTR, BYVAL AS SDL_GameControllerAxis) AS Sint16

ENUM SDL_GameControllerButton
	SDL_CONTROLLER_BUTTON_INVALID = -1
	SDL_CONTROLLER_BUTTON_A
	SDL_CONTROLLER_BUTTON_B
	SDL_CONTROLLER_BUTTON_X
	SDL_CONTROLLER_BUTTON_Y
	SDL_CONTROLLER_BUTTON_BACK
	SDL_CONTROLLER_BUTTON_GUIDE
	SDL_CONTROLLER_BUTTON_START
	SDL_CONTROLLER_BUTTON_LEFTSTICK
	SDL_CONTROLLER_BUTTON_RIGHTSTICK
	SDL_CONTROLLER_BUTTON_LEFTSHOULDER
	SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
	SDL_CONTROLLER_BUTTON_DPAD_UP
	SDL_CONTROLLER_BUTTON_DPAD_DOWN
	SDL_CONTROLLER_BUTTON_DPAD_LEFT
	SDL_CONTROLLER_BUTTON_DPAD_RIGHT
	SDL_CONTROLLER_BUTTON_MAX
END ENUM

DECLARE FUNCTION SDL_GameControllerGetButtonFromString(BYVAL AS CONST ZSTRING PTR) AS SDL_GameControllerButton
DECLARE FUNCTION SDL_GameControllerGetStringForButton(BYVAL AS SDL_GameControllerButton) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GameControllerGetBindForButton(BYVAL AS SDL_GameController PTR, BYVAL AS SDL_GameControllerButton) AS SDL_GameControllerButtonBind
DECLARE FUNCTION SDL_GameControllerGetButton(BYVAL AS SDL_GameController PTR, BYVAL AS SDL_GameControllerButton) AS Uint8
DECLARE SUB SDL_GameControllerClose(BYVAL AS SDL_GameController PTR)

#ENDIF ' _SDL_gamecontroller_h

' 003 back from SDL2-2.0.1/include/SDL_gamecontroller.h ==> SDL2-2.0.1/include/SDL_events.h
' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_quit.h

#IFNDEF _SDL_quit_h
#DEFINE _SDL_quit_h

#MACRO SDL_QuitRequested()
 #ERROR Macro SDL_QuitRequested not supported
#ENDMACRO
#ENDIF ' _SDL_quit_h

' 003 back from SDL2-2.0.1/include/SDL_quit.h ==> SDL2-2.0.1/include/SDL_events.h
' 003 start from: SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL_gesture.h

#IFNDEF _SDL_gesture_h
#DEFINE _SDL_gesture_h

' 004 start from: SDL2-2.0.1/include/SDL_gesture.h ==> SDL2-2.0.1/include/SDL_touch.h

#IFNDEF _SDL_touch_h
#DEFINE _SDL_touch_h

TYPE SDL_TouchID AS Sint64
TYPE SDL_FingerID AS Sint64

TYPE SDL_Finger
	AS SDL_FingerID id
	AS SINGLE x
	AS SINGLE y
	AS SINGLE pressure
END TYPE

#DEFINE SDL_TOUCH_MOUSEID (CAST(Uint32, -1))

DECLARE FUNCTION SDL_GetNumTouchDevices() AS INTEGER
DECLARE FUNCTION SDL_GetTouchDevice(BYVAL AS INTEGER) AS SDL_TouchID
DECLARE FUNCTION SDL_GetNumTouchFingers(BYVAL AS SDL_TouchID) AS INTEGER
DECLARE FUNCTION SDL_GetTouchFinger(BYVAL AS SDL_TouchID, BYVAL AS INTEGER) AS SDL_Finger PTR

#ENDIF ' _SDL_touch_h

' 004 back from SDL2-2.0.1/include/SDL_touch.h ==> SDL2-2.0.1/include/SDL_gesture.h

TYPE SDL_GestureID AS Sint64

DECLARE FUNCTION SDL_RecordGesture(BYVAL AS SDL_TouchID) AS INTEGER
DECLARE FUNCTION SDL_SaveAllDollarTemplates(BYVAL AS SDL_RWops PTR) AS INTEGER
DECLARE FUNCTION SDL_SaveDollarTemplate(BYVAL AS SDL_GestureID, BYVAL AS SDL_RWops PTR) AS INTEGER
DECLARE FUNCTION SDL_LoadDollarTemplates(BYVAL AS SDL_TouchID, BYVAL AS SDL_RWops PTR) AS INTEGER

#ENDIF ' _SDL_gesture_h

' 003 back from SDL2-2.0.1/include/SDL_gesture.h ==> SDL2-2.0.1/include/SDL_events.h

#DEFINE SDL_RELEASED 0
#DEFINE SDL_PRESSED 1

ENUM SDL_EventType
	SDL_FIRSTEVENT = 0
	SDL_QUIT_ = &h100
	SDL_APP_TERMINATING
	SDL_APP_LOWMEMORY
	SDL_APP_WILLENTERBACKGROUND
	SDL_APP_DIDENTERBACKGROUND
	SDL_APP_WILLENTERFOREGROUND
	SDL_APP_DIDENTERFOREGROUND
	SDL_WINDOWEVENT = &h200
	SDL_SYSWMEVENT
	SDL_KEYDOWN = &h300
	SDL_KEYUP
	SDL_TEXTEDITING
	SDL_TEXTINPUT
	SDL_MOUSEMOTION = &h400
	SDL_MOUSEBUTTONDOWN
	SDL_MOUSEBUTTONUP
	SDL_MOUSEWHEEL
	SDL_JOYAXISMOTION = &h600
	SDL_JOYBALLMOTION
	SDL_JOYHATMOTION
	SDL_JOYBUTTONDOWN
	SDL_JOYBUTTONUP
	SDL_JOYDEVICEADDED
	SDL_JOYDEVICEREMOVED
	SDL_CONTROLLERAXISMOTION = &h650
	SDL_CONTROLLERBUTTONDOWN
	SDL_CONTROLLERBUTTONUP
	SDL_CONTROLLERDEVICEADDED
	SDL_CONTROLLERDEVICEREMOVED
	SDL_CONTROLLERDEVICEREMAPPED
	SDL_FINGERDOWN = &h700
	SDL_FINGERUP
	SDL_FINGERMOTION
	SDL_DOLLARGESTURE = &h800
	SDL_DOLLARRECORD
	SDL_MULTIGESTURE
	SDL_CLIPBOARDUPDATE = &h900
	SDL_DROPFILE = &h1000
	SDL_USEREVENT = &h8000
	SDL_LASTEVENT = &hFFFF
END ENUM

TYPE SDL_CommonEvent
	AS Uint32 type
	AS Uint32 timestamp
END TYPE

TYPE SDL_WindowEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS Uint8 event
	AS Uint8 padding1
	AS Uint8 padding2
	AS Uint8 padding3
	AS Sint32 data1
	AS Sint32 data2
END TYPE

TYPE SDL_KeyboardEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS Uint8 state
	AS Uint8 repeat
	AS Uint8 padding2
	AS Uint8 padding3
	AS SDL_Keysym keysym
END TYPE

#DEFINE SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)

TYPE SDL_TextEditingEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS UBYTE text(SDL_TEXTEDITINGEVENT_TEXT_SIZE-1)
	AS Sint32 start
	AS Sint32 length
END TYPE

#DEFINE SDL_TEXTINPUTEVENT_TEXT_SIZE (32)

TYPE SDL_TextInputEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS UBYTE text(SDL_TEXTINPUTEVENT_TEXT_SIZE-1)
END TYPE

TYPE SDL_MouseMotionEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS Uint32 which
	AS Uint32 state
	AS Sint32 x
	AS Sint32 y
	AS Sint32 xrel
	AS Sint32 yrel
END TYPE

TYPE SDL_MouseButtonEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS Uint32 which
	AS Uint8 button
	AS Uint8 state
	AS Uint8 padding1
	AS Uint8 padding2
	AS Sint32 x
	AS Sint32 y
END TYPE

TYPE SDL_MouseWheelEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS Uint32 which
	AS Sint32 x
	AS Sint32 y
END TYPE

TYPE SDL_JoyAxisEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_JoystickID which
	AS Uint8 axis
	AS Uint8 padding1
	AS Uint8 padding2
	AS Uint8 padding3
	AS Sint16 value
	AS Uint16 padding4
END TYPE

TYPE SDL_JoyBallEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_JoystickID which
	AS Uint8 ball
	AS Uint8 padding1
	AS Uint8 padding2
	AS Uint8 padding3
	AS Sint16 xrel
	AS Sint16 yrel
END TYPE

TYPE SDL_JoyHatEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_JoystickID which
	AS Uint8 hat
	AS Uint8 value
	AS Uint8 padding1
	AS Uint8 padding2
END TYPE

TYPE SDL_JoyButtonEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_JoystickID which
	AS Uint8 button
	AS Uint8 state
	AS Uint8 padding1
	AS Uint8 padding2
END TYPE

TYPE SDL_JoyDeviceEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Sint32 which
END TYPE

TYPE SDL_ControllerAxisEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_JoystickID which
	AS Uint8 axis
	AS Uint8 padding1
	AS Uint8 padding2
	AS Uint8 padding3
	AS Sint16 value
	AS Uint16 padding4
END TYPE

TYPE SDL_ControllerButtonEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_JoystickID which
	AS Uint8 button
	AS Uint8 state
	AS Uint8 padding1
	AS Uint8 padding2
END TYPE

TYPE SDL_ControllerDeviceEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Sint32 which
END TYPE

TYPE SDL_TouchFingerEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_TouchID touchId
	AS SDL_FingerID fingerId
	AS SINGLE x
	AS SINGLE y
	AS SINGLE dx
	AS SINGLE dy
	AS SINGLE pressure
END TYPE

TYPE SDL_MultiGestureEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_TouchID touchId
	AS SINGLE dTheta
	AS SINGLE dDist
	AS SINGLE x
	AS SINGLE y
	AS Uint16 numFingers
	AS Uint16 padding
END TYPE

TYPE SDL_DollarGestureEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_TouchID touchId
	AS SDL_GestureID gestureId
	AS Uint32 numFingers
	AS SINGLE error
	AS SINGLE x
	AS SINGLE y
END TYPE

TYPE SDL_DropEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS ZSTRING PTR file
END TYPE

TYPE SDL_QuitEvent
	AS Uint32 type
	AS Uint32 timestamp
END TYPE

TYPE SDL_OSEvent
	AS Uint32 type
	AS Uint32 timestamp
END TYPE

TYPE SDL_UserEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS Uint32 windowID
	AS Sint32 code
	AS ANY PTR data1
	AS ANY PTR data2
END TYPE

TYPE SDL_SysWMmsg AS SDL_SysWMmsg_

TYPE SDL_SysWMEvent
	AS Uint32 type
	AS Uint32 timestamp
	AS SDL_SysWMmsg PTR msg
END TYPE

UNION SDL_Event
	AS Uint32 type
	AS SDL_CommonEvent common
	AS SDL_WindowEvent window
	AS SDL_KeyboardEvent key
	AS SDL_TextEditingEvent edit
	AS SDL_TextInputEvent text
	AS SDL_MouseMotionEvent motion
	AS SDL_MouseButtonEvent button
	AS SDL_MouseWheelEvent wheel
	AS SDL_JoyAxisEvent jaxis
	AS SDL_JoyBallEvent jball
	AS SDL_JoyHatEvent jhat
	AS SDL_JoyButtonEvent jbutton
	AS SDL_JoyDeviceEvent jdevice
	AS SDL_ControllerAxisEvent caxis
	AS SDL_ControllerButtonEvent cbutton
	AS SDL_ControllerDeviceEvent cdevice
	AS SDL_QuitEvent quit
	AS SDL_UserEvent user
	AS SDL_SysWMEvent syswm
	AS SDL_TouchFingerEvent tfinger
	AS SDL_MultiGestureEvent mgesture
	AS SDL_DollarGestureEvent dgesture
	AS SDL_DropEvent drop
	AS Uint8 padding(55)
END UNION

DECLARE SUB SDL_PumpEvents()

ENUM SDL_eventaction
	SDL_ADDEVENT
	SDL_PEEKEVENT
	SDL_GETEVENT
END ENUM

DECLARE FUNCTION SDL_PeepEvents(BYVAL AS SDL_Event PTR, BYVAL AS INTEGER, BYVAL AS SDL_eventaction, BYVAL AS Uint32, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_HasEvent(BYVAL AS Uint32) AS SDL_bool
DECLARE FUNCTION SDL_HasEvents(BYVAL AS Uint32, BYVAL AS Uint32) AS SDL_bool
DECLARE SUB SDL_FlushEvent(BYVAL AS Uint32)
DECLARE SUB SDL_FlushEvents(BYVAL AS Uint32, BYVAL AS Uint32)
DECLARE FUNCTION SDL_PollEvent(BYVAL AS SDL_Event PTR) AS INTEGER
DECLARE FUNCTION SDL_WaitEvent(BYVAL AS SDL_Event PTR) AS INTEGER
DECLARE FUNCTION SDL_WaitEventTimeout(BYVAL AS SDL_Event PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_PushEvent(BYVAL AS SDL_Event PTR) AS INTEGER

TYPE SDL_EventFilter AS FUNCTION(BYVAL AS ANY PTR, BYVAL AS SDL_Event PTR) AS INTEGER

DECLARE SUB SDL_SetEventFilter(BYVAL AS SDL_EventFilter, BYVAL AS ANY PTR)
DECLARE FUNCTION SDL_GetEventFilter(BYVAL AS SDL_EventFilter, BYVAL AS ANY PTR PTR) AS SDL_bool
DECLARE SUB SDL_AddEventWatch(BYVAL AS SDL_EventFilter, BYVAL AS ANY PTR)
DECLARE SUB SDL_DelEventWatch(BYVAL AS SDL_EventFilter, BYVAL AS ANY PTR)
DECLARE SUB SDL_FilterEvents(BYVAL AS SDL_EventFilter, BYVAL AS ANY PTR)

#DEFINE SDL_QUERY -1
#DEFINE SDL_IGNORE 0
#DEFINE SDL_DISABLE 0
#DEFINE SDL_ENABLE 1

DECLARE FUNCTION SDL_EventState(BYVAL AS Uint32, BYVAL AS INTEGER) AS Uint8

#DEFINE SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)

DECLARE FUNCTION SDL_RegisterEvents(BYVAL AS INTEGER) AS Uint32

#ENDIF ' _SDL_events_h

' 002 back from SDL2-2.0.1/include/SDL_events.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_filesystem.h

#IFNDEF _SDL_filesystem_h
#DEFINE _SDL_filesystem_h

DECLARE FUNCTION SDL_GetBasePath() AS ZSTRING PTR
DECLARE FUNCTION SDL_GetPrefPath(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS ZSTRING PTR

#ENDIF ' _SDL_filesystem_h

' 002 back from SDL2-2.0.1/include/SDL_filesystem.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_haptic.h

#IFNDEF _SDL_haptic_h
#DEFINE _SDL_haptic_h

TYPE SDL_Haptic AS SDL_Haptic_

#DEFINE SDL_HAPTIC_CONSTANT (1 SHL 0)
#DEFINE SDL_HAPTIC_SINE (1 SHL 1)
#DEFINE SDL_HAPTIC_LEFTRIGHT (1 SHL 2)
#DEFINE SDL_HAPTIC_TRIANGLE (1 SHL 3)
#DEFINE SDL_HAPTIC_SAWTOOTHUP (1 SHL 4)
#DEFINE SDL_HAPTIC_SAWTOOTHDOWN (1 SHL 5)
#DEFINE SDL_HAPTIC_RAMP (1 SHL 6)
#DEFINE SDL_HAPTIC_SPRING (1 SHL 7)
#DEFINE SDL_HAPTIC_DAMPER (1 SHL 8)
#DEFINE SDL_HAPTIC_INERTIA (1 SHL 9)
#DEFINE SDL_HAPTIC_FRICTION (1 SHL 10)
#DEFINE SDL_HAPTIC_CUSTOM (1 SHL 11)
#DEFINE SDL_HAPTIC_GAIN (1 SHL 12)
#DEFINE SDL_HAPTIC_AUTOCENTER (1 SHL 13)
#DEFINE SDL_HAPTIC_STATUS (1 SHL 14)
#DEFINE SDL_HAPTIC_PAUSE (1 SHL 15)
#DEFINE SDL_HAPTIC_POLAR 0
#DEFINE SDL_HAPTIC_CARTESIAN 1
#DEFINE SDL_HAPTIC_SPHERICAL 2
#DEFINE SDL_HAPTIC_INFINITY 4294967295U

TYPE SDL_HapticDirection
	AS Uint8 type
	AS Sint32 dir(2)
END TYPE

TYPE SDL_HapticConstant
	AS Uint16 type
	AS SDL_HapticDirection direction
	AS Uint32 length
	AS Uint16 delay
	AS Uint16 button
	AS Uint16 interval
	AS Sint16 level
	AS Uint16 attack_length
	AS Uint16 attack_level
	AS Uint16 fade_length
	AS Uint16 fade_level
END TYPE

TYPE SDL_HapticPeriodic
	AS Uint16 type
	AS SDL_HapticDirection direction
	AS Uint32 length
	AS Uint16 delay
	AS Uint16 button
	AS Uint16 interval
	AS Uint16 period
	AS Sint16 magnitude
	AS Sint16 offset
	AS Uint16 phase
	AS Uint16 attack_length
	AS Uint16 attack_level
	AS Uint16 fade_length
	AS Uint16 fade_level
END TYPE

TYPE SDL_HapticCondition
	AS Uint16 type
	AS SDL_HapticDirection direction
	AS Uint32 length
	AS Uint16 delay
	AS Uint16 button
	AS Uint16 interval
	AS Uint16 right_sat(2)
	AS Uint16 left_sat(2)
	AS Sint16 right_coeff(2)
	AS Sint16 left_coeff(2)
	AS Uint16 deadband(2)
	AS Sint16 center(2)
END TYPE

TYPE SDL_HapticRamp
	AS Uint16 type
	AS SDL_HapticDirection direction
	AS Uint32 length
	AS Uint16 delay
	AS Uint16 button
	AS Uint16 interval
	AS Sint16 start
	AS Sint16 end
	AS Uint16 attack_length
	AS Uint16 attack_level
	AS Uint16 fade_length
	AS Uint16 fade_level
END TYPE

TYPE SDL_HapticLeftRight
	AS Uint16 type
	AS Uint32 length
	AS Uint16 large_magnitude
	AS Uint16 small_magnitude
END TYPE

TYPE SDL_HapticCustom
	AS Uint16 type
	AS SDL_HapticDirection direction
	AS Uint32 length
	AS Uint16 delay
	AS Uint16 button
	AS Uint16 interval
	AS Uint8 channels
	AS Uint16 period
	AS Uint16 samples
	AS Uint16 PTR data
	AS Uint16 attack_length
	AS Uint16 attack_level
	AS Uint16 fade_length
	AS Uint16 fade_level
END TYPE

UNION SDL_HapticEffect
	AS Uint16 type
	AS SDL_HapticConstant constant
	AS SDL_HapticPeriodic periodic
	AS SDL_HapticCondition condition
	AS SDL_HapticRamp ramp
	AS SDL_HapticLeftRight leftright
	AS SDL_HapticCustom custom
END UNION

DECLARE FUNCTION SDL_NumHaptics() AS INTEGER
DECLARE FUNCTION SDL_HapticName(BYVAL AS INTEGER) AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_HapticOpen(BYVAL AS INTEGER) AS SDL_Haptic PTR
DECLARE FUNCTION SDL_HapticOpened(BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_HapticIndex(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_MouseIsHaptic() AS INTEGER
DECLARE FUNCTION SDL_HapticOpenFromMouse() AS SDL_Haptic PTR
DECLARE FUNCTION SDL_JoystickIsHaptic(BYVAL AS SDL_Joystick PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticOpenFromJoystick(BYVAL AS SDL_Joystick PTR) AS SDL_Haptic PTR
DECLARE SUB SDL_HapticClose(BYVAL AS SDL_Haptic PTR)
DECLARE FUNCTION SDL_HapticNumEffects(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticNumEffectsPlaying(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticQuery(BYVAL AS SDL_Haptic PTR) AS UINTEGER
DECLARE FUNCTION SDL_HapticNumAxes(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticEffectSupported(BYVAL AS SDL_Haptic PTR, BYVAL AS SDL_HapticEffect PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticNewEffect(BYVAL AS SDL_Haptic PTR, BYVAL AS SDL_HapticEffect PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticUpdateEffect(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER, BYVAL AS SDL_HapticEffect PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticRunEffect(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_HapticStopEffect(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_HapticDestroyEffect(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER)
DECLARE FUNCTION SDL_HapticGetEffectStatus(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_HapticSetGain(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_HapticSetAutocenter(BYVAL AS SDL_Haptic PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_HapticPause(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticUnpause(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticStopAll(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticRumbleSupported(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticRumbleInit(BYVAL AS SDL_Haptic PTR) AS INTEGER
DECLARE FUNCTION SDL_HapticRumblePlay(BYVAL AS SDL_Haptic PTR, BYVAL AS SINGLE, BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_HapticRumbleStop(BYVAL AS SDL_Haptic PTR) AS INTEGER

#ENDIF ' _SDL_haptic_h

' 002 back from SDL2-2.0.1/include/SDL_haptic.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_hints.h

#IFNDEF _SDL_hints_h
#DEFINE _SDL_hints_h

#DEFINE SDL_HINT_FRAMEBUFFER_ACCELERATION @!"SDL_FRAMEBUFFER_ACCELERATION"
#DEFINE SDL_HINT_RENDER_DRIVER @!"SDL_RENDER_DRIVER"
#DEFINE SDL_HINT_RENDER_OPENGL_SHADERS @!"SDL_RENDER_OPENGL_SHADERS"
#DEFINE SDL_HINT_RENDER_DIRECT3D_THREADSAFE @!"SDL_RENDER_DIRECT3D_THREADSAFE"
#DEFINE SDL_HINT_RENDER_SCALE_QUALITY @!"SDL_RENDER_SCALE_QUALITY"
#DEFINE SDL_HINT_RENDER_VSYNC @!"SDL_RENDER_VSYNC"
#DEFINE SDL_HINT_VIDEO_X11_XVIDMODE @!"SDL_VIDEO_X11_XVIDMODE"
#DEFINE SDL_HINT_VIDEO_X11_XINERAMA @!"SDL_VIDEO_X11_XINERAMA"
#DEFINE SDL_HINT_VIDEO_X11_XRANDR @!"SDL_VIDEO_X11_XRANDR"
#DEFINE SDL_HINT_GRAB_KEYBOARD @!"SDL_GRAB_KEYBOARD"
#DEFINE SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS @!"SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS"
#DEFINE SDL_HINT_IDLE_TIMER_DISABLED @!"SDL_IOS_IDLE_TIMER_DISABLED"
#DEFINE SDL_HINT_ORIENTATIONS @!"SDL_IOS_ORIENTATIONS"
#DEFINE SDL_HINT_XINPUT_ENABLED @!"SDL_XINPUT_ENABLED"
#DEFINE SDL_HINT_GAMECONTROLLERCONFIG @!"SDL_GAMECONTROLLERCONFIG"
#DEFINE SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS @!"SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
#DEFINE SDL_HINT_ALLOW_TOPMOST @!"SDL_ALLOW_TOPMOST"
#DEFINE SDL_HINT_TIMER_RESOLUTION @!"SDL_TIMER_RESOLUTION"
#DEFINE SDL_HINT_VIDEO_HIGHDPI_DISABLED @!"SDL_VIDEO_HIGHDPI_DISABLED"

ENUM SDL_HintPriority
	SDL_HINT_DEFAULT
	SDL_HINT_NORMAL
	SDL_HINT_OVERRIDE
END ENUM

DECLARE FUNCTION SDL_SetHintWithPriority(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS SDL_HintPriority) AS SDL_bool
DECLARE FUNCTION SDL_SetHint(BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR) AS SDL_bool
DECLARE FUNCTION SDL_GetHint(BYVAL AS CONST ZSTRING PTR) AS CONST ZSTRING PTR

TYPE SDL_HintCallback AS SUB(BYVAL AS ANY PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR)

DECLARE SUB SDL_AddHintCallback(BYVAL AS CONST ZSTRING PTR, BYVAL AS SDL_HintCallback, BYVAL AS ANY PTR)
DECLARE SUB SDL_DelHintCallback(BYVAL AS CONST ZSTRING PTR, BYVAL AS SDL_HintCallback, BYVAL AS ANY PTR)
DECLARE SUB SDL_ClearHints()

#ENDIF ' _SDL_hints_h

' 002 back from SDL2-2.0.1/include/SDL_hints.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_loadso.h

#IFNDEF _SDL_loadso_h
#DEFINE _SDL_loadso_h

DECLARE FUNCTION SDL_LoadObject(BYVAL AS CONST ZSTRING PTR) AS ANY PTR
DECLARE FUNCTION SDL_LoadFunction(BYVAL AS ANY PTR, BYVAL AS CONST ZSTRING PTR) AS ANY PTR
DECLARE SUB SDL_UnloadObject(BYVAL AS ANY PTR)

#ENDIF ' _SDL_loadso_h

' 002 back from SDL2-2.0.1/include/SDL_loadso.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_log.h

#IFNDEF _SDL_log_h
#DEFINE _SDL_log_h

#DEFINE SDL_MAX_LOG_MESSAGE 4096

ENUM
	SDL_LOG_CATEGORY_APPLICATION
	SDL_LOG_CATEGORY_ERROR
	SDL_LOG_CATEGORY_ASSERT
	SDL_LOG_CATEGORY_SYSTEM
	SDL_LOG_CATEGORY_AUDIO
	SDL_LOG_CATEGORY_VIDEO
	SDL_LOG_CATEGORY_RENDER
	SDL_LOG_CATEGORY_INPUT
	SDL_LOG_CATEGORY_TEST
	SDL_LOG_CATEGORY_RESERVED1
	SDL_LOG_CATEGORY_RESERVED2
	SDL_LOG_CATEGORY_RESERVED3
	SDL_LOG_CATEGORY_RESERVED4
	SDL_LOG_CATEGORY_RESERVED5
	SDL_LOG_CATEGORY_RESERVED6
	SDL_LOG_CATEGORY_RESERVED7
	SDL_LOG_CATEGORY_RESERVED8
	SDL_LOG_CATEGORY_RESERVED9
	SDL_LOG_CATEGORY_RESERVED10
	SDL_LOG_CATEGORY_CUSTOM
END ENUM

ENUM SDL_LogPriority
	SDL_LOG_PRIORITY_VERBOSE = 1
	SDL_LOG_PRIORITY_DEBUG
	SDL_LOG_PRIORITY_INFO
	SDL_LOG_PRIORITY_WARN
	SDL_LOG_PRIORITY_ERROR
	SDL_LOG_PRIORITY_CRITICAL
	SDL_NUM_LOG_PRIORITIES
END ENUM

DECLARE SUB SDL_LogSetAllPriority(BYVAL AS SDL_LogPriority)
DECLARE SUB SDL_LogSetPriority(BYVAL AS INTEGER, BYVAL AS SDL_LogPriority)
DECLARE FUNCTION SDL_LogGetPriority(BYVAL AS INTEGER) AS SDL_LogPriority
DECLARE SUB SDL_LogResetPriorities()
DECLARE SUB SDL_Log(BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogVerbose(BYVAL AS INTEGER, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogDebug(BYVAL AS INTEGER, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogInfo(BYVAL AS INTEGER, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogWarn(BYVAL AS INTEGER, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogError(BYVAL AS INTEGER, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogCritical(BYVAL AS INTEGER, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogMessage(BYVAL AS INTEGER, BYVAL AS SDL_LogPriority, BYVAL AS CONST ZSTRING PTR, ...)
DECLARE SUB SDL_LogMessageV(BYVAL AS INTEGER, BYVAL AS SDL_LogPriority, BYVAL AS CONST ZSTRING PTR, BYVAL AS va_list)

TYPE SDL_LogOutputFunction AS SUB(BYVAL AS ANY PTR, BYVAL AS INTEGER, BYVAL AS SDL_LogPriority, BYVAL AS CONST ZSTRING PTR)

DECLARE SUB SDL_LogGetOutputFunction(BYVAL AS SDL_LogOutputFunction, BYVAL AS ANY PTR PTR)
DECLARE SUB SDL_LogSetOutputFunction(BYVAL AS SDL_LogOutputFunction, BYVAL AS ANY PTR)

#ENDIF ' _SDL_log_h

' 002 back from SDL2-2.0.1/include/SDL_log.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_messagebox.h

#IFNDEF _SDL_messagebox_h
#DEFINE _SDL_messagebox_h

ENUM SDL_MessageBoxFlags
	SDL_MESSAGEBOX_ERROR = &h00000010
	SDL_MESSAGEBOX_WARNING = &h00000020
	SDL_MESSAGEBOX_INFORMATION = &h00000040
END ENUM

ENUM SDL_MessageBoxButtonFlags
	SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = &h00000001
	SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = &h00000002
END ENUM

TYPE SDL_MessageBoxButtonData
	AS Uint32 flags
	AS INTEGER buttonid
	AS CONST ZSTRING PTR text
END TYPE

TYPE SDL_MessageBoxColor
	AS Uint8 r, g, b
END TYPE

ENUM SDL_MessageBoxColorType
	SDL_MESSAGEBOX_COLOR_BACKGROUND
	SDL_MESSAGEBOX_COLOR_TEXT
	SDL_MESSAGEBOX_COLOR_BUTTON_BORDER
	SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND
	SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED
	SDL_MESSAGEBOX_COLOR_MAX
END ENUM

TYPE SDL_MessageBoxColorScheme
	AS SDL_MessageBoxColor colors(SDL_MESSAGEBOX_COLOR_MAX-1)
END TYPE

TYPE SDL_MessageBoxData
	AS Uint32 flags
	AS SDL_Window PTR window
	AS CONST ZSTRING PTR title
	AS CONST ZSTRING PTR message
	AS INTEGER numbuttons
	AS CONST SDL_MessageBoxButtonData PTR buttons
	AS CONST SDL_MessageBoxColorScheme PTR colorScheme
END TYPE

DECLARE FUNCTION SDL_ShowMessageBox(BYVAL AS CONST SDL_MessageBoxData PTR, BYVAL AS INTEGER PTR) AS INTEGER
DECLARE FUNCTION SDL_ShowSimpleMessageBox(BYVAL AS Uint32, BYVAL AS CONST ZSTRING PTR, BYVAL AS CONST ZSTRING PTR, BYVAL AS SDL_Window PTR) AS INTEGER

#ENDIF ' _SDL_messagebox_h

' 002 back from SDL2-2.0.1/include/SDL_messagebox.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_power.h

#IFNDEF _SDL_power_h
#DEFINE _SDL_power_h

ENUM SDL_PowerState
	SDL_POWERSTATE_UNKNOWN
	SDL_POWERSTATE_ON_BATTERY
	SDL_POWERSTATE_NO_BATTERY
	SDL_POWERSTATE_CHARGING
	SDL_POWERSTATE_CHARGED
END ENUM

DECLARE FUNCTION SDL_GetPowerInfo(BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS SDL_PowerState

#ENDIF ' _SDL_power_h

' 002 back from SDL2-2.0.1/include/SDL_power.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_render.h

#IFNDEF _SDL_render_h
#DEFINE _SDL_render_h

ENUM SDL_RendererFlags
	SDL_RENDERER_SOFTWARE = &h00000001
	SDL_RENDERER_ACCELERATED = &h00000002
	SDL_RENDERER_PRESENTVSYNC = &h00000004
	SDL_RENDERER_TARGETTEXTURE = &h00000008
END ENUM

TYPE SDL_RendererInfo
	AS CONST ZSTRING PTR name
	AS Uint32 flags
	AS Uint32 num_texture_formats
	AS Uint32 texture_formats(15)
	AS INTEGER max_texture_width
	AS INTEGER max_texture_height
END TYPE

ENUM SDL_TextureAccess
	SDL_TEXTUREACCESS_STATIC
	SDL_TEXTUREACCESS_STREAMING
	SDL_TEXTUREACCESS_TARGET
END ENUM

ENUM SDL_TextureModulate
	SDL_TEXTUREMODULATE_NONE = &h00000000
	SDL_TEXTUREMODULATE_COLOR = &h00000001
	SDL_TEXTUREMODULATE_ALPHA = &h00000002
END ENUM

ENUM SDL_RendererFlip
	SDL_FLIP_NONE = &h00000000
	SDL_FLIP_HORIZONTAL = &h00000001
	SDL_FLIP_VERTICAL = &h00000002
END ENUM

TYPE SDL_Renderer AS SDL_Renderer_
TYPE SDL_Texture AS SDL_Texture_

DECLARE FUNCTION SDL_GetNumRenderDrivers() AS INTEGER
DECLARE FUNCTION SDL_GetRenderDriverInfo(BYVAL AS INTEGER, BYVAL AS SDL_RendererInfo PTR) AS INTEGER
DECLARE FUNCTION SDL_CreateWindowAndRenderer(BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS Uint32, BYVAL AS SDL_Window PTR PTR, BYVAL AS SDL_Renderer PTR PTR) AS INTEGER
DECLARE FUNCTION SDL_CreateRenderer(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS Uint32) AS SDL_Renderer PTR
DECLARE FUNCTION SDL_CreateSoftwareRenderer(BYVAL AS SDL_Surface PTR) AS SDL_Renderer PTR
DECLARE FUNCTION SDL_GetRenderer(BYVAL AS SDL_Window PTR) AS SDL_Renderer PTR
DECLARE FUNCTION SDL_GetRendererInfo(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_RendererInfo PTR) AS INTEGER
DECLARE FUNCTION SDL_GetRendererOutputSize(BYVAL AS SDL_Renderer PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS INTEGER
DECLARE FUNCTION SDL_CreateTexture(BYVAL AS SDL_Renderer PTR, BYVAL AS Uint32, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER) AS SDL_Texture PTR
DECLARE FUNCTION SDL_CreateTextureFromSurface(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_Surface PTR) AS SDL_Texture PTR
DECLARE FUNCTION SDL_QueryTexture(BYVAL AS SDL_Texture PTR, BYVAL AS Uint32 PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR) AS INTEGER
DECLARE FUNCTION SDL_SetTextureColorMod(BYVAL AS SDL_Texture PTR, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8) AS INTEGER
DECLARE FUNCTION SDL_GetTextureColorMod(BYVAL AS SDL_Texture PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR) AS INTEGER
DECLARE FUNCTION SDL_SetTextureAlphaMod(BYVAL AS SDL_Texture PTR, BYVAL AS Uint8) AS INTEGER
DECLARE FUNCTION SDL_GetTextureAlphaMod(BYVAL AS SDL_Texture PTR, BYVAL AS Uint8 PTR) AS INTEGER
DECLARE FUNCTION SDL_SetTextureBlendMode(BYVAL AS SDL_Texture PTR, BYVAL AS SDL_BlendMode) AS INTEGER
DECLARE FUNCTION SDL_GetTextureBlendMode(BYVAL AS SDL_Texture PTR, BYVAL AS SDL_BlendMode PTR) AS INTEGER
DECLARE FUNCTION SDL_UpdateTexture(BYVAL AS SDL_Texture PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST ANY PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_UpdateYUVTexture(BYVAL AS SDL_Texture PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST Uint8 PTR, BYVAL AS INTEGER, BYVAL AS CONST Uint8 PTR, BYVAL AS INTEGER, BYVAL AS CONST Uint8 PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_LockTexture(BYVAL AS SDL_Texture PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS ANY PTR PTR, BYVAL AS INTEGER PTR) AS INTEGER
DECLARE SUB SDL_UnlockTexture(BYVAL AS SDL_Texture PTR)
DECLARE FUNCTION SDL_RenderTargetSupported(BYVAL AS SDL_Renderer PTR) AS SDL_bool
DECLARE FUNCTION SDL_SetRenderTarget(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_Texture PTR) AS INTEGER
DECLARE FUNCTION SDL_GetRenderTarget(BYVAL AS SDL_Renderer PTR) AS SDL_Texture PTR
DECLARE FUNCTION SDL_RenderSetLogicalSize(BYVAL AS SDL_Renderer PTR, BYVAL AS INTEGER, BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_RenderGetLogicalSize(BYVAL AS SDL_Renderer PTR, BYVAL AS INTEGER PTR, BYVAL AS INTEGER PTR)
DECLARE FUNCTION SDL_RenderSetViewport(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR) AS INTEGER
DECLARE SUB SDL_RenderGetViewport(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_Rect PTR)
DECLARE FUNCTION SDL_RenderSetClipRect(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR) AS INTEGER
DECLARE SUB SDL_RenderGetClipRect(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_Rect PTR)
DECLARE FUNCTION SDL_RenderSetScale(BYVAL AS SDL_Renderer PTR, BYVAL AS SINGLE, BYVAL AS SINGLE) AS INTEGER
DECLARE SUB SDL_RenderGetScale(BYVAL AS SDL_Renderer PTR, BYVAL AS SINGLE PTR, BYVAL AS SINGLE PTR)
DECLARE FUNCTION SDL_SetRenderDrawColor(BYVAL AS SDL_Renderer PTR, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8, BYVAL AS Uint8) AS INTEGER
DECLARE FUNCTION SDL_GetRenderDrawColor(BYVAL AS SDL_Renderer PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR, BYVAL AS Uint8 PTR) AS INTEGER
DECLARE FUNCTION SDL_SetRenderDrawBlendMode(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_BlendMode) AS INTEGER
DECLARE FUNCTION SDL_GetRenderDrawBlendMode(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_BlendMode PTR) AS INTEGER
DECLARE FUNCTION SDL_RenderClear(BYVAL AS SDL_Renderer PTR) AS INTEGER
DECLARE FUNCTION SDL_RenderDrawPoint(BYVAL AS SDL_Renderer PTR, BYVAL AS INTEGER, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_RenderDrawPoints(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Point PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_RenderDrawLine(BYVAL AS SDL_Renderer PTR, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_RenderDrawLines(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Point PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_RenderDrawRect(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_RenderDrawRects(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_RenderFillRect(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_RenderFillRects(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE FUNCTION SDL_RenderCopy(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_Texture PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST SDL_Rect PTR) AS INTEGER
DECLARE FUNCTION SDL_RenderCopyEx(BYVAL AS SDL_Renderer PTR, BYVAL AS SDL_Texture PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS CONST DOUBLE, BYVAL AS CONST SDL_Point PTR, BYVAL AS CONST SDL_RendererFlip) AS INTEGER
DECLARE FUNCTION SDL_RenderReadPixels(BYVAL AS SDL_Renderer PTR, BYVAL AS CONST SDL_Rect PTR, BYVAL AS Uint32, BYVAL AS ANY PTR, BYVAL AS INTEGER) AS INTEGER
DECLARE SUB SDL_RenderPresent(BYVAL AS SDL_Renderer PTR)
DECLARE SUB SDL_DestroyTexture(BYVAL AS SDL_Texture PTR)
DECLARE SUB SDL_DestroyRenderer(BYVAL AS SDL_Renderer PTR)
DECLARE FUNCTION SDL_GL_BindTexture(BYVAL AS SDL_Texture PTR, BYVAL AS SINGLE PTR, BYVAL AS SINGLE PTR) AS INTEGER
DECLARE FUNCTION SDL_GL_UnbindTexture(BYVAL AS SDL_Texture PTR) AS INTEGER

#ENDIF ' _SDL_render_h

' 002 back from SDL2-2.0.1/include/SDL_render.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_system.h

#IFNDEF _SDL_system_h
#DEFINE _SDL_system_h

#IFDEF __WIN32__

DECLARE FUNCTION SDL_Direct3D9GetAdapterIndex(BYVAL AS INTEGER) AS INTEGER

TYPE IDirect3DDevice9 AS IDirect3DDevice9_

DECLARE FUNCTION SDL_RenderGetD3D9Device(BYVAL AS SDL_Renderer PTR) AS IDirect3DDevice9 PTR

#ENDIF ' __WIN32__

'#IF DEFINED(__IPHONEOS__)  AND __IPHONEOS__

'DECLARE FUNCTION SDL_iPhoneSetAnimationCallback(BYVAL AS SDL_Window PTR, BYVAL AS INTEGER, BYVAL AS SUB(BYVAL AS ANY PTR), BYVAL AS ANY PTR) AS INTEGER
'DECLARE SUB SDL_iPhoneSetEventPump(BYVAL AS SDL_bool)

'#ENDIF ' DEFINED(__IPHON...

'#IF DEFINED(__ANDROID__)  AND __ANDROID__

'DECLARE FUNCTION SDL_AndroidGetJNIEnv() AS ANY PTR
'DECLARE FUNCTION SDL_AndroidGetActivity() AS ANY PTR

'#DEFINE SDL_ANDROID_EXTERNAL_STORAGE_READ &h01
'#DEFINE SDL_ANDROID_EXTERNAL_STORAGE_WRITE &h02

'DECLARE FUNCTION SDL_AndroidGetInternalStoragePath() AS CONST ZSTRING PTR
'DECLARE FUNCTION SDL_AndroidGetExternalStorageState() AS INTEGER
'DECLARE FUNCTION SDL_AndroidGetExternalStoragePath() AS CONST ZSTRING PTR

'#ENDIF ' DEFINED(__ANDRO...

#ENDIF ' _SDL_system_h

' 002 back from SDL2-2.0.1/include/SDL_system.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_timer.h

#IFNDEF _SDL_timer_h
#DEFINE _SDL_timer_h

DECLARE FUNCTION SDL_GetTicks() AS Uint32

#DEFINE SDL_TICKS_PASSED(A, B) IIF(CAST(Sint32, (B) - (A)) <= 0, SDL_TRUE, SDL_FALSE)

DECLARE FUNCTION SDL_GetPerformanceCounter() AS Uint64
DECLARE FUNCTION SDL_GetPerformanceFrequency() AS Uint64
DECLARE SUB SDL_Delay(BYVAL AS Uint32)

TYPE SDL_TimerCallback AS FUNCTION(BYVAL AS Uint32, BYVAL AS ANY PTR) AS Uint32
TYPE SDL_TimerID AS INTEGER

DECLARE FUNCTION SDL_AddTimer(BYVAL AS Uint32, BYVAL AS SDL_TimerCallback, BYVAL AS ANY PTR) AS SDL_TimerID
DECLARE FUNCTION SDL_RemoveTimer(BYVAL AS SDL_TimerID) AS SDL_bool

#ENDIF ' _SDL_timer_h

' 002 back from SDL2-2.0.1/include/SDL_timer.h ==> SDL2-2.0.1/include/SDL.h
' 002 start from: SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1/include/SDL_version.h

#IFNDEF _SDL_version_h
#DEFINE _SDL_version_h

TYPE SDL_version
	AS Uint8 major
	AS Uint8 minor
	AS Uint8 patch
END TYPE

#DEFINE SDL_MAJOR_VERSION 2
#DEFINE SDL_MINOR_VERSION 0
#DEFINE SDL_PATCHLEVEL 1
#DEFINE SDL_VERSION_(x) _
   (x)->major = SDL_MAJOR_VERSION : _
   (x)->minor = SDL_MINOR_VERSION : _
   (x)->patch = SDL_PATCHLEVEL
#DEFINE SDL_VERSIONNUM(X, Y, Z) _
    ((X)*1000 + (Y)*100 + (Z))
#DEFINE SDL_COMPILEDVERSION _
    SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
#DEFINE SDL_VERSION_ATLEAST(X, Y, Z) _
    SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)
    'IIF(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z), SDL_TRUE, SDL_FALSE)

DECLARE SUB SDL_GetVersion(BYVAL AS SDL_version PTR)
DECLARE FUNCTION SDL_GetRevision() AS CONST ZSTRING PTR
DECLARE FUNCTION SDL_GetRevisionNumber() AS INTEGER

#ENDIF ' _SDL_version_h

' 002 back from SDL2-2.0.1/include/SDL_version.h ==> SDL2-2.0.1/include/SDL.h

#DEFINE SDL_INIT_TIMER &h00000001
#DEFINE SDL_INIT_AUDIO &h00000010
#DEFINE SDL_INIT_VIDEO &h00000020
#DEFINE SDL_INIT_JOYSTICK &h00000200
#DEFINE SDL_INIT_HAPTIC &h00001000
#DEFINE SDL_INIT_GAMECONTROLLER &h00002000
#DEFINE SDL_INIT_EVENTS &h00004000
#DEFINE SDL_INIT_NOPARACHUTE &h00100000
#DEFINE SDL_INIT_EVERYTHING ( _
                SDL_INIT_TIMER OR SDL_INIT_AUDIO OR SDL_INIT_VIDEO OR SDL_INIT_EVENTS OR _
                SDL_INIT_JOYSTICK OR SDL_INIT_HAPTIC OR SDL_INIT_GAMECONTROLLER _
            )

DECLARE FUNCTION SDL_Init(BYVAL AS Uint32) AS INTEGER
DECLARE FUNCTION SDL_InitSubSystem(BYVAL AS Uint32) AS INTEGER
DECLARE SUB SDL_QuitSubSystem(BYVAL AS Uint32)
DECLARE FUNCTION SDL_WasInit(BYVAL AS Uint32) AS Uint32
DECLARE SUB SDL_Quit()

#ENDIF ' _SDL_H

' 001 back from SDL2-2.0.1/include/SDL.h ==> SDL2-2.0.1.h2bi

END EXTERN ' (h_2_bi -P_oCD option)

#IFDEF __FB_WIN32__
#PRAGMA pop(msbitfields)
#ENDIF

' Translated at 13-10-28 10:04:08, by h_2_bi (version 0.2.4,
' released under GPLv3 by Thomas[ dot ]Freiherr{ at }gmx[ dot ]net)

'   Protocol: SDL2-2.0.1.bi
' Parameters:
'                                  Process time [s]: 0.5548149084206671
'                                  Bytes translated: 154310
'                                      Maximum deep: 6
'                                SUB/FUNCTION names: 544
'                                mangled TYPE names: 9
' SDL_mutex
' SDL_cond
' SDL_Thread
' SDL_Window
' SDL_Cursor
' SDL_SysWMmsg
' SDL_Renderer
' SDL_Texture
' IDirect3DDevice9
'                                        files done: 43
' SDL2-2.0.1/include/SDL.h
' SDL2-2.0.1/include/SDL_main.h
' SDL2-2.0.1/include/SDL_stdinc.h
' SDL2-2.0.1/include/SDL_config.h
' SDL2-2.0.1/include/SDL_config_windows.h
' SDL2-2.0.1/include/SDL_platform.h
' SDL2-2.0.1/include/begin_code.h
' SDL2-2.0.1/include/close_code.h
' SDL2-2.0.1/include/SDL_assert.h
' SDL2-2.0.1/include/SDL_atomic.h
' SDL2-2.0.1/include/SDL_audio.h
' SDL2-2.0.1/include/SDL_error.h
' SDL2-2.0.1/include/SDL_endian.h
' SDL2-2.0.1/include/SDL_mutex.h
' SDL2-2.0.1/include/SDL_thread.h
' SDL2-2.0.1/include/SDL_rwops.h
' SDL2-2.0.1/include/SDL_clipboard.h
' SDL2-2.0.1/include/SDL_cpuinfo.h
' SDL2-2.0.1/include/SDL_events.h
' SDL2-2.0.1/include/SDL_video.h
' SDL2-2.0.1/include/SDL_pixels.h
' SDL2-2.0.1/include/SDL_rect.h
' SDL2-2.0.1/include/SDL_surface.h
' SDL2-2.0.1/include/SDL_blendmode.h
' SDL2-2.0.1/include/SDL_keyboard.h
' SDL2-2.0.1/include/SDL_keycode.h
' SDL2-2.0.1/include/SDL_scancode.h
' SDL2-2.0.1/include/SDL_mouse.h
' SDL2-2.0.1/include/SDL_joystick.h
' SDL2-2.0.1/include/SDL_gamecontroller.h
' SDL2-2.0.1/include/SDL_quit.h
' SDL2-2.0.1/include/SDL_gesture.h
' SDL2-2.0.1/include/SDL_touch.h
' SDL2-2.0.1/include/SDL_filesystem.h
' SDL2-2.0.1/include/SDL_haptic.h
' SDL2-2.0.1/include/SDL_hints.h
' SDL2-2.0.1/include/SDL_loadso.h
' SDL2-2.0.1/include/SDL_log.h
' SDL2-2.0.1/include/SDL_messagebox.h
' SDL2-2.0.1/include/SDL_power.h
' SDL2-2.0.1/include/SDL_render.h
' SDL2-2.0.1/include/SDL_system.h
' SDL2-2.0.1/include/SDL_timer.h
' SDL2-2.0.1/include/SDL_version.h
'                                      files missed: 16
' AvailabilityMacros.h
' TargetConditionals.h
' memory.h
' strings.h
' inttypes.h
' iconv.h
' alloca.h
' signal.h
' intrin.h
' libkern/OSAtomic.h
' endian.h
' altivec.h
' mmintrin.h
' mm3dnow.h
' xmmintrin.h
' emmintrin.h
'                                       __FOLDERS__: 1
' SDL2-2.0.1/include/
'                                        __MACROS__: 3
' 526: #define DECLSPEC
' 533: #define SDLCALL
' 565: #define extern
'                                       __HEADERS__: 0
'                                         __TYPES__: 0
'                                     __POST_REPS__: 13
' 1: int8_t>BYTE
' 1: uint8_t>UBYTE
' 1: int16_t>SHORT
' 1: uint16_t>USHORT
' 4: int32_t>INTEGER
' 1: uint32_t>UINTEGER
' 4: int64_t>LONGINT
' 1: uint64_t>ULONGINT
' 2: SDL_RWops_unknown&
' 1: SDL_log&_ ALIAS "SDL_log"
' 1: SDL_QUIT&
' 1: SDL_VERSION&
' 1: SDL_BlitMap>ANY
